Skip to content

How to Automatically Compose and Send Emails using OpenAI and Gmail

Let us explore how you can integrate Airtable with OpenAI and Gmail. Following this integration, you will be able to automatically compose emails using Airtable and OpenAI, and share them with anyone via Gmail.
This automation requires a one-time setup, for which we will use Pabbly Connect.
We will first link Airtable with Pabbly Connect to capture the subject for your email, then link Pabbly Connect with OpenAI to compose an email, and lastly, send that email via Gmail.

Steps to Automatically Compose and Send Emails using OpenAI and Gmail

1. Sign In / Sign Up to Pabbly Connect and Create a Workflow
2. Establish a Connection between Airtable and Pabbly Connect
3. Setup OpenAI as the Action App to Compose Emails
4. Setup Gmail as the Action App to Send Email

Step 1:- Sign In / Sign Up to Pabbly Connect and Create a Workflow

A. Sign In / Sign Up

To begin this process, visit Pabbly Connect and create your account by clicking on the ‘Sign Up Free’ button. You can also click on Sign In if you already have an account.

Click on the Pabbly Connect ‘Access Now’ button

B. Create Workflow

To create a new workflow, click the ‘Create Workflow’ button.

Name your workflow, and click on ‘Create’.

Step 2:- Establish a Connection between Airtable and Pabbly Connect

We will now look at the steps through which we will establish a link between Airtable and Pabbly Connect. This will help us to fetch the data from Airtable.

A. Trigger App

Trigger allows us to choose the application that will receive the data for Pabbly Connect. In our case, it would be Airtable.

Choose ‘Airtable’ as the Trigger App, select ‘New Record’ as an Action Event, and click on ‘Connect’.

B. Connect Airtable Account

To connect with your Airtable account, select ‘Add New Connection’. To find your API Token, click on ‘Account’.

Copy the API Token, paste it into its given field and click on ‘Save’.

Select the Base and Table from where you want to capture the data.

Select the Trigger Field as ‘Created’ and click on ‘Save & Send Test Request’.

We have established a link between Airtable and Pabbly Connect. Pabbly Connect will now automatically capture the data entered in Airtable.

Step 3:- Setup OpenAI as the Action App to Compose Emails

Action allows us to choose the application that will get executed by the workflow trigger.
Since we want to compose emails for the captured subject using OpenAI – it will be our Action App.

A. Action App

Choose ‘OpenAI’ as the Action App, select ‘Generate Content’ as an Action Event, and click on ‘Connect’.

B. Connect OpenAI Account

To connect with your OpenAI account, select ‘Add New Connection’. You will be prompted to enter your API Token. Find your API Token by clicking on the ‘OpenAI API Keys page’ button.

Generate and copy your API Token, paste it into its given field, and click on ‘Save & Send Test Request’.

Select the AI Model you want to use for composing the email.

C. Enter / Map the Necessary Fields

Now that you have connected your OpenAI account, all you need is to map the necessary details from the step above. Mapping ensures our data remains dynamic and changes as per the received responses.

Compose a Prompt by mapping the details from the step above.

Similarly, select/enter other fields, leaving the unnecessary ones empty, and click on ‘Save & Send Test Request’.

As soon as you click on Save & Send Test Request, an email will automatically be composed using OpenAI.

Step 4:- Setup Gmail as the Action App to Send Email

Now that we have composed the email using OpenAI, we will now send it to the email address of our choice via Gmail. Therefore, Gmail will be our Action App.

Add another Action step to your workflow by clicking the ‘+’ button.

A. Action App

Choose ‘Gmail’ as the Action App, select ‘Send Email’ as an Action Event, and click on ‘Connect’.

B. Connect Gmail Account

To connect your Gmail account, select ‘Add New Connection’, and click on ‘Connect With Gmail’. Also, grant the authorization. This account will be used for sending emails.

Enter the Recipient Email Address to which you want to send the emails.

Map the Email Subject and Email Content from above, and click on ‘Save & Send Test Request’.

The moment you click on Save & Send Test Request, an email will be sent to the recipient’s email address.

Our automation is complete. We have successfully integrated Airtable with OpenAI and Gmail. Now, each time you enter a new subject in your Airtable, an email on the same subject will be composed using OpenAI and shared via Gmail.

You can copy this entire workflow by clicking this link.

Sign Up for a free Pabbly Connect account, and start automating your business
Subscribe to our Youtube Channel for more such automation
For any other queries, visit our forum