trigger.dev
trigger.dev copied to clipboard
Airtable webhook support
Todo
- [ ] Remove
keycolumn fromTriggerEvent - [ ] Add
lastDeliveryandversioncolumns to ExternalSource - [ ] Use a cursor for getting Airtable payloads
- [ ] Verify the Airtable webhook using the raw body
- [ ] Amalgamate changes into a structure that's good for users
- [ ] Create convenient functions so user's can convert between fieldIds and names in their workflows
Desired payload format
const payload = {
recordId: "dsfgh",
type: "update",
fields: {
Author: {
fieldId: "dfg6y464hg43",
previous: "123",
current: "456",
},
},
};
Workflow usage
const orgChart = airtable.tableSchema({
dfg6y464hg43: {
name: "Last contacted",
type: airtable.CollaboratorSchema
},
});
new Trigger({
id: "airtable-webhook-9",
name: "Airtable table change",
apiKey: "trigger_dev_zC25mKNn6c0q",
on: airtable.events.tableEvent({
baseId: "appX9X9X9X9X9X9X9",
tableId: "tblX9X9X9X9X9X9X9",
tableSchema: orgChart,
}),
run: async (event, ctx) => {
const lastContactedField = orgChart.f("Last contacted");
const lastContactedValue = event.fields[lastContactedField]).current;
return {};
},
}).listen();