Skip to main content
Version: Latest

SDK Code Examples — WhatsAppWebhookController

Base URL: https://{tenant}.shumoul.app · Token variable: $TOKEN (bash) / %TOKEN% (cmd) / token (JS/C#/Dart), obtained per §19 SDK Usage Guide.


1. GET /api/v1/notifications/webhook

Permission: none (anonymous)

cURL — Linux/macOS:

curl -X GET "https://{tenant}.shumoul.app/api/v1/notifications/webhook?hub.mode=subscribe&hub.verify_token=ShumoulWhatsAppWebhook2026&hub.challenge=1158201444" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"

cURL — Windows (cmd.exe):

curl -X GET "https://{tenant}.shumoul.app/api/v1/notifications/webhook?hub.mode=subscribe&hub.verify_token=ShumoulWhatsAppWebhook2026&hub.challenge=1158201444" ^
-H "Authorization: Bearer %TOKEN%" ^
-H "Content-Type: application/json"

JavaScript — fetch():

const response = await fetch("https://{tenant}.shumoul.app/api/v1/notifications/webhook?hub.mode=subscribe&hub.verify_token=ShumoulWhatsAppWebhook2026&hub.challenge=1158201444", {
method: "GET",
headers: { "Authorization": `Bearer ${token}`, "Content-Type": "application/json" }
});
const result = await response.json();

JavaScript — Axios:

const { data } = await axios.get("https://{tenant}.shumoul.app/api/v1/notifications/webhook?hub.mode=subscribe&hub.verify_token=ShumoulWhatsAppWebhook2026&hub.challenge=1158201444", { headers: { Authorization: `Bearer ${token}` } });

C# — HttpClient:

var client = httpClientFactory.CreateClient("Shumoul"); // BaseAddress = "https://{tenant}.shumoul.app"
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var response = await client.GetAsync("/api/v1/notifications/webhook?hub.mode=subscribe&hub.verify_token=ShumoulWhatsAppWebhook2026&hub.challenge=1158201444");
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadFromJsonAsync<Result<object>>();

Flutter — Dio:

final response = await dio.get(
"/api/v1/notifications/webhook?hub.mode=subscribe&hub.verify_token=ShumoulWhatsAppWebhook2026&hub.challenge=1158201444",
options: Options(headers: {"Authorization": "Bearer $token"}),
);

2. POST /api/v1/notifications/webhook

Permission: none (anonymous)

cURL — Linux/macOS:

curl -X POST "https://{tenant}.shumoul.app/api/v1/notifications/webhook" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
\
-H "X-Hub-Signature-256: sha256=<hmac>" \
-d '{"object":"whatsapp_business_account","entry":[{"id":"2091544401399393","changes":[{"field":"messages","value":{"messaging_product":"whatsapp","metadata":{"display_phone_number":"966501234567","phone_number_id":"1088505757690326"},"contacts":[{"profile":{"name":"Ahmed Al-Otaibi"},"wa_id":"966501112222"}],"messages":[{"from":"966501112222","id":"wamid.HBgLxx","timestamp":"1751500000","type":"text","text":{"body":"Hello"}}]}}]}]}'

cURL — Windows (cmd.exe):

curl -X POST "https://{tenant}.shumoul.app/api/v1/notifications/webhook" ^
-H "Authorization: Bearer %TOKEN%" ^
-H "Content-Type: application/json"
^
-H "X-Hub-Signature-256: sha256=<hmac>" ^
-d "{\"object\":\"whatsapp_business_account\",\"entry\":[{\"id\":\"2091544401399393\",\"changes\":[{\"field\":\"messages\",\"value\":{\"messaging_product\":\"whatsapp\",\"metadata\":{\"display_phone_number\":\"966501234567\",\"phone_number_id\":\"1088505757690326\"},\"contacts\":[{\"profile\":{\"name\":\"Ahmed Al-Otaibi\"},\"wa_id\":\"966501112222\"}],\"messages\":[{\"from\":\"966501112222\",\"id\":\"wamid.HBgLxx\",\"timestamp\":\"1751500000\",\"type\":\"text\",\"text\":{\"body\":\"Hello\"}}]}}]}]}"

JavaScript — fetch():

const response = await fetch("https://{tenant}.shumoul.app/api/v1/notifications/webhook", {
method: "POST",
headers: { "Authorization": `Bearer ${token}`, "Content-Type": "application/json" },
body: JSON.stringify({
"object": "whatsapp_business_account",
"entry": [
{
"id": "2091544401399393",
"changes": [
{
"field": "messages",
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "966501234567",
"phone_number_id": "1088505757690326"
},
"contacts": [
{
"profile": {
"name": "Ahmed Al-Otaibi"
},
"wa_id": "966501112222"
}
],
"messages": [
{
"from": "966501112222",
"id": "wamid.HBgLxx",
"timestamp": "1751500000",
"type": "text",
"text": {
"body": "Hello"
}
}
]
}
}
]
}
]
})
});
const result = await response.json();

JavaScript — Axios:

const { data } = await axios.post(
"https://{tenant}.shumoul.app/api/v1/notifications/webhook",
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "2091544401399393",
"changes": [
{
"field": "messages",
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "966501234567",
"phone_number_id": "1088505757690326"
},
"contacts": [
{
"profile": {
"name": "Ahmed Al-Otaibi"
},
"wa_id": "966501112222"
}
],
"messages": [
{
"from": "966501112222",
"id": "wamid.HBgLxx",
"timestamp": "1751500000",
"type": "text",
"text": {
"body": "Hello"
}
}
]
}
}
]
}
]
},
{ headers: { Authorization: `Bearer ${token}` } }
);

C# — HttpClient:

var client = httpClientFactory.CreateClient("Shumoul"); // BaseAddress = "https://{tenant}.shumoul.app"
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var payload = new { object = "whatsapp_business_account", entry = new[] { new { id = "2091544401399393", changes = new[] { new { field = "messages", value = new { messaging_product = "whatsapp", metadata = new { display_phone_number = "966501234567", phone_number_id = "1088505757690326" }, contacts = new[] { new { profile = new { name = "Ahmed Al-Otaibi" }, wa_id = "966501112222" } }, messages = new[] { new { from = "966501112222", id = "wamid.HBgLxx", timestamp = "1751500000", type = "text", text = new { body = "Hello" } } } } } } } } };
var response = await client.PostAsJsonAsync("/api/v1/notifications/webhook", payload);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadFromJsonAsync<Result<object>>();

Flutter — Dio:

final response = await dio.post(
"/api/v1/notifications/webhook",
data: {
"object": "whatsapp_business_account",
"entry": [
{
"id": "2091544401399393",
"changes": [
{
"field": "messages",
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "966501234567",
"phone_number_id": "1088505757690326"
},
"contacts": [
{
"profile": {
"name": "Ahmed Al-Otaibi"
},
"wa_id": "966501112222"
}
],
"messages": [
{
"from": "966501112222",
"id": "wamid.HBgLxx",
"timestamp": "1751500000",
"type": "text",
"text": {
"body": "Hello"
}
}
]
}
}
]
}
]
},
options: Options(headers: {"Authorization": "Bearer $token"}),
);