Webhooks

A webhook endpoint is a URL on your server that GioSMS calls when something happens: a Message is delivered, a reply arrives, your balance runs low. Webhook events lists every event and its fields.

Add an endpoint

Under Developers, open the Webhooks tab and add an endpoint:

  • its URL, which must be https. GioSMS does not call private or local addresses, and does not follow redirects;
  • the events it should receive;
  • an optional description, such as "Order system".

GioSMS shows the endpoint's signing secret, starting whsec_, once. Store it with your server's secrets: you need it to check that calls come from GioSMS.

You can change an endpoint's URL, events and description, turn it off and on, or delete it.

What GioSMS sends

GioSMS sends a POST with a JSON list of up to 100 events, so a busy Account gets one call for many Messages rather than one each:

POST /giosms/webhooks HTTP/1.1
content-type: application/json
user-agent: GioSMS-Webhooks/1.0
webhook-id: 0193a6f3-0b4c-7a1d-9e2f-4a6b8c0d2e4f
webhook-timestamp: 1795858200
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=

[{"id":"0193a6f3-0a1b-7c2d-8e3f-5a6b7c8d9e0f","type":"message.delivered","created_at":"2026-11-28T09:30:00.000+00:00","data":{"message_id":"…","batch_id":"…","recipient":"+8801712345678","status":"delivered","error_code":null,"reported_at":"2026-11-28T09:30:00+00:00"}}]

Answer with any 2xx status within 10 seconds. Do the work afterwards, for example on a queue, so a slow job does not make the call time out.

Check the signature

Check every call before you trust it. The signature follows Standard Webhooks:

  1. Take the webhook-id, the webhook-timestamp and the raw body exactly as received, before any JSON parsing.
  2. Join them with dots: {webhook-id}.{webhook-timestamp}.{body}.
  3. Compute the HMAC-SHA256 of that, keyed with your secret's bytes: base64-decode the part after whsec_.
  4. Base64-encode the result and prefix v1,. It must equal one of the space-separated signatures in webhook-signature.
  5. Refuse a timestamp more than 5 minutes from your clock, so a recorded call cannot be replayed later.

In PHP:

function isFromGioSms(string $secret, string $id, string $timestamp, string $body, string $header): bool
{
    if (abs(time() - (int) $timestamp) > 300) {
        return false;
    }

    $key = base64_decode(substr($secret, strlen('whsec_')));
    $expected = 'v1,'.base64_encode(hash_hmac('sha256', "{$id}.{$timestamp}.{$body}", $key, true));

    foreach (explode(' ', $header) as $signature) {
        if (hash_equals($expected, $signature)) {
            return true;
        }
    }

    return false;
}

In Node.js:

import { createHmac, timingSafeEqual } from 'node:crypto';

function isFromGioSms(secret, id, timestamp, body, header) {
    if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) {
        return false;
    }

    const key = Buffer.from(secret.slice('whsec_'.length), 'base64');
    const expected = Buffer.from(
        'v1,' + createHmac('sha256', key).update(`${id}.${timestamp}.${body}`).digest('base64'),
    );

    return header.split(' ').some((signature) => {
        const given = Buffer.from(signature);

        return given.length === expected.length && timingSafeEqual(given, expected);
    });
}

Retries

When your endpoint does not answer 2xx in time, GioSMS tries the same call again after 1 minute, 5 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, and then every 8 hours, until 24 hours have passed since the first try.

A retry carries the same events with the same ids. Your endpoint may also receive an event twice, so skip any event whose id you have already handled.

Endpoints that keep failing

When an endpoint fails at least 10 times in a row over at least 24 hours without one success, GioSMS turns it off and tells your Account. Fix it, then turn it on again under Webhooks: its failures start again from zero.

Delivery log

Each endpoint lists its recent deliveries: the events each carried, how many times GioSMS tried, the status your server last answered, and when it will try next. Resend sends a delivery's events again as a new call, with a new webhook-id and the same event ids. The endpoint must be on.