Webhook
Start a flow when an outside service calls its address.
trigger.webhook runs when something outside Discord sends a request to the flow's address: a form, a payment provider, a build finishing, a home automation. Make one under Webhooks.
Settings
The flow's settings show its Address and Key to give to whatever will call it.
| Setting | What it does |
|---|---|
| Address | https://api.buildcord.dev/v1/hooks/ followed by the bot's and the flow's ids. Send a POST to it. |
| Key | Send it as an X-Buildcord-Key header, or as ?key= on the address. Anyone with it can run the flow, so Make a new key if it gets out, then deploy. |
curl -X POST https://api.buildcord.dev/v1/hooks/BOT/FLOW \
-H "X-Buildcord-Key: KEY" \
-d '{"order": {"id": 1042, "total": 30}}'Ways out
out.
Produces
| Token | Value |
|---|---|
{webhook.body} | What was sent. JSON is reached into with dots: {webhook.body.order.id}. |
{webhook.text} | What was sent, exactly as it came |
{webhook.query.name} | Each part of the address's query, except the key |
{webhook.method} | POST |
Notes
- A call is answered
202 Acceptedas soon as it's taken, before the flow runs; the flow starts within a few seconds. It can't send anything back to the caller. - A flow started by a webhook has no channel and nobody to reply to: post with Send to a channel.
- At most 64 KB per call, and 50 calls waiting to be picked up at once.
- A key changed in the builder takes over from the old one when you deploy.
Example
A shop's payment provider calls the webhook for each order, and the flow posts New order #{webhook.body.order.id} in a sales channel and adds a row.
Related
- Send an API request, for the other direction
- Deploying