Using webhooks with Selz

You can use webhooks to be notified about events that happen in your Selz account

To setup a webhook, head to ‘Developer’ in the ‘Settings’ within your Selz dashboard and then:

  1. From the first drop-down, select the ‘Event’ you want a webhook for from the dropdown
  2. Under ‘Callback URL’, enter the URL you want the payload sent to
  3. Click ‘Add webhook’ and your webhook should now appear in the list

You also have the ability to test your webhook, to make sure the information you want is being sent to the correct URL. To do this click the send test notification link. You’ll then need to check that your callback URL is receiving the payload. Here’s an example of a webhook payload for when an item is ordered:

         "company":"Doe & Co",
            "line1":"1 Infinite Loop",
            "line1":"1 Infinite Loop",

In order to test your webhooks you can also use for testing.

Securing Webhooks

Webhooks can be verified by calculating a digital signature.

Each Webhook request includes a HTTP_X_SELZ_SIGNATURE header along with the data sent in the request.
To verify that the request came from Selz, compute the HMAC digest according to the following algorithm and compare it to the value in the HTTP_X_SELZ_SIGNATURE header.
If they match, you can be sure that the Webhook was sent from Selz and the data has not been compromised.

PHP Example

$json = json_decode(file_get_contents('php://input'), TRUE);
$message = $json["timestamp"].$json["token"];
    header("HTTP/1.1 400 BAD REQUEST");
// Do something with webhook payload
$orderId = $json["data"]["id"];
header("HTTP/1.1 200 OK");
function CreateSignature($message) {
    $key = 'your_webhook_verification_key';
    $aMessage = iconv(iconv_get_encoding("internal_encoding"), "ASCII", $message);
    $aKey = iconv(iconv_get_encoding("internal_encoding"), "ASCII", $key);
    $sig = hash_hmac('sha256', $aMessage, $aKey, true);
    return base64_encode($sig);
function ValidateSignature($message){
    $signature = $_SERVER["HTTP_X_SELZ_SIGNATURE"];
    $signatureToCompare = CreateSignature($message);
    return ($signature == $signatureToCompare);

Node.js Example

var crypto = require('crypto');'/webhook', function (req, res) {
    // express 3.x: app.use(express.bodyParser());
    // express 4.x: app.use(bodyParser());
    var json = req.body;
    var signature = req.headers['x-selz-signature'];
    var message = json["timestamp"] + json["token"];
    if (validateSignature(message, signature)) {
    } else {
function createSignature(message) {
    var key = 'your_webhook_verification_key';
    return crypto.createHmac('sha256', key).update(message, 'ascii').digest('base64');
function validateSignature(message, signature) {
    var signatureToCompare = createSignature(message);
    return (signature == signatureToCompare);

Was this helpful?

8 2