Skip to content
Whats91

Change a webhook destination, rotate its verification token, or deactivate it.

Update Webhook

Summary

Change a webhook destination, rotate its verification token, or deactivate it.

Prerequisites

  • Authorization: Bearer w91_live_xxx
  • Content-Type: application/json for JSON requests

Update uses POST rather than PUT or PATCH so an integration only needs GET and POST. Every field inside webhook is optional, but at least one update field is required.

POST/api/v2/webhooks/{webhookUid}

Update a webhook destination.

ParameterTypeRequiredDescription
webhookUidstringRequiredWebhook UID to update.
senderIdstringOptionalWhatsApp sender that owns the webhook.
webhook.namestringOptionalDisplay name.
webhook.endpointUrlstringOptionalHTTPS delivery endpoint.
webhook.eventsarrayOptionalSupported event keys from the event catalog.
webhook.statusstringOptionalACTIVE or INACTIVE.
webhook.timeoutMsintegerOptionalDelivery timeout in milliseconds.
webhook.retryEnabledbooleanOptionalWhether failed deliveries are retried.
webhook.retryMaxAttemptsintegerOptionalMaximum retry attempts.
webhook.verificationHeaderKeystringOptionalCustom verification header name.
webhook.verificationTokenstringOptionalNew verification token value.
webhook.clearVerificationTokenbooleanOptionalSet true to remove the stored verification token.
Deactivate
curl -X POST "https://graph.whats91.com/api/v2/webhooks/wh_abc" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "916268662275",
    "webhook": { "status": "INACTIVE", "retryEnabled": false }
  }'
Rotate verification token
{
  "webhook": {
    "verificationToken": "new-shared-secret"
  }
}
Clear verification token
{
  "webhook": {
    "clearVerificationToken": true
  }
}
200 OK
{
  "success": true,
  "message": "Webhook updated",
  "data": {
    "webhookUid": "wh_abc",
    "status": "INACTIVE",
    "retryEnabled": false,
    "hasVerificationToken": true
  },
  "metadata": {
    "apiVersion": "v2",
    "requestId": "request-uuid"
  }
}
  • Updating a webhook never rotates the signing secret.
  • There is no public delete endpoint. Set status to INACTIVE to stop deliveries.
  • Webhook management is sender-scoped. Manage each WhatsApp number separately through senderId or a number-scoped token.

SDK Examples

Use these examples as starting points for server-side implementations.

cURL
curl -X POST "https://graph.whats91.com/api/v2/webhooks/{webhookUid}" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
  "webhook": {
    "verificationToken": "new-shared-secret"
  }
}'
Node.js
const response = await fetch("https://graph.whats91.com/api/v2/webhooks/{webhookUid}", {
  method: "POST",
  headers: {
    "Authorization": "Bearer w91_live_xxx",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "webhook": {
      "verificationToken": "new-shared-secret"
    }
  })
});

const data = await response.json();
console.log(data);
PHP
$ch = curl_init("https://graph.whats91.com/api/v2/webhooks/{webhookUid}");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer w91_live_xxx",
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "webhook" => [
      "verificationToken" => "new-shared-secret"
    ]
  ])
]);

$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests

response = requests.request(
    "POST",
    "https://graph.whats91.com/api/v2/webhooks/{webhookUid}",
    headers={
        "Authorization": "Bearer w91_live_xxx",
        "Content-Type": "application/json",
    },
    json={
        "webhook": {
            "verificationToken": "new-shared-secret"
        }
    }
)

print(response.json())
C#
using System.Text;

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer w91_live_xxx");

var request = new HttpRequestMessage(HttpMethod.Post, "https://graph.whats91.com/api/v2/webhooks/{webhookUid}");
request.Content = new StringContent(
  """
  {
    "webhook": {
      "verificationToken": "new-shared-secret"
    }
  }
  """,
  Encoding.UTF8,
  "application/json"
);

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Related APIs