# Test Webhook - Send a Sample Event to Your Endpoint

> Trigger a test event on a configured webhook to verify your Telegram or Discord subscription bot integration before going live.

Source: https://docs.botsubscription.com/api/integrations/test-webhook/

Trigger a test delivery to a webhook you have already configured, so you can confirm your endpoint receives events and verifies signatures correctly before relying on it in production.

<ApiEndpoint method="POST" endpoint="/v2/projects/{project_id}/integrations/webhooks/{webhook_id}/test" />

<ApiAuthorization type="Bearer API Key" />

**API key access:** Unrestricted project API key required. Restricted keys cannot call this endpoint.

<ApiSection title="Path Parameters">
  <ApiParameter name="project_id" type="string" required description="The unique identifier of the project." />
  <ApiParameter name="webhook_id" type="string" required description="The unique identifier of the webhook to test." />
</ApiSection>

<ApiSection title="Request Body">
  <ApiParameter name="event" type="string" description="Event name in domain.action format, e.g. payment-request.completed. Defaults to webhook.test when omitted. An override changes the event name only; the payload remains diagnostic test data." />
</ApiSection>

<ApiSamplePane>

<ApiRequestSample title="Request">

```bash
curl -X POST "https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/integrations/webhooks/22222222-2222-2222-2222-222222222222/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event": "payment-request.completed"
  }'
```

```javascript
const project_id = 'YOUR_PROJECT_ID';
const webhook_id = '22222222-2222-2222-2222-222222222222';
const response = await fetch(`https://api.botsubscription.com/v2/projects/${project_id}/integrations/webhooks/${webhook_id}/test`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    event: 'payment-request.completed'
  })
});
const data = await response.json();
```

```python
import requests

project_id = 'YOUR_PROJECT_ID'
webhook_id = '22222222-2222-2222-2222-222222222222'
response = requests.post(
    f'https://api.botsubscription.com/v2/projects/{project_id}/integrations/webhooks/{webhook_id}/test',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    json={'event': 'payment-request.completed'}
)
data = response.json()
```

```php
$project_id = 'YOUR_PROJECT_ID';
$webhook_id = '22222222-2222-2222-2222-222222222222';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.botsubscription.com/v2/projects/{$project_id}/integrations/webhooks/{$webhook_id}/test");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['event' => 'payment-request.completed']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
```

</ApiRequestSample>

<ApiResponseTabs>
  <ApiResponse status={201} description="Test webhook scheduled">

```json
{
  "ok": true,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/integrations/webhooks/22222222-2222-2222-2222-222222222222/test",
  "code": 201,
  "message": "Test webhook initiated",
  "data": {
    "status": "scheduled",
    "webhook_id": "22222222-2222-2222-2222-222222222222",
    "event": "payment-request.completed"
  }
}
```

  </ApiResponse>
  <ApiResponse status={404} description="Webhook not found">

```json
{
  "ok": false,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/integrations/webhooks/22222222-2222-2222-2222-222222222222/test",
  "code": 404,
  "error": {
    "error_code": "NOT_FOUND",
    "message": "Webhook not found"
  }
}
```

  </ApiResponse>
  <ApiResponse status={401} description="Invalid or expired API key">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/integrations/webhooks/22222222-2222-4222-8222-222222222222/test",
  "code": 401,
  "error": {
    "message": "Invalid or expired authentication token.",
    "error_code": "UNAUTHORIZED"
  }
}
```

  </ApiResponse>
</ApiResponseTabs>

</ApiSamplePane>

A `201` confirms the test event was scheduled for delivery, not that your endpoint received it. Check your endpoint logs, and verify the signature the same way you would for a real event—see the [signature verification guide](https://docs.botsubscription.com/webhooks/signature-verification/).
