İçeriğe geç

Webhooks

Receiving incoming messages and statuses on your server, and verifying the signature.

A webhook tells your own server the moment something happens in Broadycast. When someone writes to your channel, or a message you sent is delivered, read or fails, a signed POST request goes to the address you set. You can use it to save messages in your CRM, trigger something in your order system or keep your own reports.

Before you start

  • You need to be the organization owner or an admin.
  • API and webhooks must be included in your plan.
  • The workspace needs a connected channel. Webhooks belong to a channel: they only receive that channel’s events.
  • You need a public https address to receive the requests. For security, deliveries to internal network addresses are blocked.

Events

EventWhen it’s sent
Incoming messageWhen it’s sentWhen someone writes to this channel.
Message statusWhen it’s sentWhen a message you sent is delivered, read or fails.

Creating a webhook

  1. Open Settings › Webhooks. If you have more than one channel, choose the Channel at the top.
  2. Select New webhook.
  3. Enter a Name and Address. Add a Description if you like.
  4. Under Which events should be sent?, choose at least one event.
  5. Optionally use Only chats of this bot flow to limit events to one bot flow’s conversations. Leave it empty to receive events from every conversation.
  6. If needed, open Retries and headers (see below).
  7. Select Create webhook. The Signing secret is shown once; copy it into your server’s secrets.

Verifying the signature

Verify the signature to make sure a request really comes from Broadycast. Every request carries these headers:

  • X-Webhook-Signature: t=<time>,v1=<signature> — t is a Unix timestamp in seconds, v1 is the signature.
  • X-Webhook-Id — the ID of the webhook that sent the request.
  1. Split t and v1 out of the header.
  2. Take the raw request body (exactly as received) and prefix it with the t value and a dot: <time>.<body>.
  3. Compute the HMAC-SHA256 of that string with your secret and encode it as hex.
  4. Compare the result with v1. If they don’t match, reject the request.

Retries and custom headers

If your server returns an error or doesn’t respond, Broadycast retries the request. The wait doubles with each attempt and never goes past the longest wait you set.

FieldDefaultRange
Retry countDefault3Range0–10
First wait (ms)Default1,000Range100–60,000
Longest wait (ms)Default60,000Range1,000–300,000

If your server expects a header for authentication, add it under Custom headers with Add header. Header names can only contain letters, digits and dashes. Custom headers can’t override Broadycast’s own signature and ID headers.

Delivery history

Delivery history on the webhook’s page shows every event sent, your server’s HTTP response and any retries. The statuses are Delivered, Failed, Will retry and Queued. Open a row to see the Sent body and the Server response; if another attempt is scheduled, its time is shown too.

Filter by status and event, or use Search deliveries to find a message ID, response or error text. The sent body is the easiest way to see the exact shape of the data your server will receive.

Managing webhooks

  • Use the On switch in the list to turn a webhook off temporarily. No events are sent while it’s off.
  • On the webhook’s page, change its settings and select Save webhook.
  • Delete webhook: no more events are sent to the address, and its delivery history is hidden too.

Frequently asked

Open the row and check the HTTP response and Server response. Your server may be returning a non-2xx code, timing out or be unreachable. It’s best to accept the request quickly and do heavy work afterwards.
For security, deliveries to local or internal network addresses are blocked. Use a public https address. To test locally, open a temporary public address with a tunneling service.
Make sure the secret is correct and that you compute the signature from the raw body. If you recently regenerated the secret, update it on your server too.
No. A webhook only delivers events to you. To send messages, use an API key; see API keys.

Didn’t find what you need?

Write to us; we’ll look into it and update these guides if needed.

Send an email