# Webhook events

> What Nibify posts to your webhook endpoints: message.delivered, message.read, message.answered, message.expired, message.dismissed, message.cancelled.

Each event reaches the webhook endpoints of your project as a signed `POST` with a JSON body. Answering `2XX` means: received. Any other answer is retried. How to check the signature, and what happens when your server does not answer: [Webhooks and signatures](https://nibify.app/docs/webhooks-and-signatures).

## Headers

| Field | Type | Description |
| --- | --- | --- |
| `nibify-signature` | string, required | `t=<unix seconds>,v1=<hex>`: HMAC-SHA256 of `<t>.<raw body>`, keyed with the Project’s signing secret. |
| `nibify-event-id` | string, required | The event’s `id`, the same on every retry of it. |

## `message.delivered`

A Device of the recipient confirmed the push arrived.

**Payload**

| Field | Type | Description |
| --- | --- | --- |
| `id` | string, required | The event’s id, the same on every retry of it: deduplicate on it. |
| `type` | string, required | Which of the six events this is. Always `message.delivered`. |
| `createdAt` | string, required | When the event happened. An RFC 3339 timestamp. |
| `data` | object, required | The Message, and its two receipts. |
| `data.messageId` | string, required | The Message this event is about. For a Request, the same as its `requestId`. |
| `data.environment` | string, required | The Environment the Message was sent into. One of `test`, `live`. |
| `data.status` | string or null, required | The Request’s status as it stands, or null for a Notification, which has none. One of `pending`, `answered`, `expired`, `dismissed`, `cancelled`. |
| `data.deliveredAt` | string, required | When a phone of the recipient first confirmed the push arrived. An RFC 3339 timestamp. |
| `data.readAt` | null, required | Not read yet: `message.read` says when it is. |

## `message.read`

The recipient opened the Message.

**Payload**

| Field | Type | Description |
| --- | --- | --- |
| `id` | string, required | The event’s id, the same on every retry of it: deduplicate on it. |
| `type` | string, required | Which of the six events this is. Always `message.read`. |
| `createdAt` | string, required | When the event happened. An RFC 3339 timestamp. |
| `data` | object, required | The Message, and its two receipts. |
| `data.messageId` | string, required | The Message this event is about. For a Request, the same as its `requestId`. |
| `data.environment` | string, required | The Environment the Message was sent into. One of `test`, `live`. |
| `data.status` | string or null, required | The Request’s status as it stands, or null for a Notification, which has none. One of `pending`, `answered`, `expired`, `dismissed`, `cancelled`. |
| `data.deliveredAt` | string, required | When a phone of the recipient first confirmed the push arrived. An RFC 3339 timestamp. |
| `data.readAt` | string, required | When the person first opened the Message. An RFC 3339 timestamp. |

## `message.answered`

The person answered a Request.

**Payload**

| Field | Type | Description |
| --- | --- | --- |
| `id` | string, required | The event’s id, the same on every retry of it: deduplicate on it. |
| `type` | string, required | Which of the six events this is. Always `message.answered`. |
| `createdAt` | string, required | When the event happened. An RFC 3339 timestamp. |
| `data` | object, required | The Request, as it ended. |
| `data.requestId` | string, required | The Request this event is about. |
| `data.status` | string, required | The terminal state the Request reached. Always `answered`. |
| `data.environment` | string, required | The Environment the Message was sent into. One of `test`, `live`. |
| `data.response` | object, required | The person’s answer. |
| `data.response.responseId` | string, required | The Response’s id. |
| `data.response.actionName` | string, required | The action the person chose. |
| `data.response.sourceComponentId` | string, required | The `id` of the component the person answered with, or `notification` for a quick action on the push. |
| `data.response.context` | object or null, required | The values the action sent back, or null when it sent none. |
| `data.response.clientTimestamp` | string, required | When the person answered, by the phone’s clock. An RFC 3339 timestamp. |
| `data.response.answeredAt` | string, required | When the answer reached Nibify. An RFC 3339 timestamp. |

## `message.expired`

A Request reached its expiry unanswered.

**Payload**

| Field | Type | Description |
| --- | --- | --- |
| `id` | string, required | The event’s id, the same on every retry of it: deduplicate on it. |
| `type` | string, required | Which of the six events this is. Always `message.expired`. |
| `createdAt` | string, required | When the event happened. An RFC 3339 timestamp. |
| `data` | object, required | The Request, as it ended. |
| `data.requestId` | string, required | The Request this event is about. |
| `data.status` | string, required | The terminal state the Request reached. Always `expired`. |
| `data.environment` | string, required | The Environment the Message was sent into. One of `test`, `live`. |
| `data.response` | null, required | Only an answered Request has a Response. |

## `message.dismissed`

The person declined a Request.

**Payload**

| Field | Type | Description |
| --- | --- | --- |
| `id` | string, required | The event’s id, the same on every retry of it: deduplicate on it. |
| `type` | string, required | Which of the six events this is. Always `message.dismissed`. |
| `createdAt` | string, required | When the event happened. An RFC 3339 timestamp. |
| `data` | object, required | The Request, as it ended. |
| `data.requestId` | string, required | The Request this event is about. |
| `data.status` | string, required | The terminal state the Request reached. Always `dismissed`. |
| `data.environment` | string, required | The Environment the Message was sent into. One of `test`, `live`. |
| `data.response` | null, required | Only an answered Request has a Response. |

## `message.cancelled`

The agent cancelled a Request.

**Payload**

| Field | Type | Description |
| --- | --- | --- |
| `id` | string, required | The event’s id, the same on every retry of it: deduplicate on it. |
| `type` | string, required | Which of the six events this is. Always `message.cancelled`. |
| `createdAt` | string, required | When the event happened. An RFC 3339 timestamp. |
| `data` | object, required | The Request, as it ended. |
| `data.requestId` | string, required | The Request this event is about. |
| `data.status` | string, required | The terminal state the Request reached. Always `cancelled`. |
| `data.environment` | string, required | The Environment the Message was sent into. One of `test`, `live`. |
| `data.response` | null, required | Only an answered Request has a Response. |
