Create AI-Generated Content in Your Zaps

Learn how to integrate OpenAI prompts in your Zaps and build automations that generate new content with AI. We'll walk you through each step of the process in this tutorial.

Written by
Matt Jasinski
and

July 5, 2023

No-code automation is a great way to automate repetitive tasks at work. 

Until recently, though, it’s not been possible to create entirely new data inside of a workflow automation. 

Using conventional automation techniques, you can only duplicate existing data, or combine existing data to create new values. 

But now with AI, your no-code automations can generate summaries, outlines, entire blog posts, and more. In this post, we’re going to show you how to add automated OpenAI prompts to your Zapier automations. 

We’ll use an example that updates tasks in Asana, but the same principles apply to any apps that you can automate with Zapier.

The key components in this tutorial are really Zapier and OpenAI; the other apps you use are entirely up to you. 

Now let’s get started.

A brief overview of automating AI prompts in Zapier

First, we’ll give you a brief overview of the entire process. Then, we’ll walk you through each step in more detail. 

1. First, you need to create a new Zap and add a trigger event

2. Optionally, you can add actions and searches to gather additional data.

3. Add an OpenAI action, and choose “Send Prompt” as the event. 

4. Connect your OpenAI account to Zapier. You will be billed a very small amount to use the OpenAI API. 

5. Configure your OpenAI action, and enter your prompt. Be sure to include dynamic data where appropriate. 

6. Send the AI response to any other app that you’d like. Save it in Drive, update a record in Airtable, send it to Slack, etc.   

Note that you can also use a ChatGPT step instead of OpenAI if you’d prefer. 

Both apps in Zapier will work in largely the same way, but you will see a few different options for each. 

For this tutorial, we’ll be focusing on the “OpenAI” app. 

Now, let’s look at automating OpenAI prompts with Zapier step by step.

Add a trigger and gather other required data with actions, searches

First, you’ll need to create a new Zap and add a trigger. 

We’ll go over this part of the automation quickly, since it’s not really the main focus of the tutorial. However, If you’re not familiar with using Zapier in general, you can check out our beginner’s guide to learn the basics

You can select any trigger event that suits the automation you want to build. For instance, If you want your OpenAI prompt to summarize an email, you’d probably use something like a GMail trigger. 

In our example, we want OpenAI to generate a new description for every task that we add to an Asana project, using the tasks’ details as a basis for its response. 

After it generates the description, we’ll have it update the task with the new information. 

To set up that automation, we’ve already created an Asana trigger that watches for new tasks in a specific project. 

Once you’ve set up the trigger you want to use, be sure to test it and confirm that it’s able to find some data. 

Optional actions and searches 

Next, if you want to use any additional data for your prompt that can’t be found in your trigger, you’ll need to add one or more action or search steps to find that data.

In our example, we’ve added an Airtable search step to look up the client and project associated with the task. This information, which includes attributes like the project start and end date, may help to inform the AI-generated description. 

In your automation, you might be able to gather all the data you need in the trigger. But if you do need your automation to grab some extra data that will go into your prompt, just remember to add these steps before the prompt. 

If you’ve added any additional steps, test them out to make sure they’re working properly. 

Once you have all the data you need to feed into your prompt, it’s time to add an action that will create and send that prompt. 

Add an OpenAI step to Zapier and configure your account

Add a new action to your Zap. Choose OpenAI as the app, and select “Send prompt” as the event. 

Now, you’ll need to connect your OpenAI account to Zapier. If you don’t already have an OpenAI account, open up a new tab to create one at openai.com

As we noted in the overview, sending OpenAI prompts through Zapier will incur a charge on your OpenAI account. 

The exact price will depend on the language model you use, but will ultimately come out to a few cents per prompt at most. 

Additionally, new OpenAI accounts include a $5.00 API credit, but this does expire after a few months if it isn’t used. In the end, the cost to access OpenAI’s API is very small, but it’s worth noting that it isn’t free. 

You can learn more about the pricing structure on the OpenAI pricing page

If you’re comfortable with the charges you’ll be responsible for, go to platform.openai.com to finish connecting your account to Zapier. 

Click on your account name, and select “View API keys”.

Click on “Create new secret key” to generate a key that will let third-party apps like Zapier access your OpenAI account. 

Copy that key, and return to your Zap. 

Click on “Connect a new account”, and paste the key you copied earlier. 


The popup should close, and return you to your Zap in progress. Now, you can start configuring all of the necessary settings for your OpenAI prompt step. 

Configure the OpenAI step and write your prompt

First, you’ll be asked to choose the model that you want to use for the prompt. Zapier defaults to using the “DaVinci” model, and recommends it for most use cases in your Zaps. 

However, there are several other models that you can choose from under the “Model” tab. If you’d like to learn more about each model and the cost to use it, you can check out OpenAI’s pricing page again. 

Write your prompt for the AI to process

Next, you can start crafting the actual prompt that you want to send to OpenAI. Your prompt can include both static text entered directly into this field, and dynamic data retrieved from the trigger and earlier steps in your Zap. 

In other words, you can enter a prompt here exactly like you would with ChatGPT, but you can also replace some words with Zapier data instead of static text. 

