Sources
Anything that can send an HTTP POST works as a source. For the providers
below we also know how to check their signature at ingest and how to name their events.
Setting a provider is optional. A source with "provider": "generic" accepts everything and uses
type_path to find the event type. Picking the right provider buys you three things: a signature check at
ingest (requests that fail it get a 401 and are not stored), sensible event types, and deduplication on
the provider’s own delivery id where it has one.
| Provider | provider | Signature checked | Event type from | Dedup key |
|---|---|---|---|---|
| Stripe | stripe | Stripe-Signature | body type | body id |
| GitHub | github | X-Hub-Signature-256 | X-GitHub-Event + action | X-GitHub-Delivery |
| Shopify | shopify | X-Shopify-Hmac-Sha256 | X-Shopify-Topic | X-Shopify-Webhook-Id |
| Mollie | mollie | none (see below) | id prefix | none |
| Twilio | twilio | X-Twilio-Signature | status parameters | none |
| Anything else | generic | optional HMAC | type_path | none |
Deduplication keeps the first copy for 24 hours. Duplicates still get a 202 at ingest, so the sender
stops retrying, but they don’t create new deliveries.
Stripe#
In the Stripe Dashboard, add a webhook endpoint under Developers → Webhooks and use your
ingest URL as the endpoint URL. Stripe then shows a signing secret. Put it in the source’s
verify_secret.
Yes, Stripe’s secret also starts with whsec_. They are different secrets: Stripe’s goes into
the source, ours comes out of the endpoint. If verification fails right after setup, swapping these two is the
first thing to check.
The event type is the type field (invoice.paid, customer.subscription.updated).
We check the Stripe-Signature timestamp with a 5-minute tolerance, the same as Stripe’s own
libraries. Stripe retries failed webhooks for up to three days in live mode, but since ingest answers in milliseconds
that hardly ever comes up.
Passed through: Stripe-Signature.
GitHub#
Under the repository or organisation Settings → Webhooks, set the payload URL to the ingest
URL and the content type to application/json. Form-encoded payloads (payload=…) also
work, but your handler then has to decode them. Use the same random string as GitHub’s
Secret and as verify_secret.
Types combine the X-GitHub-Event header with the payload’s action when there is
one: pull_request.opened, issues.closed, plain push. A filter of
pull_request.* therefore gets every pull request action but not pull_request_review.
GitHub does not retry
GitHub doesn’t automatically redeliver a webhook that failed. Before APISync this was the main reason people lost push events. With ingest in front it only matters if ingest itself is unreachable, which happened once in the last 90 days, for 11 minutes (see the incident).
Passed through: X-GitHub-Event, X-GitHub-Delivery, X-GitHub-Hook-ID,
X-Hub-Signature-256.
Shopify#
Webhook subscriptions are created through the Admin API or in your app’s configuration. Use the ingest URL as
the address. Shopify signs with your app’s client secret; put that in verify_secret. The signature
is base64, not hex, which we handle.
Shopify topics use slashes (orders/create). We turn the slash into a dot, so the event type is
orders.create and filters like orders.* work the same way as for everyone else.
Shopify removes subscriptions that keep failing. With ingest in front of your app, Shopify only ever sees
202s, so a long outage on your side no longer costs you the subscription. It can still cost you
events if the outage outlasts our retry schedule.
Passed through: X-Shopify-Topic, X-Shopify-Shop-Domain, X-Shopify-Webhook-Id,
X-Shopify-API-Version, X-Shopify-Hmac-Sha256.
Mollie#
Mollie works differently from the others: the webhook only contains the id of the object that changed,
form-encoded (id=tr_WDqYK6vllg), and no signature. Your handler is expected to fetch the payment from
the Mollie API to find out its status. Since there is nothing to verify, keep the ingest URL private; it is the only
secret here.
Mollie sets the webhook URL per payment (webhookUrl when you create it), so put the ingest URL there.
The event type comes from the id prefix: tr_ gives payment.updated, sub_
gives subscription.updated, ord_ gives order.updated, anything else
mollie.unknown.
The envelope format is useful with Mollie, because the raw body is just that one form field.
Twilio#
Added in 2.6.0. Twilio signs each request with HMAC-SHA1 over the full URL plus the sorted
POST parameters, keyed with your account’s auth token, which goes into
verify_secret. Because the URL is part of the signature, use the ingest URL exactly as shown, without
extra query parameters. If you do add parameters in the Twilio console, add the same ones to the source’s
ingest_url_params so we check against the URL Twilio actually called.
The event type is message.<MessageStatus> for messaging callbacks
(message.delivered, message.undelivered) and call.<CallStatus> for voice
status callbacks. Anything else is twilio.request.
Generic sources#
For in-house systems and providers not listed above. The event type is read from the JSON body with
type_path, a JSON Pointer that defaults to /type. If the body isn’t JSON or the
pointer finds nothing, the type is unknown.
If the sender signs its requests with a plain HMAC-SHA256 over the body, we can check that too. Set
verify_secret, the header name in verify_header, and verify_encoding
(hex or base64). A sha256= prefix on the header value is ignored. Schemes that
sign anything other than the body alone are not supported as generic sources yet; ask us, it’s usually a small
change and how most of the providers above were added.
$ curl https://apisynccloud.info/api/v1/sources \
-H "Authorization: Bearer $APISYNC_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Warehouse scanner",
"provider": "generic",
"type_path": "/event/name",
"verify_secret": "the-shared-secret",
"verify_header": "X-Signature",
"verify_encoding": "hex"
}'