Introduction
Listen to events on Periskope and build your custom integrations
While building your own WhatsApp integrations with Periskope, you might want to listen to events in real time. You can do this with Periskope’s Webhooks. Simply register a Webhook endpoint with Periskope and start receiving different events occuring inside the Periskope platform.
You can also receive events with our Typescript SDK
Prerequisites
- A
Periskope account
: To use the Periskope API, you need to have a Periskope account. If you don’t have one, you can sign up for a free trial here. - An
HTTP POST /
Endpoint: Prepare your server to start receiving POST requests. Your server should have an endpoint ready to catch data sent by Periskope when events are sent.
In order to start receiving webhooks, you need to have a server that can handle incoming HTTP POST requests. The POST request endpoint needs to be open and publicly accessible without any authentication.
Setting up webhooks on Periskope 🔧
You can access the webhook configuration through your Periskope settings or click here to visit. Here, you can manage and set up new webhooks.
Add webhook 🔌
Click on the Add Webhook
button. This opens a modal where you can enter
the URL that will receive the webhook POST requests.
Add webhook
Choose events 🏁
Choose the events you want to subscribe to from the list below. Each event corresponds to different actions or changes in Periskope and whatsapp that you can receive notifications for.
Create a Signing Key 🔑
Generate a Signing Key
Signing Keys are used to verify that the webhook events that you receive on your destination come from a trusted source.
You can generate a Signing Key on the Webhook Screen by clicking on the Generate
button. After copying your Signing Key, do not
share it to keep it protected. Learn more about how to verify your Signing Key on your server here.
Done ✅
After configuring the URL and selecting the desired events, save your settings to activate the webhook.
Result 🚀
Webhooks are now setted up on your Periskope account. Your endpoint will now receive HTTP POST requests whenever the subscribed events occur on the Periskope platform.
You can test your webhook by triggering any selected event from the Periskope platform.
Event structure 📦
You’ll be receiving the data in the following format:
Verifying your Signing Key
A signing key is used to verify that the events received in your webhook endpoints are from a trusted source. Periskope generates an
encrypted HMAC key for every request and sends the key in the x-periskope-signature
header. On your webhook endpoint, you can check
this signature by decrypting the secret key and verifying the legitimacy of a request.
You can generate your Singing Key from Settings > Webhooks
screen.
Your Signing Key
Follow the code snippet below to verify your signing key on your server: