Panorays Public API
papi (2)
Getting Started
The following steps will walk you through the process of registering and reacting to webhooks.
If you don’t already have an API token, you can generate one through Panorays platform or contact Panorays Support at support@panorays.com.
Before you can start receiving events, register your application with Panorays using the Handshake API call.
You will only receive event calls for events you subscribe to using the Subscribe API call.
Note: You can unsubscribe at any time using the Unsubscribe API call.
You're done! From now on, you will receive notifications for every event you subscribed to.
To learn how to secure your app and ensure you handle events only from Panorays, read about Verifying requests.
On every request Panorays sends we provide X-Panorays-Signature header, this header contains a signature created from combining the event body, the request time and your secret using an HMAC SHA256 keyed hash. By recreating this code on your side and comparing the values you can verify that the event came from Panorays.
- Take your URL secret (The one you received when calling the handshake route)
secret = 'kqouK3lV+xOWzZ3SOvBv5lhbVhjolJJQs51hM8jG0xA60WqAz0wz/fMDqf/dd8rP' - Extract the request time from the
X-Pano-Request-Timeheader
timestamp = request.headers['X-Pano-Request-Time'] - Concatenate the request time with the request body using a colon
:as a delimiter - From the resulting string create an hmac using your secret and a sha256 algorithm and convert the result to a base64 string
signature = createHmac('sha256', secret)
.update(`${timestamp}:${JSON.stringify(request.body)}`)
.digest('base64'); - Compare your hmac string to the signature inside
X-Panorays-Signatureheader.
if (signature !== request.headers['X-Panorays-Signature']) {
// stop everything and hide.
} - If the values are equal, you now verified that the request came from Panorays.