Back to APIs

Create, update or delete single or multiple records in your bases.

Using our official Airtable integration

Create any tasks possible with the Airtable API.

Use io.runTask() and the official SDK or fetch.

Airtable integration docs

Example code using Airtable

Below are some working code examples of how you can use Airtable with Trigger.dev. These samples are open source and maintained by the community, you can copy and paste them into your own projects.

1
import { TriggerClient } from "@trigger.dev/sdk";
2
import { Airtable } from "@trigger.dev/airtable";
3
import { Typeform } from "@trigger.dev/typeform";
4
5
const typeform = new Typeform({
6
id: "typeform",
7
token: process.env.TYPEFORM_TOKEN!,
8
});
9
10
const airtable = new Airtable({
11
id: "airtable",
12
token: process.env.AIRTABLE_TOKEN!,
13
});
14
15
//this is the type definition for the table
16
type Submission = {
17
id: string;
18
name: string;
19
email: string;
20
emailContactEnabled: boolean;
21
};
22
23
// This job populates an Airtable table when a new submission is created in Typeform
24
client.defineJob({
25
id: "typeform-new-submission-update-airtable",
26
name: "On new Typeform submission update Airtable",
27
version: "1.0.0",
28
integrations: {
29
typeform,
30
airtable,
31
},
32
trigger: typeform.onFormResponse({
33
// to get uid & tag instructions can be found here:
34
// https://trigger.dev/docs/integrations/apis/typeform#get-notified-of-new-form-responses
35
uid: "<your-form-id>",
36
tag: "<your-tag>",
37
}),
38
run: async (payload, io, ctx) => {
39
// You can get your base-id and table-name from airtable
40
const table = io.airtable
41
.base("<your-base-id>")
42
.table<Submission>("<your-table-name>");
43
44
if (payload.form_response.answers[0].type !== "text") {
45
throw new Error("The first answer is not a name");
46
}
47
const name = payload.form_response.answers[0].text;
48
49
if (payload.form_response.answers[1].type !== "email") {
50
throw new Error("The second answer is not an email");
51
}
52
const email = payload.form_response.answers[1].email;
53
54
if (payload.form_response.answers[2].type !== "choice") {
55
throw new Error("The third answer is not a choice");
56
}
57
const emailContactEnabled =
58
payload.form_response.answers[2].choice.label === "Yes";
59
60
//create a new record
61
const newRecords = await table.createRecords("create records", [
62
{
63
fields: {
64
id: payload.event_id,
65
name,
66
email,
67
emailContactEnabled,
68
},
69
},
70
]);
71
72
await io.logger.info("A new form submission was created.", {
73
payload,
74
newRecords,
75
});
76
},
77
});