---
title: Webhooks
project: BPM
version: 1.0
section: guides
language: en
license: Total.js Enterprise
url: https://totaljs.es/docs/bpm/1-0/guides/webhooks/
updated: 2026-11-20T18:44:32.311Z
---

# Webhooks

> Send the events of the tasks of a process to another system, signed with a secret.

A webhook lets another system follow the tasks of a process. Each time a task is created, assigned, goes to another step or is closed, BPM sends a short message to an address of that system, for example to update an ERP or to post in a chat.

You need the permission **Processes** (`processes`), or to be the administrator.

## Add a webhook

**1.** Open **Processes** and select the gear icon of the process, then **Webhooks**. In the [designer](../designer/), select **Webhooks** in the toolbar.

**2.** Select **Add webhook**.

**3.** In **Address**, enter the address that receives the messages, for example `https://erp.example.com/bpm/events`.

**4.** Under **Events**, keep the events that you want:
- **Task created**: a new task of the process.
- **Task assigned**: somebody took the task, or it was given or escalated to a person.
- **Step changed**: the task left a step, for example after **APPROVE**, and waits at the next one.
- **Task closed**: the task is closed, also when it is cancelled.

**5.** Keep **On** selected.

**6.** Select **SAVE**.

**7.** Select **Copy secret** and keep the secret in the system that receives the messages. BPM shows it only once.

![The Webhook window with the address and the four events](/files/Jaulyy2kt61f.webp)

The address must start with `https://` and point to a server on the internet: BPM refuses IP addresses and names of the local network, such as `localhost`. It checks this when you save the webhook and again before every message.

## The Webhooks window

![The webhooks of a process with the last deliveries](/files/Jaulz12lt60f.webp)

Each webhook shows its address, whether it is **on** or **off**, and its events:

| Link | What it does |
|---|---|
| **Test** | Sends the event `ping` at once and tells you whether it arrived. |
| **Edit** | Changes the address, the events, or turns the webhook on or off. |
| **New secret** | Makes a new secret and shows it once. The old secret stops working at once. |
| **Remove** | Removes the webhook and its deliveries. |

**Last deliveries** lists the last 50 messages of the process: when, the event, the task, the result and the number of attempts. Select **Refresh** to read it again.

## What BPM sends

A `POST` with JSON, a few seconds after the event:

```json
{
  "event": "task.step",
  "date": "2026-11-20T09:14:02.120Z",
  "process": { "id": "JauXKx1ch61f", "name": "Purchase request", "version": 5 },
  "task": {
    "id": "JaubJC1cN61f",
    "name": "Purchase: Desk lamp",
    "subject": "80 EUR",
    "reference": null,
    "number": null,
    "step": "Finance check",
    "result": null,
    "isclosed": false,
    "assigned": null,
    "url": "https://bpm.example.com/admin/inbox/?task=JaubJC1cN61f",
    "values": { "item": "Desk lamp", "amount": 80, "comment": "Fine" }
  },
  "by": "Paul Green",
  "from": "Team lead approval / Approve"
}
```

- `event` is `task.created`, `task.assigned`, `task.step`, `task.closed`, or `ping` for **Test**.
- `task.step` is where the task waits when BPM sends the message, `task.values` are the values of its forms, and `task.url` opens it in the Inbox. The link needs the address of BPM in [Settings](../settings/).
- `by` is the person who did it. `from` (only in `task.step`) is the step and the button that the task left. `assigned` (only in `task.assigned`) has the `name` of the person and the `type`: `claim`, `assign` or `escalate`.
- A step that closes the task sends only `task.closed`.

The headers:

| Header | Value |
|---|---|
| `x-bpm-event` | The event, for example `task.closed`. |
| `x-bpm-timestamp` | The time of sending in seconds since 1970. |
| `x-bpm-signature` | `sha256=` and the HMAC-SHA256 of the timestamp, a dot and the body, made with the secret, in hex. |
| `x-bpm-delivery` | The id of the message. A message sent again has the same id. |

## Check the signature

Check every message before you trust it: compute the signature with your secret from the raw body and compare it. Refuse old timestamps, for example older than 5 minutes. An example in Node.js:

```javascript
const crypto = require('crypto');

// body: the raw body of the request as a string, secret: the secret of the webhook
function verify(headers, body, secret) {
	const timestamp = headers['x-bpm-timestamp'];
	const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(timestamp + '.' + body).digest('hex');
	const signature = headers['x-bpm-signature'] || '';
	const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
	return fresh && signature.length === expected.length && crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}
```

## Answers, attempts and the log

- Answer with a status `2xx` when you have the message. Anything else is a failure: another status, no answer within 10 seconds, or a redirect, which BPM does not follow.
- A failed message is sent again after 1, 5 and 30 minutes. After the fourth attempt BPM gives it up and the log shows **Failed** with the reason.
- Messages can arrive more than once and, after a failure, out of order. Use `x-bpm-delivery` to skip a message that you already have, and `date` for the order.
- Turning a webhook **off** stops its new messages. Events that happened while it was off are not sent later.
- The log keeps the messages for 30 days.
