Per-channel webhook URLs▾

Per-channel webhook URLs

Route one channel's events to its own endpoint instead of the account-wide one.

By default every channel's events go to your account webhook endpoints. When two numbers belong to two systems, give each channel its own endpoint instead — the payload is identical, only the destination differs.

cURL
curl -X POST https://api.sendport.tech/v1/webhooks \
  -H "Authorization: Bearer $SENDPORT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://storefront.example.com/hooks/sendport",
    "events": ["message.received", "message.delivered", "message.failed"],
    "channel": "pn_01JZQ2E5R7T9V1X3Z5B7D9FHKM"
  }'

Which endpoint receives an event

Endpoints registeredDelivered to
Account endpoints onlyEvery account endpoint subscribed to that event
A channel endpoint exists for the channelThat endpoint only — account endpoints are skipped for this channel
Several endpoints on the same channelAll of them, each retried independently

A channel endpoint overrides, it does not add

Registering an endpoint against a channel stops that channel's events reaching your account endpoints. If you want both, register the account endpoint against the channel too.

Verification

Every endpoint answers a one-off GET ?challenge=… before events start flowing, and every delivery is signed. Both work exactly as documented in verifying signatures — a per-channel endpoint gets its own signing_secret, returned once at creation.

Node
app.get("/hooks/sendport", (req, res) =>
  res.type("text/plain").send(String(req.query.challenge ?? "")),
);

Testing locally

Webhooks cannot reach localhost. Tunnel one channel's events to your machine with the CLI — see sendport webhooks listen.

Shell
sendport webhooks listen \
  --channel pn_01JZQ2E5R7T9V1X3Z5B7D9FHKM \
  --forward http://localhost:3000/hooks/sendport