Skip to content

Airtable webhook support - #9

Closed
matt-aitken wants to merge 7 commits into
devfrom
integrations/airtable-webhooks
Closed

Airtable webhook support#9
matt-aitken wants to merge 7 commits into
devfrom
integrations/airtable-webhooks

Conversation

@matt-aitken

@matt-aitken matt-aitken commented Jan 23, 2023

Copy link
Copy Markdown
Member

Todo

  • Remove key column from TriggerEvent
  • Add lastDelivery and version columns 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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants