Connect to the OpenAI Assistants API in Airtable with No-Code

Jan 5, 2024Andy Cloke

OpenAI Assistants call OpenAI’s models with specific instructions and extra context, in order to generate better responses. This guide shows you how to connect to and use the Open Assistants API in Airtable. It's 100% no-code. Let's get started!

Create Assistant in OpenAI

1. Head to https://platform.openai.com/assistants and click "Create" to create your first OpenAI Assistant.

2. Add a Name for you assistant. We'll use "SEO Copywriter".

3. Add Instructions for your assistant. This is the extra context / information that your assistant needs to do its job. We'll use the following instructions:

You are an expert copywriter for a B2B SaaS company. Create a short blog post description for the blog post title. Return only the description. Use terse, instructional language. Avoid corporate, salesy or flowery language.

4. Select a Model, e.g. "gpt-4o".

OpenAI will automatically save the assistant:

openai assistant dashboard.png

Set up Airtable base

You can use your existing table, but for this guide we'll use a table called "Blog posts" with a single-line text field called "Title" and a long-text field called "Description". The "Title" field contains our blog post titles.

blog posts table records.png

We need a view that contains all the blog posts without descriptions.

Create a new Grid view called "Needs description" with the following filters:

  • "Title" is not empty
  • "Description" is empty
needs description grid view.png

Add Data Fetcher to Airtable

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

2. After the Data Fetcher extension launches, sign up for a free account or sign in to your existing account.

3. After signing up, click "Create your first request".

create your first request logo 2 smaller.png

Connect to OpenAI Assistants API in Airtable

1. Under Application, select "OpenAI".

open ai application.png

2. Under Authorization, copy and paste your OpenAI API key. If you do not have one yet, click "Create new secret key" here in the OpenAI dashboard.

api key authorization.png

3. For Endpoint, select "Create assistant thread and run".

openai assistant thread and run.png

4. Add a request name, like "Create descriptions".

create descriptions request name.png

5. Click Save & Continue.

openai assistants save & continue.png

6. Select the OpenAI Assistant that you created in the first step.

open assistant step.png

Our assistant knows its job - to create blog post descriptions - because of the context we provided when we created it using the OpenAI dashboard. All we need to do is provide a reference to the "Title" field in our table.

7. Under Messages, click the + button on the right-hand side to add a table reference.

openai assistants messages + button.png

8. For Table, select "Blog posts". For Field, select "Title". Under Run for every record in view, select "Needs description".

openai assistants cell reference button.png

9. Click Confirm. The Messages step will now reference our Airtable data, ready to send it to the OpenAI assistants API.

assistants messages cell reference.png

10. Click "Save & Run" in the bottom right-hand.

The first time you run the requests, the Response Field Mapping will open.

11. Map the "Message" field that comes back from OpenAI to the existing "Description" field in your table. To do this, click Existing field, then select the "Description" field from the dropdown.

openai message mapped to description response field mapping.png

12. Then click Save & Run in the bottom right.

The request will run for every record in your "Needs description" view. This may take some time, as the OpenAI Assistants API tends to be slower than the ChatGPT endpoint.

openai assistants generated descriptions.png

Run OpenAI Assistant in Airtable Automatically

You can manually connect to the OpenAI Assistants API by clicking "Run". However, you can also run the request automatically whenever a new record enters the "Needs description" view by using a Trigger.

1. Scroll to the Schedule | Trigger | Webhook URL tabs, select the Trigger tab, and click Upgrade.

schedule trigger webhook url tabs.png

2. Choose a Data Fetcher pricing plan from the different options depending on your needs and enter your payment details. Triggers are available on all paid plans.

3. Click I've done this back in Data Fetcher.

trigger tab upgrade I-ve done this.png

4. Click + Authorize on the Trigger tab.

trigger tab authorize.png

5. Click the prompt I understand, let's Authorize.

Authorize2.jpg

6. Click + Add a base. By selecting "All current and future bases in all current and future workspaces", you will avoid the need to re-authorize access for individual bases in the future.

Authorize3.jpg

7. Click on "Grant access".

Authorize4.jpg

8. Back in Data Fetcher, under Trigger, choose the option to run the Airtable OpenAI Assistants integration for Record created.

record created trigger type.png

9. Select the "Blog posts" Table and the "Needs description" View.

blog posts table and needs description trigger view.png

10. Finally, click Save. Whenever a record is created in the "Needs description" view, Data Fetcher will connect to the OpenAI Assistants API and generate a description.

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