Connect to the OpenAI API in Airtable with No-Code

Jun 25, 2024Andy Cloke

In this simple tutorial, we'll learn to connect to the OpenAI API in Airtable without coding.

We'll set up the Airtable OpenAI integration to generate descriptions for a list of podcasts in our Airtable base.

Let's get into it!

Set up Airtable base

1. Create a table called "Podcasts" or use an existing table.

2. Add the items you want to generate descriptions for in the "Name" field.

3. Create another field called "Description" with the type "Long text".

Podcasts table with data.png

4. Create a new Grid view called "Needs description" and add the following filters:

  • The "Name" field is not empty.
  • The "Description" field is empty.
Needs description view.png

Install the Airtable OpenAI Connector

1. Add Data Fetcher to you base from the Airtable marketplace.

2. Sign up for a free Data Fetcher account.

Data Fetcher Sign Up

3. On the home screen of Data Fetcher, click Create your first request. Requests in Data Fetcher are how you import data into or send data from your Airtable base with no-code.

create your first request logo 2 smaller.png

Connect to the OpenAI API in Airtable

1. For Application, select "OpenAI" to use the Airtable OpenAI integration.

open ai application.png

You will need your OpenAI API key. Create one in your OpenAI dashboard if you don't have one yet.

2. Copy and paste your OpenAI API key into Data Fetcher under Authorization.

api key authorization.png

3. For Endpoint, choose 'Create chat message completion'.

ChatGPT-Airtable-Integration5.jpg

4. Give your request a name, such as "Generate descriptions".

generate descriptions name.png

5. Click Save and Continue.

save and continue openai podcast descriptions.png

6. On the next screen, for Model, choose "GPT-4o".

gpt-4o model from openai.png

For Messages, we want to add the message that we will send to the OpenAI API, and reference our "Name" field, so that the podcast names are substituted in when we run the request

7. Write the following sentence:

Write a single-sentence description of the podcast: 

8. Click the + button on the right-hand side of the input.

podcast openai messages + button.png

9. On the window that opens, select the "Podcasts" Table. Then select "Prompt" for Field and 'Needs description' for Run for every record in view.

podcast name cell reference modal.png

10. Click Confirm.

The Messages field should now contain a reference to our "Name" field.

messages field with table reference in.png

11. Click Save & Run in the bottom right.

Now the request will run, and the Response Field Mapping modal will open. This is where you can specify which fields to import from the OpenAI API and how they map to fields in Airtable. 

12. Map the "Message" field to map to your existing 'Description' field.

message field mapped to podcast description.png

13. Click "Save & Run" in the bottom right of the Response Field Mapping.

Data Fetcher will now run the Airtable OpenAI integration and generate the podcast descriptions using AI! Return to your default view in Airtable and you will see them.

podcast descriptions generated.png

Run Airtable OpenAI integration automatically

You can automatically run the request when a new record is created using Data Fetcher's Trigger feature.

Triggers are a paid Data Fetcher feature, so you'll first need to upgrade your workspace.

1. Scroll to the Schedule / Trigger / Webhook URL tabs and click on the Upgrade button on the Trigger tab.

schedule trigger webhook url tabs.png

2. Select a pricing plan to suit you and enter your payment details.

3. In Data Fetcher, click I've done this.

trigger tab upgrade I-ve done this.png

Now you need to authorize Data Fetcher to access your Airtable base.

4. Click + Authorize.

trigger tab authorize.png

5. On the modal that pops up, click I understand, let's Authorize.

Authorize2.jpg

6. Go through the Airtable authorize process in the window that opens.

Back in Data Fetcher, ensure the Trigger tab is selected.

7. Select the trigger type of "Record created".

trigger tab record created.png

8. Select the "Podcasts" table and the "Needs description" view.

trigger podcast needs description.png

9. Click "Save" in the bottom right to save the trigger.

The Airtable OpenAI integration will now run whenever a record is created in the "Needs description" view.

As well as generating text, we can also OpenAI and Data Fetcher to generate images using AI in Airtable.

Related Posts

How to Extract Data from Images in Airtable using AI

How to Extract Data from Images in Airtable using AI

Jul 25, 2024

Zayyad Muhammad Sani

OpenAI
Extract Data from PDFs to Airtable using OpenAI

Extract Data from PDFs to Airtable using OpenAI

Jul 18, 2024

Zayyad Muhammad Sani

OpenAIPDF
How to Use Airtable Generative AI

How to Use Airtable Generative AI

Jul 5, 2024

Andy Cloke

OpenAI