Docs / Register Webhook
POST /v1/webhooks

Register Webhook

Register a new webhook endpoint

Register Webhook

Create a new webhook endpoint to receive event notifications.

Endpoint

POST /v1/webhooks

Request

Headers

Header Value
Authorization Bearer {access_token}
Content-Type application/json

Body Parameters

Parameter Type Required Description
url string Yes Webhook endpoint URL (HTTPS)
events array Yes List of event types to subscribe
secret string No Secret for signature verification
active boolean No Enable/disable webhook (default: true)

Example Request

curl -X POST https://api.apimw.com/v1/webhooks \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourapp.com/webhooks/apimw",
    "events": [
      "message.sent",
      "message.delivered",
      "message.read",
      "message.received"
    ],
    "secret": "whsec_your_secret_key"
  }'

Response

Success Response (201 Created)

{
  "success": true,
  "data": {
    "id": "whk_abc123xyz",
    "url": "https://yourapp.com/webhooks/apimw",
    "events": [
      "message.sent",
      "message.delivered",
      "message.read",
      "message.received"
    ],
    "active": true,
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Verification

After creating a webhook, APIMW sends a verification request:

{
  "type": "webhook.verification",
  "challenge": "abc123xyz"
}

Respond with the challenge value to verify ownership.