Edit Webhook

Modify an existing webhook’s configuration using the DoubleTick API, allowing updates to event types, headers, URLs, and retry settings for seamless event tracking. πŸš€

API Endpoint

Use the following endpoint to edit a webhook:

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

Request Headers

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

Request Body Parameters

{
  "method": "GET",
  "headers": {
    "newKey": "New Value",
    "newKey-1": "New Value 1"
  },
  "body": {
    "newKey": "New Value",
    "newKey-1": "New Value 1"
  },
  "query": {
    "newKey": "New Value",
    "newKey-1": "New Value 1"
  },
  "authorization": {
    "type": "BEARER",
    "payload": "some-secure-token"
  },
  "url": "https://webhook-url.com/",
  "bodyFormat": "JSON",
  "webhookEvents": [
    "RAW_CLOUD_API_WEBHOOK",
    "REMOVE_TAG"
  ],
  "retryOnTimeout": true,
  "name": "webhook_edit_req",
  "wabaNumbers": [
    "919999999999",
    "919999999998"
  ]
}

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, required): BASIC or BEARER.
    • payload (string, required): The authorization payload, such as a token or credentials.
  • url (string, required): Fully qualified webhook URL.
  • bodyFormat (string, required): JSON or FORM_DATA.
  • webhookEvents (array of strings, required): List of events to be captured.
  • 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": "919999999999",
      "webhookEventType": "RAW_CLOUD_API_WEBHOOK"
    },
    {
      "wabaNumber": "919999999999",
      "webhookEventType": "REMOVE_TAG"
    },
    {
      "wabaNumber": "919999999998",
      "webhookEventType": "RAW_CLOUD_API_WEBHOOK"
    },
    {
      "wabaNumber": "919999999998",
      "webhookEventType": "REMOVE_TAG"
    }
  ],
  "invalidWebhooks": [],
  "invalidWabaNumbers": []
}

Bad Request (400)

{
    "statusCode": 400,
    "message": "Invalid request format",
    "error": "Bad Request"
}

Unauthorized (401)

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

Not Found (404)

{
    "message": "Cannot PATCH /v2/p/v2/webhook/:webhookId",
    "error": "Not Found",
    "statusCode": 404
}

Best Practices

  • Validate the webhook ID before making an update request.
  • Ensure the updated URL and headers are correctly formatted.
  • Modify only necessary fields to prevent unintended changes.

What’s Next

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