Skip to content
aeropage-round-dark
Aeropage Documentation
Tools and APIs

OpenAI Connector

This tool allows you to send prompts to the same engine that powers ChatGPT, by mixing static and dynamic values from your Airtable records.

Before you Begin

This tool is primarily intended to let you automate messages between OpenAI and Airtable, this is different than bulk processing.

Create your OpenAPI Key

To connect to the openai API you will need a key. A free trial account will give you some credit to use with the api, and a fairly slow rate limit. You can check your usage with the links below, add more credit and increase your rate limit too.

Check your usage :

blunt-bulb
From our experience, short requests cost about $0.01 per record / call so the free credit can be used a lot before upgrading.

Setup your Connector

The user interface…


1 - Choose whether you want text or image url returned based on your prompt
2 - Your message for artificial intelligence
3 - Choose which record to use in your prompt.
4 - Redirects to AI's answer.
7 - Redirects to api endpoint AI's answer.

Untitled.png

Api key

Make sure you have your api key specified. If no click ‘here’ and specify it there.
Untitled 1.png

Untitled 2.png
When you specified an open ai api key you can go back to editor page and choose mode

Untitled 3.png

Modes:

Text - returns text as a response
Image(not available now) - returns image as a response

Prompt

You can write your question here.
Untitled 4.png

When you finished, click:

Preview(1) which redirects AI's answer.

Untitled 5.png

Api endpoint(2) which redirects to enpoint with AI's answer.
Untitled 6.png

Connect your Automations

Now from Airtable, Zapier or Make (or other systems) you can send a request to your endpoint with a script - and include the record id that you want to use in the prompt. The response will come back, and you can use it in any workflow you want.

Airtable


Create new automation.
Untitled 7.png


Add two actions:
Run a script
Update record
Untitled 8.png

Run a script


Copy the script here into your automation…
let inputConfig = input.config();
let apiUrl = '[paste your sharing link here]' + inputConfig.recordid;
let apiResponse = await fetch(apiUrl);
let data = await apiResponse.text();
if (apiResponse.status == 200) output.set('openai', data)
else throw Error("No valid response. Aborting so no openai response is sent.")

Copy the Sharing Link for your project
Untitled 9.png

blunt-bulb
Make sure you replace the ‘sharing link’ in the script with the one you copied in the previous step…

We also need to add an Input variable for the record id.
Untitled 10.png
Give it the name recordid and for the value, click the [+] and then choose Airtable record ID
Untitled 11.png

When you have done the steps above, click Test and you should see a successful result like this …

Untitled 12.png

Update Record


Firstly enter a description for this action.

Untitled 13.png

Select a table where is the field that you want to update.

Untitled 14.png

In ‘Record ID’ section select ‘Airtable record ID’.
Untitled 15.png

Finally select a field that you want to update and then ‘openai’ from ‘Run a script’

Untitled 16.png
Untitled 17.png

Now you can update fields with your automation

Untitled 18.png

Untitled 19.png

Setting up Open Ai tool to Respond by Webhook

There are times when Open Ai’s API response time can exceed Airtable’s max automation run time (30 seconds). As such, this incident causes automation to result to a timeout error. To remedy this, we introduce a new feature called Respond by Webhook where the text is generated on the background and is sent to an Airtable webhook therefore preventing the errors in the automation.

There are few limitations for this feature:
Limited only to text mode
You will need two automations for this to work.
Our system will only wait for the Open Ai API response for up to 1 minute. After that, the system will timeout.

To set this up, follow these steps:

Setting up the Prompt Automation
This automation will send the prompt to Open AI via Aeropage Tools Open AI Proxy. This is the first of 2 automations that you will setup for this feature.

In the automation dashboard, add a trigger and a “Run a Script” action. The trigger condition will be up to you.
Untitled 20.png

In the Aeropage Tools editor, click the “Use in Airtable” button located at the lower right corner of the editor.
Untitled 21.png

Once the popup appears, click the “Copy to Clipboard” button
Untitled 22.png


Going back to the Automation dashboard, paste the code inside the “Run a Script” action editor.

blunt-bulb
Don’t forget to set the input name as recordid.
Untitled 23.png

And you’re done setting it up! Now we move to the next automation.

Setting up the Webhook Automation
This automation will receive the data from our Aeropage Tools Open Ai API proxy and update a record.

Create new automation and set the trigger as “When webhook received” and add an “Update record” action.
Untitled 24.png

Inside the “When webhook received” trigger, you will see a URL in the Configuration section. Copy this URL since it will be needed in the Aeropage Tools Open Ai Connector editor.
Untitled 25.png

In the Aeropage Tools Open Ai Connector editor, enable Respond by Webhook and paste the URL that you copied from the “When webhook received” trigger in Airtable. Once copied, save the changes in the editor.

Untitled 26.png


Moving on to the “Update a Record” action, you will set the table and the record data like as shown below. The Record ID and the field data will come from the webhook data.

Untitled 27.png

blunt-bulb
The structure of the data received by the webhook looks like the screenshot below. The body contains the recordID and the data in text format.
Untitled 28.png


Turn on both of the Automation that you set up and you’re done! The response from our system may take sometime to be received by the webhook since it depends on the response time of Open Ai’s API.

Once working, you will see the field getting populated with the Open Ai’s generated text. In the screenshot below, the generated text is saved in “Response” field.
Untitled 29.png

✅ Respond By Webhook (new)

Due to the slow response of Open Ai API which can exceed 30 seconds, we added a feature that lets you generate text results via webhooks.
There a few limitations for this feature:
Limited only to text mode
You will need two automations for this to work.
Our system will only wait for the Open Ai API response for up to 1 minute. After that, the system will timeout
To set this up, head over to the “Setting up Open Ai tool to Respond by Webhook” section.

✅ Bulk Processing (new)

We have now added a bulk export tool, which can continuously run to generate content from prompts in your Airtable data, and add the generated responses (text or images) to a specified field.
There are a few small limitations as you can see in the video.
due to rate limiting on openai, the free tier will be very slow (approx 10 seconds per request)
if an image fails to generate, just remove it and run the tool again, it will only process the records without values.

Loading…

blunt-bulb
Do not use external automations for bulk processing in large quantities or you may exceed the openai rate limits.


✅ Automations

Triggered one at a time to automatically send a prompt to the AI and recieve a response. Each request has some time inbetween, and so does not exceed the rate limit of the OpenAI system.

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.