Webhooks
Spaaza provides webhooks and event notifications which can post a standard JSON object to an external API endpoint. Webhooks are triggered by events in Spaaza and are commonly used to trigger another event in an external system - for example triggering an email to be sent when a customer receives a voucher.
Webhook format
A webhook or event notification is a POST that Spaaza sends to a specific URL The body of the POST is JSON that includes the object.
As with API endpoints, Spaaza may add fields containing new information to the JSON body of webhooks and event notifications. Spaaza will not remove any fields or change the field type of existing fields in webhooks without prior notification.
Configuring webhooks
Some, but not all, webhooks can be configured as “triggers” in Console. Whenever the relevant event occurs we send a simple POST request to the URL. The body of the POST is JSON that includes the object.
We currently support triggers to the following services:
- Standard webhook (a webhook of standard format sent as a POST to a URL of your choosing)
- Klaviyo
- Mailchimp (Mandrill)
- Shopify
Other webhooks and notifications can be configured manually by our team so please get in touch if you would like us to set one up for you.
Verifying webhooks are from Spaaza
So that you can verify that the POST originates from Spaaza we provide a signature in a request header (X-Spaaza-Hmac-SHA256).
The value of the header is a base 64 encoded HMAC-SHA256 hash of the whole body of the request with a shared secret that we will provide. Your code to handle the event would need to recreate the signature using the shared secret and compare it to the value in the header.