Introduction
Everything you need to know on how to monitor events when specific actions take place in your integration.
Why use webhook
When building Simpu integrations, you might want your applications to receive events as they occur, so that your backend systems can execute actions accordingly.
To enable webhook events, you need to register webhook endpoints. After registering them, Simpu can push real-time event data to your application’s webhook endpoint when specific events occur. Simpu uses HTTPS to send webhook events to your app as a JSON payload, which includes detailed information about the event. Receiving webhook events is particularly useful for tracking actions.
Event Overview
Simpu generates event data that can be sent to you to inform you of activities in your account.
When an event occurs, Simpu creates a new Event object. A single action might trigger multiple events.
By registering webhook endpoints in your Simpu account, you allow Simpu to automatically send Event objects via POST requests to your application’s registered webhook endpoint. Once your webhook endpoint receives the Event, your app can execute backend actions.
Webhooks allows you to listen to real-time events happening across your Simpu workspace. With webhooks, you can build custom integrations with simpu.
Verifying Events
It’s crucial to verify signatures of incoming webhook events to ensure they are genuine and haven’t been tampered with. This verification process helps protect your application from processing fraudulent events.
For security purposes, each webhook event comes with a signature in the x-simpu-webhook-signature
header. This signature is created using the following process:
The event payload is signed using HMAC-SHA512
algorithm
The result is encoded in Base64
format
This encoded signature is sent in the header
To verify an event:
Take the raw event payload (as a string)
Take the signature from the x-simpu-webhook-signature header
Use your secret key to compute a new signature
Compare the computed signature with the received signature
Here’s a quick example of the verification flow:
Only process webhook events after successful signature verification. This ensures that your application only responds to genuine events from the authorized source.
Responding to an event
To handle Simpu webhooks, your application should respond with a 200 OK
status to acknowledge the receipt of the event. If the response is anything other than 200
, 201
, or 202
, the event will be considered unacknowledged, and Simpu will retry sending it every hour for up to 24 hours. Only the status code is required—any other parameters or request bodies will be ignored.
If your application needs to execute long-running tasks after receiving an event, it should still respond with a 200 OK
immediately, before proceeding with the task, to avoid duplicate events being triggered.
Types of events
Here are the events we currently support. More will be added to this list as we integrate additional actions in the future.
Event | Description |
---|---|
airtime.success | Airtime transaction was successfully completed |
airtime.failed | Airtime transaction attempted failed |
airtime.duplicate | If you attempt to send the same airtime amount to the same recipient at the same interval |
airtime.error | Unknown error |
text.delivered | The SMS message was successfully delivered |
text.undelivered | The SMS message failed to deliver |
text.clicked | The link in the SMS was clicked |
email.delivered | The email was successfully delivered to the recipient |
email.bounced | The email failed to deliver |
email.opened | The recipient opened the email |
email.clicked | The recipient clicked a link in the email |