Register New Webhook

Set up real-time event notifications using the DoubleTick API by registering a webhook to capture message status updates, customer interactions, and system events. πŸš€

API Endpoint

Use the following endpoint to register a webhook:

POST https://public.doubletick.io/v2/webhook/register

Request Headers

{
  "Authorization": "YOUR_API_KEY",
  "Content-Type": "application/json"
}

Request Body Parameters

{
  "method": "GET",
  "headers": { "newKeyHeader": "New Value Header" },
  "body": { "newKeyBody": "New Value Body" },
  "query": { "newKeyQuery": "New Value Query" },
  "authorization": {
      "type": "BASIC",
      "payload": "some-secure-token"
  },
  "url": "https://your-callback-url.com",
  "bodyFormat": "JSON",
  "webhookEvents": ["ADD_TAG"],
  "retryOnTimeout": true,
  "name": "Test Webhook",
  "wabaNumbers": ["waba_number1", "waba_number2", "waba_number3"]
}

Parameters

  • method (string, required): HTTP method for the webhook (GET, POST, PUT, DELETE, PATCH, HEAD).
  • headers (object, optional): Custom headers for the webhook.
  • body (object, optional): Additional request body parameters.
  • query (object, optional): Query parameters sent with the request.
  • authorization (object, required):
    • type (string, optional): BASIC or BEARER.
    • payload (string, optional): Secure token for authentication.
  • url (string, required, optional): Fully qualified webhook URL.
  • bodyFormat (string, required): JSON or FORM_DATA.
  • webhookEvents (array of strings, required): List of events to be captured.
    • All Events are listed below:
      • ADD_TAG
      • MESSAGE_RECEIVED
      • MESSAGE_STATUS_UPDATE
      • CHAT_ASSIGNED_TO_AGENT
      • CHAT_UNASSIGNED
      • UPDATE_CUSTOMER_CUSTOM_FIELD
      • WIDGET_LEAD_RECEIVED
      • VERIFIED_WIDGET_LEAD_RECEIVED
      • NEW_LEAD
      • RAW_CLOUD_API_WEBHOOK
      • CLOSE_CONVERSATION
      • TEMPLATE_UPDATE
      • ADD_TAG
      • REMOVE_TAG
      • CALL_TO_WHATSAPP_MESSAGE_RECEIVED
      • COVERSATION_OPENED
      • CUSTOMER_BUSINESS_CHAT_OPEN
  • retryOnTimeout (boolean, required): Whether to retry the webhook call on timeout.
  • name (string, required): Webhook name.
  • wabaNumbers (array of strings, required): List of WhatsApp Business Account numbers.

Response

Success Response (201)

{
    "validWebhooks": [
        {
            "wabaNumber": "waba_number_assigned_to_webhook",
            "webhookEventType": "ADD_TAG"
        }
    ],
    "invalidWebhooks": [],
    "invalidWabaNumbers": []
}

Bad Request (400)

{
  "message": "error_message",
  "error": "Bad Request",
  "statusCode": 400
}

Unauthorized (401)

{
  "message": "Invalid public api key",
  "error": "Unauthorized",
  "statusCode": 401
}

Unprocessable Entity (422)

{
  "message": "invalid file type for audio: text/html; charset=utf-8",
  "error": "Unprocessable Entity",
  "statusCode": 422
}

Best Practices

  • Ensure the webhook URL is accessible and properly formatted.
  • Use secure authentication methods to protect data.
  • Select only the necessary webhook events to optimize performance.

What’s Next

Explore more message types and enhance your WhatsApp communication with DoubleTick API