# Events WhaBuzz raises

> message.outbound, batch.completed, number.connection and token events. Origin WhaBuzz, raw is null.

Canonical: https://docs.whabuzz.com/events/whabuzz-events/

These events come from WhaBuzz, not Meta. They use the same [envelope](https://docs.whabuzz.com/events.md#envelope) with `raw: null` and `raw_path: null`.

## message.outbound {#message-outbound}

Emitted for **every** send you make, single or batch, accepted by Meta or refused. It records exactly what WhaBuzz sent and what Meta answered, so your log is complete even if your own process died between sending and storing the result. Its `X-WhaBuzz-Event-Id` was also returned on the send response.

`data`:

| Field | Meaning |
|---|---|
| `request` | The body WhaBuzz sent to Meta |
| `response` | Meta's response body, verbatim |
| `http_status` | Meta's HTTP status |
| `batch_id` | `bat_…` for batch items, else null |
| `client_ref` | The batch `client_ref`, else null |

`dedupe_key` is `out:{event_id}`.

## batch.completed {#batch-completed}

A batch finished or was cancelled. Routed by the batch's number. The authoritative counts are on the batch resource: fetch [`GET /v1/messages/batch/{batch_id}`](https://docs.whabuzz.com/api/messages.md#getBatch), and the failures with failures with [`GET /v1/messages/batch/{batch_id}/items?status=failed`](https://docs.whabuzz.com/api/messages.md#listBatchItems).

## number.connection {#number-connection}

A number's `connection_state` changed between `pending`, `connected` and `disconnected`. Read the current state and `connection_detail` (`waba_not_subscribed`, `not_registered`, `no_verified_endpoint`, `token_invalid`, `tenant_inactive`) with [`GET /v1/numbers/{phone_number_id}`](https://docs.whabuzz.com/api/numbers.md#getNumber). Conditions are listed under [connection state](https://docs.whabuzz.com/guides/numbers.md#connection-state).

A number that loses its last verified endpoint, or whose token is revoked, stops sending with `409 number_not_connected`. Subscribe an endpoint to this event so you find out before your customers do.

## token.expiring and token.invalid {#token}

Once a day WhaBuzz checks each connected account's business token with Meta. `token.expiring` fires once per state change when the token is within 7 days of expiry; `token.invalid` fires once per state change when Meta no longer accepts it. Reconnect the number (see [Numbers](https://docs.whabuzz.com/guides/numbers.md#connect-existing)) before or after to restore sending. Each change of state also recomputes the number's connection state, so `token.invalid` is followed by a `number.connection` event with `token_invalid`.
