# Send test event

`opensend.webhooks.test(id)`

Posts one signed sample event to an endpoint and answers with what the endpoint said.

Needs the scope: `webhooks:write`

## Input

`id` goes first, on its own, and the rest in one object. One object that holds `id` works too.

- `id` (string, required): The id of the item. Up to 64 characters.

## Returns

The call resolves to the answer, already parsed. A call the API refuses throws `OpenSendError` with the code and the message of the answer. [SDK](https://opensend.sh/docs/sdk) lists the errors of the client itself.

- `object` ("webhook_delivery"): Always `webhook_delivery`.
- `id` (string): The id of the delivery.
- `webhookId` (string): The id of the webhook it was for.
- `type` (string): The event that was posted. One of: `email.sent`, `email.delivered`, `email.delayed`, `email.bounced`, `email.opened`, `email.clicked`, `email.complained`, `email.failed`, `email.received`, `email.scheduled`, `email.canceled`, `automation.entered`, `automation.finished`, `automation.step`.
- `state` (string): `pending` while it is still being tried, `delivered` once your address answered 2xx, `failed` after the last try. One of: `pending`, `delivered`, `failed`.
- `status` (integer): The HTTP status of the last answer, or 0 when there was none.
- `attempts` (integer): How many times it has been tried.
- `error` (string): What went wrong on the last try. Empty when nothing did.
- `nextAttemptAt` (string | null): When it is tried again, or `null`.
- `createdAt` (string): When the event happened.

## Example

TypeScript:

```ts
await opensend.webhooks.test('wh_01')
```

CLI:

```bash
opensend webhooks test wh_01
```

Answer:

```json
{
  "object": "webhook_delivery",
  "id": "evt_04:wh_01",
  "webhookId": "wh_01",
  "type": "email.sent",
  "state": "delivered",
  "status": 200,
  "attempts": 1,
  "error": "",
  "nextAttemptAt": null,
  "createdAt": "2026-11-27T09:30:00.000Z"
}
```
