# Webhook testing

> Test a webhook endpoint without waiting for a real event, and find out why a delivery failed.

Last updated: 2026-10-30. Source: https://docs.smartchat.marketing/en/webhooks/testing/

## Send a test event

The test call sends a `webhook.test` event to your endpoint, signed like a real one, and waits for the answer. The answer of the API contains the HTTP status your server gave and how long it took.

**curl**

```bash
curl -X POST "https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/test" \
  -H "Authorization: Bearer $SMARTCHAT_API_KEY"
```

**Python**

```python
import os
import requests

response = requests.post(
    "https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/test",
    headers={"Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"]},
)
response.raise_for_status()
print(response.json())
```

**TypeScript**

```typescript
const response = await fetch("https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/test", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
  },
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

Response (200):


```json
{
  "object": "webhook_test_result",
  "endpoint_id": "whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
  "delivery_id": "whd_7a1b2c3d4e5f40718293a4b5c6d7e8f9",
  "delivered": true,
  "http_status": 200,
  "duration_ms": 182,
  "error": null
}
```

A test event does not change the health of the endpoint. The permission for the test event is `webhooks:write`.

## Test on your own computer

SmartChat only calls https addresses on port 443. To test with a program on your computer, use a tool that gives your local server a public https address, and register that address as the endpoint. Remove the endpoint when you are done.

## Find out why a delivery failed

The delivery log lists every try with its status, the HTTP status, a short cleaned error text and the duration.

**curl**

```bash
curl "https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/deliveries?status=failed&limit=20" \
  -H "Authorization: Bearer $SMARTCHAT_API_KEY"
```

**Python**

```python
import os
import requests

response = requests.get(
    "https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/deliveries",
    headers={"Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"]},
    params={
        "status": "failed",
        "limit": "20",
    },
)
response.raise_for_status()
print(response.json())
```

**TypeScript**

```typescript
const response = await fetch("https://api.smartchat.marketing/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/deliveries?status=failed&limit=20", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
  },
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

Response (200):


```json
{
  "object": "list",
  "data": [
    {
      "object": "webhook_delivery",
      "id": "whd_7a1b2c3d4e5f40718293a4b5c6d7e8f9",
      "endpoint_id": "whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
      "event_id": "evt_0f8c1a2e4b7d4c3e9a5b6d7e8f905678",
      "type": "contact.created",
      "attempt": 1,
      "status": "delivered",
      "http_status": 200,
      "error": null,
      "duration_ms": 182,
      "next_attempt_at": null,
      "created_at": "2026-10-25T09:44:59Z",
      "finished_at": "2026-10-25T09:45:00Z"
    }
  ],
  "has_more": false,
  "next_cursor": null,
  "url": "/v1/webhook-endpoints/whe_0f8c1a2e4b7d4c3e9a5b6d7e8f901234/deliveries"
}
```

Typical reasons:

| You see | Reason |
|---|---|
| `http_status` 401 or 403 | Your server refused the request. Check the sign-in rules of your own server for this address. |
| `http_status` 404 | The path is wrong. |
| Timeout | Your server needed more than 10 seconds. Answer first, work later. |
| Signature check fails in your code | You used a parsed body instead of the raw body, or the wrong secret. See [Verify a signature](https://docs.smartchat.marketing/en/webhooks/signature-verification/). |