Be sure to note the style and tone that you want the AI to use as well as the content that you want it to generate. 

In our example, we’ll use this prompt to ask the AI to generate a task description:

“Create a description for the following task based on the information provided. Your description should consist of 1-3 short sentences describing the task and its parameters. Include a brief assessment of the task’s urgency based on the information provided.

Write in the second person, and use a friendly and professional tone, like you’re speaking to a coworker.”

Add dynamic data to your prompt

After the main part of the prompt, we’ll include the task’s key attributes, identified with simple labels. 

By including dynamic data like this, we can ensure that the prompt describes each individual task that runs through the automation

Note that you may need to go back and adjust your prompt after testing it out. When you’re dealing with AI, it’s often a game of trial and error.

If you want to avoid the very small charges, you can use ChatGPT to test your prompt. However, ChatGPT may be using a different model than what you've chosen in Zapier.

Set the model’s temperature

Next, you can set the model’s temperature. The temperature can also be thought of as the model’s “Creativity”. 

The higher the number, the less predictable the results will be. Additionally, as you set the temperature higher, the likelihood of inaccurate “hallucinations” increases as well. 

Whenever you’re dealing with AI, there’s no guarantee of accuracy, but you should probably go for lower numbers (maybe even zero) if you want more accurate but less creative answers.

Choose a maximum length (optional)

The next setting is “Maximum length”. 

This sets the max length of the AI’s response in tokens. With OpenAI language models, 1,000 tokens are roughly equivalent to 750 words. 

You can change this setting to whatever you’d like, but note that most models have a limited number of tokens that they can process as context. Even if you set your max higher than that number, the limit will still apply. 

By default, Zapier will attempt to auto-calculate the context limit and use that as a maximum length. You can search for more info about the model you’re using if you want to know more about exactly how it works. 

Provide a stop sequence (optional)

Next, you can enter an optional stop sequence. If you enter a stop sequence, the AI will stop generating an answer once it produces the same characters as you’ve provided in your stop sequence.

For example, your prompt may ask the AI to generate a numbered list of app name ideas. If your stop sequence is “7.”, the model should stop after it produces the characters “7.”

Then, it will remove the stop sequence from its response. 

If you don’t want to add a stop sequence, and you probably won’t in most use cases, you can just leave this field blank. 

Top P, Frequency Penalty, and Presence Penalty

Finally, let’s take a look at these last three settings: Top P, Frequency Penalty, and Presence Penalty.

These are all advanced options for adjusting the output of the model. You can tweak these options to make the model more or less repetitive, for example.

You can read the descriptions provided in Zapier for more info, but you probably won’t need to change these for most use cases. You can start by leaving these fields with their default values, and adjusting them later if you want to fine-tune your results. 

Test your OpenAI action

Once you’ve configured the OpenAI action as desired, give the step a test. You should see OpenAI’s response to your prompt, along with a lot of other data. 

Note that if you’re using dynamic data to populate this step, the AI’s answers may be quite different each time. 

The test should give you a general sense of how it will respond, but expect some variation each time the Zap runs with different data. 

Among the other data, you can also see things like how many tokens the prompt used. 

After reviewing the test data, you can adjust your OpenAI prompt as needed. Once it’s ready, you can add an additional step to your Zap to share, edit, or otherwise use the AI-generated answer. 

Send your prompt to other apps

Add a new action to your Zap. 

You can add an action in virtually any app that you want to use. You could send the prompt in a Slack message, add it to an email, enter it into an Airtable record, or anything else you want to do with it. 

For our example, we’ll add a new step to update our original Asana task with this new description.

To find the right task, we’ll enter the ID of the task that triggered the automation into the “task” field. Then, we’ll leave most of the fields blank.

By leaving them blank in this “update” step, we’re essentially telling Zapier to leave those fields as they are. It won’t delete the contents that are already there. 

We’re only going to update the “notes” field by adding in the ‘Response’ value from the OpenAI step. The ‘Response’ is the answer that OpenAI generated for your prompt. 

If you want to send the AI’s answer to another app, this is the piece of data you need to look for. 

Once you’ve configured your step to your liking, give it a quick test. 

In our example, we get a success message in Zapier. 

Then, when we open up Asana, we can see the task updated with a new description. 

If your Zap ran correctly, turn it on and publish it. Now, whenever your trigger condition is met, Zapier will automatically send a prompt to OpenAI exactly as you’ve configured it to. 

Discover new possibilities in your Zaps with AI

AI is rapidly unlocking all sorts of new possibilities in workflow automation. Now, as automators, we’re no longer limited to working with existing data. 

We can use AI prompts to generate, edit, and summarize new content, and we can use automation providers like Zapier to send the answers to any app we want. 

If you’d like to learn more about no-code automation and AI tools, check out our blog or our YouTube channel. You can also follow XRay on Twitter, Facebook, or LinkedIn.

Similar Blog Posts

Not sure where to start with automation?

Hop on a 15-minute call with an XRay automation consultant to discuss your options and learn more about how we can help your team to get more done.

Schedule a 15-Minute Call