Skip to content

Test Listeners

Test listeners are ephemeral HTTP endpoints that capture all inbound requests. They’re useful for:

  • Testing webhook delivery before building a real receiver
  • Debugging Convoy delivery failures
  • Inspecting event payloads during development

Creating a listener

Terminal window
POST /api/webhooks/listeners
{
"name": "Test listener for subscription events",
"description": "Temporary — delete after testing"
}

Response includes the receiveUrl:

{
"id": "lst_abc123",
"receiveUrl": "http://localhost:3000/api/webhooks/receive/lst_abc123"
}

Using with Convoy

Create a Convoy endpoint pointing at your listener’s receiveUrl:

Terminal window
POST /api/webhooks/endpoints
{
"url": "http://portal:3000/api/webhooks/receive/lst_abc123",
"description": "Test listener",
"events": []
}

Now dispatch an event and the delivery will appear in the listener’s request list within seconds.

Viewing captured requests

Terminal window
GET /api/webhooks/listeners/lst_abc123/requests

Each captured request shows:

{
"id": "req_001",
"method": "POST",
"headers": {
"content-type": "application/json",
"x-convoy-signature": "t=1705312800,v1=abc..."
},
"body": {
"eventType": "subscription.created",
"data": { "subscriptionId": "sub_abc" }
},
"receivedAt": "2024-01-15T10:05:00.000Z"
}

Clearing requests

Terminal window
DELETE /api/webhooks/listeners/lst_abc123/requests

Receiver behaviour

The receive endpoint (ALL /api/webhooks/receive/:id) always returns 200 OK with body { "received": true }, regardless of content. This prevents Convoy from marking deliveries as failed during testing.

Cleanup

Delete listeners when done to keep the list tidy:

Terminal window
DELETE /api/webhooks/listeners/lst_abc123

This also deletes all captured requests.