DocsDeveloper guideAPI and webhooks
Webhooks
The system receives provider notifications (payments, messages, shipping). It does not send webhooks to other systems at this commit.
1 min read
The shared inbox
Every integration gets one address: /integrations/hook/{token}. GET, POST and PUT are accepted, the token is 40 letters and digits, up to 600 calls a minute, and it is public with no CSRF (routes/web.php:148-153). Each call goes through WebhookInbox::receive (app/Support/Integrations/WebhookInbox.php:14-97):
- The token finds the integration and its company; an unknown token gets 404.
- A handshake (for example a challenge from a messaging provider) is answered by the driver's
acknowledge(). - The driver checks the signature with
verifyWebhook(). A bad one gets 401 and nothing is stored. - An inactive integration answers 200 and stores nothing, so the provider stops retrying.
- The event is stored once, keyed by its event id; a repeat answers 200 "already received".
- It is handled at once or right after the answer. A failure is retried after 1, 5, 30, 120 and 720 minutes, then marked failed (
app/Support/Integrations/WebhookInbox.php:29-30).
Other inbound addresses
| Address | What sends it | Source |
|---|---|---|
GET/POST /pos/terminal/hook/{provider}/{token?} | Card terminal results | routes/web.php:145 |
POST /mail/inbound | The inbound mail gateway, token-authenticated | routes/api.php:27-28 |
Receiving webhooks in your add-on
Write an integration driver (see Payment, shipping and SMS drivers). Return true from receivesWebhooks(), check the provider's signature in verifyWebhook(), return ['id' => ..., 'topic' => ...] from webhookEvent(), and do the work in handleWebhook() (app/Support/Integrations/IntegrationDriver.php:121-171).