Notification Signature
When a subscription is registered, the Encompass services platform notifies the client application about the event with a specific base64 encoded signature in the response header.
Notifications are signed by the Encompass platform, so that the subscriber (or a client application) can verify the identity of the sender and integrity of the message upon receiving the notification. Clients are expected to process notifications with only a valid Elli-Signature in their headers. The environment indicator and message signature are available in the Elli-Environment and Elli-Signature headers, respectively.
In addition, the Elli-SubscriptionId header contains a unique subscription ID that is assigned when the subscription is created. To validate the notification, the subscription ID maps to the subscription's signing key. The signing key serves as a password that either you can assign or can be automatically assigned by the Encompass platform. To learn more about the signing key, see Subscriptions.
Forgot the Signing Key?
If you have forgotten or lost the signing key for a subscription, you can use the Get a Subscription API to retrieve it. Also, note that the signing key was previously known as the "Webhook secret".
The following sample code provides an example of how to generate the Elli-Signature header using a signingkey. The Elli-Signature you received from us in the notification header and the one you generate using the sample code should match.
var encoding = new System.Text.UTF8Encoding();
byte[] keyByte = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
return Convert.ToBase64String(hashmessage);
}
Header | Description | Sample Value |
---|---|---|
Elli-Environment | Identifies the origin (environment) of the event. The value is always prod. | prod |
Elli-Signature | The base64 encoded, SHA256 hash of the event (request body). | PptoFw7xh/q768Bv0hWeBqZejiclq9W5XH5ApFfo5Yg= |
Elli-SubscriptionId | The unique ID assigned to the subscription when it is created. The value can be used to map the signing key required to validate the message. | c669a561-e9ec-4b2d-9831-7802494d52d2 |