Numbers
Set the webhook of a number
/v2/numbers/{numberId}/webhook- Scope:
webhooks:write - Idempotency-Key:not used
- changes settings
Public https URL only (private addresses refused). events: a list of event types, null for every event, or omitted to keep the current list; it is checked before the URL is saved. The signing secret is returned once, the first time a webhook is set (later: rotate-secret).
Request
curl -X PUT "https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/webhook" \
-H "Authorization: Bearer $WASLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/mursilat",
"events": [
"message.received",
"message.status",
"interactive.reply"
]
}'const res = await fetch('https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/webhook', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.WASLA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"url": "https://example.com/mursilat",
"events": [
"message.received",
"message.status",
"interactive.reply"
]
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
console.log(data);import os
import requests
headers = {"Authorization": f"Bearer {os.environ['WASLA_API_KEY']}"}
res = requests.put(
"https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/webhook",
headers=headers,
json={
"url": "https://example.com/mursilat",
"events": [
"message.received",
"message.status",
"interactive.reply"
]
},
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data)<?php
$ch = curl_init('https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/webhook');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('WASLA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com/mursilat',
'events' => [
'message.received',
'message.status',
'interactive.reply'
]
], JSON_UNESCAPED_UNICODE),
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) { throw new Exception($data['error']['code'] . ': ' . $data['error']['message']); }
print_r($data);{
"url": "https://example.com/mursilat",
"events": [
"message.received",
"message.status",
"interactive.reply"
]
}Response
200Example
{
"url": "https://example.com/mursilat",
"version": 2,
"events": [
"message.received",
"message.status",
"interactive.reply"
],
"availableEvents": [
"message.received",
"message.status",
"message.echo",
"interactive.reply",
"contact.opted_out",
"contact.opted_in",
"number.status",
"number.quality",
"template.status",
"campaign.status",
"otp.verified",
"conversation.attributed"
],
"secretConfigured": true,
"disabledAt": null,
"disabledReason": null,
"secret": "whsec_…(shown once)"
}Fields in this response
Fields of the example answer. Expand objects and arrays.
responseobject8 fields
- urlstring "https://example.com/mursilat"
- versioninteger 2
eventsarray3 items
- [0]string "message.received"
availableEventsarray12 items
- [0]string "message.received"
- secretConfiguredboolean true
- disabledAtnull null
- disabledReasonnull null
- secretstring "whsec_…(shown once)"
Parameters
Path
| Name | Type | Constraints | Description |
|---|---|---|---|
numberIdrequired | Typestring | Constraints— | DescriptionNumber id (GET /v2/numbers). |
Headers
| Name | Type | Constraints | Description |
|---|---|---|---|
X-Request-Idoptional | Typestring | Constraints— | DescriptionOptional: your own request id, echoed back (otherwise we generate req_…). Quote it to support. |
Body
| Name | Type | Constraints | Description |
|---|---|---|---|
urlrequired | Typestring | Constraints— | DescriptionPublic https:// URL on port 443 (or 80). Private / internal addresses are refused and redirects are never followed. |
eventsoptional | Typearray | null | Constraints— | DescriptionEvent types to receive. Omit (or null) for all events — new event types are then delivered automatically. |
versionoptional | Typeinteger | Constraintsone of: 2default 2 | DescriptionWebhook payload version. Only 2 is accepted on v2. |
Errors
Besides the authentication, rate-limit and validation errors every endpoint can return:
400 · URL_PRIVATE_ADDRESS — URL points to a private / internal address.
Use a public https URL.
Correct the cause before repeating the request.
ErrorsHTTP 400 · application/json { "error": { "code": "URL_PRIVATE_ADDRESS", "message": "URL points to a private / internal address.", "docsUrl": "https://mursilat.com/developers/v2/errors#URL_PRIVATE_ADDRESS", "requestId": "req_6604bedc8c489f20e582691a" } }400 · URL_PORT_NOT_ALLOWED — Only ports 443 / 80.
Use the default https port.
Correct the cause before repeating the request.
ErrorsHTTP 400 · application/json { "error": { "code": "URL_PORT_NOT_ALLOWED", "message": "Only ports 443 / 80.", "docsUrl": "https://mursilat.com/developers/v2/errors#URL_PORT_NOT_ALLOWED", "requestId": "req_6604bedc8c489f20e582691a" } }403 · WEBHOOKS_NOT_IN_PLAN — Your plan does not include webhooks.
Upgrade.
Correct the cause before repeating the request.
ErrorsHTTP 403 · application/json { "error": { "code": "WEBHOOKS_NOT_IN_PLAN", "message": "Your plan does not include webhooks.", "docsUrl": "https://mursilat.com/developers/v2/errors#WEBHOOKS_NOT_IN_PLAN", "requestId": "req_6604bedc8c489f20e582691a" } }400 · WEBHOOK_EVENTS_INVALID — Unknown event type.
See GET /v2/webhooks/events.
Correct the cause before repeating the request.
ErrorsHTTP 400 · application/json { "error": { "code": "WEBHOOK_EVENTS_INVALID", "message": "Unknown event type.", "docsUrl": "https://mursilat.com/developers/v2/errors#WEBHOOK_EVENTS_INVALID", "requestId": "req_6604bedc8c489f20e582691a" } }404 · NUMBER_NOT_FOUND — Number not found in this account.
Check numberId (GET /v2/numbers).
Correct the cause before repeating the request.
ErrorsHTTP 404 · application/json { "error": { "code": "NUMBER_NOT_FOUND", "message": "Number not found in this account.", "docsUrl": "https://mursilat.com/developers/v2/errors#NUMBER_NOT_FOUND", "requestId": "req_6604bedc8c489f20e582691a" } }400 · WEBHOOK_VERSION_INVALID — version must be 2.
Use 2.
Correct the cause before repeating the request.
ErrorsHTTP 400 · application/json { "error": { "code": "WEBHOOK_VERSION_INVALID", "message": "version must be 2.", "docsUrl": "https://mursilat.com/developers/v2/errors#WEBHOOK_VERSION_INVALID", "requestId": "req_6604bedc8c489f20e582691a" } }400 · VALIDATION_FAILED — The request is invalid.
See details.errors / details.field.
Correct the cause before repeating the request.
ErrorsHTTP 400 · application/json { "error": { "code": "VALIDATION_FAILED", "message": "The request is invalid.", "docsUrl": "https://mursilat.com/developers/v2/errors#VALIDATION_FAILED", "requestId": "req_6604bedc8c489f20e582691a" } }403 · SCOPE_REQUIRED — The key lacks the scope of this endpoint.
Add the scope in details.required to the key.
Correct the cause before repeating the request.
ErrorsHTTP 403 · application/json { "error": { "code": "SCOPE_REQUIRED", "message": "The key lacks the scope of this endpoint.", "docsUrl": "https://mursilat.com/developers/v2/errors#SCOPE_REQUIRED", "requestId": "req_6604bedc8c489f20e582691a" } }401 · API_KEY_REQUIRED — No API key was sent.
Send Authorization: Bearer wsl_live_…
Correct the cause before repeating the request.
ErrorsHTTP 401 · application/json { "error": { "code": "API_KEY_REQUIRED", "message": "No API key was sent.", "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_REQUIRED", "requestId": "req_6604bedc8c489f20e582691a" } }401 · API_KEY_INVALID — The API key is not valid.
Copy the key again from Settings → API keys (it is shown only once; create a new one if lost).
Correct the cause before repeating the request.
ErrorsHTTP 401 · application/json { "error": { "code": "API_KEY_INVALID", "message": "The API key is not valid.", "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_INVALID", "requestId": "req_6604bedc8c489f20e582691a" } }429 · RATE_LIMITED — Rate limit of this key reached.
Wait Retry-After seconds; watch X-RateLimit-Remaining.
Retry after addressing the cause.
ErrorsHTTP 429 · application/json { "error": { "code": "RATE_LIMITED", "message": "Rate limit of this key reached.", "docsUrl": "https://mursilat.com/developers/v2/errors#RATE_LIMITED", "requestId": "req_6604bedc8c489f20e582691a" } }
Try it
Send this request from your browser to the Mursilat API.
documented examplePreview — this copy of the docs isn’t on mursilat.com, so the console shows the documented example instead of calling the API.
Kept only in this tab’s memory: never saved, never put in the URL, sent only to mursilat.com. Reloading the page forgets it.