To enable and setup webhooks, it's as simple as creating a new spreadsheet (or table in Airtable) called "webhooks":
And here is what the spreadsheet looks like:
A description of the fields:
The JSONata expression for the response field should evaluate to an object that looks like this:
"statusCode": 200, // can be any status code, just must be a number
... // any set of HTTP headers can be put here
"body": "" // can be string or JSON
After a synchronization occurs, you can retrieve the URL(s) for your new webhook(s) by issuing a GET request to the following endpoint with your admin user:
From there, you can send data to a webhook by using a POST request. Note that webhooks do not require any authorization to call. Anyone or any service that has the URL can push data into your datasets. The webhook id below will be whatever the internal SheetDream _id value is:
When you POST to that endpoint, SheetDream will recognize you're interacting with the special webhooks table. It will take the incoming data in the POST body, and will run your JSONata expression against it. It will then attempt to import the result into your specified target spreadsheet.
The expression field should evaluate to something that looks like this:
"Column 1": ..,
"Column 2": ..,
In other words: a flat JSON object with no nesting. Simple key/value pairs only. If you do not adhere to this format, SheetDream will simply throw out the result and will not import anything into the target table.
The response field has no restrictions on what it needs to evaluate to. It should evaluate to some sort of JSON result that the calling service expects the webhook to return.
If you want to test your JSONata expression, head on over to https://try.jsonata.org. You'll find a window very similar to the JSONata editor modals in the API Tasks section. You can paste in some example webhook data your third party API will be POSTing to SheetDream, and then work out the JSONata to get a result object that can be successfully imported into your spreadsheet.