Skip to content

Webhooks

A webhook sends data to your server when something happens, so your software does not have to ask. SmVend sends two kinds: Sales (every sale) and Events (the machines’ events). Webhooks are set up on the Webhooks tab of Settings → Integrations.

The tab is for the Administrator, on the Pro plan or a trial: see who can use it.

The Webhooks tab: the public key and the list of webhooks

SmVend signs every webhook, so your server can check that the request really comes from us.

  1. Click Issue key pair.
  2. Save both keys. The private key is shown only once.

After that the card shows the start of the Public key with a copy icon.

  1. Click Create.
  2. In Endpoint enter the address of your server that takes the requests.
  3. In Trigger choose what to send: Sales or Events.
  4. Leave Active on.
  5. Click Create.
The Creating webhook form

In the list, a green tick in Status marks an active webhook. The pencil opens it: change the address or the trigger, or untick Active to pause it. The bin deletes it.

SmVend sends each webhook as an HTTP POST request with a JSON body to your Endpoint.

  • Your server answers with the status 200: the webhook is delivered.
  • Any other answer, or none: SmVend sends it again after 1 minute, 5 minutes, 10 minutes, 30 minutes, 2 hours and 5 hours.
  • After 6 failed tries SmVend stops sending.

A webhook marked Locked in the list is one SmVend does not send to: open it and click Unlock once your server works again.

There are two ways. Your developer picks one:

  • With the key pair of this tab: the request carries the x-signature header, which your server checks with the Public key.
  • With the webhook signing secret of an API key (Also create a webhook signing secret when you create the key): the request carries the X-SmVend-Signature header, an HMAC-SHA256 of the request body made with the secret.

The format of the requests, the fields of a sale and an event, and code that checks both signatures are in the developer documentation: api.smvend.io, the Webhooks section.

In the Settings tab, Integrations, Webhooks: the key pair and the webhooks, a new webhook, changing and deleting one.

See also: API, MCP, API, Webhooks and MCP.