Meta-shaped message sends
POST /v1/{PHONE_NUMBER_ID}/messages accepts Meta's messaging_product, to, type, and nested text, image, document, video, audio, location, interactive button/list, or template objects. Authenticate with an Anant8 developer Bearer token created for this phone number. Idempotency-Key is optional: without it each call is a new independent send; with it, reuse the same key only for retries of the same request. A key reused with a different payload returns HTTP 409, and concurrent keyed requests return HTTP 409 with Retry-After. Anant8 reserves prepaid balance, persists a dispatch intent, and submits the request through the existing durable queue's shared provider processor. A definitive provider rejection releases the reservation; an accepted send remains in the existing settlement workflow until status billing completes. An uncertain provider outcome keeps the reservation for reconciliation. HTTP 200 is returned only after Meta accepts the send; the actual Meta response and wamid are persisted and returned. Free-form/media sends require an open 24-hour service window. Template sends require approval and syncing; marketing templates use /v1/{PHONE_NUMBER_ID}/marketing_messages.
curl -X POST https://api.anant8tech.com/v1/{{PHONE_NUMBER_ID}}/messages \
-H 'Authorization: Bearer a8_live_<TOKEN>' \
-H 'Content-Type: application/json' \
-d '{"messaging_product":"whatsapp","recipient_type":"individual","to":"14155550123","type":"text","text":{"preview_url":false,"body":"Hello from Anant8!"}}'Retry-safe send with Idempotency-Key
For retries of one logical send, send the same optional key on every attempt. A completed request replays Meta's stored response; an in-progress request returns HTTP 409 and Retry-After. Reusing the key with a different payload returns HTTP 409. A provider timeout or uncertain response returns HTTP 503 and is not automatically resubmitted. Retry only with the same key so Anant8 can find the original operation.
curl -X POST https://api.anant8tech.com/v1/{{PHONE_NUMBER_ID}}/messages \
-H 'Authorization: Bearer a8_live_<TOKEN>' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-8472-attempt-group' \
-d '{"messaging_product":"whatsapp","to":"14155550123","type":"text","text":{"body":"Hello from Anant8!"}}'Synchronous Meta success response
A successful public send returns HTTP 200 with the provider's actual response JSON. The example ID is a placeholder; the API returns the exact wamid Meta supplied. Repeating a completed Idempotency-Key with the same payload replays the stored response. A key reused with different content returns HTTP 409. A provider 5xx response is surfaced as HTTP 502; timeouts and other outcomes that cannot confirm acceptance return HTTP 503. Neither outcome is automatically resubmitted. Retry only with the same key and check message history/reconciliation. Acceptance is not delivery.
{
"messaging_product": "whatsapp",
"contacts": [{ "input": "14155550123", "wa_id": "14155550123" }],
"messages": [{ "id": "wamid.EXAMPLE_PROVIDER_ID", "message_status": "accepted" }]
}Meta-style approved template
POST /v1/{PHONE_NUMBER_ID}/messages also accepts Meta's template object with name, language.code, and components. The template must already be approved and synced to this phone number's connected WABA. Category determines the send route: MARKETING goes to /marketing_messages; UTILITY and AUTHENTICATION use /messages.
{
"messaging_product": "whatsapp",
"to": "14155550123",
"type": "template",
"template": {
"name": "order_update",
"language": { "code": "en_US" },
"components": [{
"type": "body",
"parameters": [{ "type": "text", "text": "Asha" }]
}]
}
}Meta-style interactive message
POST /v1/{PHONE_NUMBER_ID}/messages supports Meta's interactive button and list object shapes and returns the actual provider response synchronously. Other interactive subtypes are not exposed through this route.
{
"messaging_product": "whatsapp",
"to": "14155550123",
"type": "interactive",
"interactive": {
"type": "button",
"body": { "text": "Would you like an update?" },
"action": { "buttons": [
{ "type": "reply", "reply": { "id": "yes", "title": "Yes" } },
{ "type": "reply", "reply": { "id": "no", "title": "No" } }
] }
}
}Meta-shaped send with C#
Use a phone-scoped Anant8 API token from a trusted server. This example omits Idempotency-Key, so each call is independent. Add a stable key when you need safe retries; reuse it only with the same request body.
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using var client = new HttpClient { BaseAddress = new Uri("https://api.anant8tech.com") };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", a8ApiToken);
using var request = new HttpRequestMessage(HttpMethod.Post, $"/v1/{phoneNumberId}/messages");
request.Content = JsonContent.Create(new {
messaging_product = "whatsapp",
to = "14155550123",
type = "text",
text = new { preview_url = false, body = "Hello from Anant8!" }
});
using var response = await client.SendAsync(request);
var result = await response.Content.ReadFromJsonAsync<JsonElement>();
response.EnsureSuccessStatusCode();
Console.WriteLine(result.GetProperty("messages")[0].GetProperty("id").GetString()); // Actual Meta wamidUpload, retrieve, download, and delete media
POST /v1/{PHONE_NUMBER_ID}/media accepts multipart form-data with messaging_product=whatsapp, file, and type. Do not set the multipart boundary yourself; the HTTP client creates it. Meta validates media size/type, and Anant8 stores a tenant ownership mapping for the real returned media ID. Use the returned id in an image/document/video/audio message during the 24-hour service window. GET /v1/{MEDIA_ID} returns Meta metadata, DELETE /v1/{MEDIA_ID} deletes media uploaded through Anant8, and GET /v1/{MEDIA_ID}/download streams the file through Anant8 so the Meta credential remains server-side. Download is an Anant8 extension; Meta's metadata response supplies a temporary URL. The token can only access media mapped to its authorized phone/WABA.
curl -X POST https://api.anant8tech.com/v1/{{PHONE_NUMBER_ID}}/media \
-H 'Authorization: Bearer a8_live_<TOKEN>' \
-F 'messaging_product=whatsapp' \
-F 'type=image/jpeg' \
-F 'file=@./image.jpg'
curl https://api.anant8tech.com/v1/{{MEDIA_ID}} \
-H 'Authorization: Bearer a8_live_<TOKEN>'
curl https://api.anant8tech.com/v1/{{MEDIA_ID}}/download \
-H 'Authorization: Bearer a8_live_<TOKEN>' --output media.bin
curl -X DELETE https://api.anant8tech.com/v1/{{MEDIA_ID}} \
-H 'Authorization: Bearer a8_live_<TOKEN>'Meta-shaped send with JavaScript
Run this only from a trusted server. This example omits Idempotency-Key, so every call is a separate send. For retries of one logical send, add a stable key and reuse it with the same body; never retry an uncertain send with a new key.
const response = await fetch(
`https://api.anant8tech.com/v1/${phoneNumberId}/messages`,
{
method: "POST",
headers: {
Authorization: `Bearer ${anant8ApiToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
messaging_product: "whatsapp",
to: "14155550123",
type: "text",
text: { preview_url: false, body: "Hello from Anant8!" },
}),
},
);
const result = await response.json();
if (response.status === 200) console.log(result.messages[0].id); // Actual wamid from MetaMeta-shaped send with C#
Use a server-side Anant8 Bearer API token. This example sends without Idempotency-Key, so another call is a new send. Add and reuse the same key and body when retry safety is needed.
using System.Net.Http.Headers;
using System.Net.Http.Json;
using var client = new HttpClient { BaseAddress = new Uri("https://api.anant8tech.com") };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", anant8ApiToken);
using var request = new HttpRequestMessage(HttpMethod.Post, $"/v1/{phoneNumberId}/messages");
request.Content = JsonContent.Create(new {
messaging_product = "whatsapp",
to = "14155550123",
type = "text",
text = new { preview_url = false, body = "Hello from Anant8!" }
});
using var response = await client.SendAsync(request);
var accepted = await response.Content.ReadFromJsonAsync<JsonElement>();
response.EnsureSuccessStatusCode();Send approved template messages
/api/client/whatsapp/messages/templateBearer JWTPOST /api/client/whatsapp/messages/template queues an approved non-marketing template batch. All recipients are processed against the selected customer-owned WABA. Required JSON fields are wabaMasterId (integer), templateId (integer), and recipients (array of phone numbers with + and country code). components is an optional Meta-style array of header, body, button, or carousel parameter components. Idempotency-Key is optional. Without it each call creates an independent batch; with it, reuse the same key only for retries with the same request body. A different body with the same key returns HTTP 409. Between 1 and 1,000 recipients are accepted; phone numbers outside 8–15 digits are reported in invalidRecipients.
{
"wabaMasterId": 42,
"templateId": 901,
"recipients": ["+14155550123"],
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Asha" }
]
}
]
}Note. Template name and language are read from the saved template. Use the matching component format and placeholder order defined by that approved template. A marketing-category template must use the marketing endpoint.
Template request with cURL
/api/client/whatsapp/messages/templateBearer JWTThe response is HTTP 202 Accepted because delivery is queued in the background. It includes a batchId and progressUrl; it is not a final Meta delivery receipt.
curl -X POST https://api.anant8tech.com/api/client/whatsapp/messages/template \
-H 'Authorization: Bearer <JWT>' \
-H 'Content-Type: application/json' \
-d '{"wabaMasterId":42,"templateId":901,"recipients":["+14155550123"],"components":[{"type":"body","parameters":[{"type":"text","text":"Asha"}]}]}'Accepted response
A repeat request with the same Idempotency-Key and identical request body returns HTTP 202 with duplicate: true and the original batchId. A changed body with that key returns HTTP 409. Without a key, each request creates a new batch. Check the progress URL or query message history for later status.
{
"success": true,
"message": "Message batch accepted for background delivery.",
"data": {
"batchId": 781,
"status": "queued",
"queuedCount": 1,
"duplicate": false,
"invalidRecipients": [],
"progressUrl": "/api/client/whatsapp/messages/batches/781"
}
}List saved templates
/api/client/whatsapp/templatesBearer JWTGET /api/client/whatsapp/templates returns saved templates for the authenticated client. Each item includes whatsAppTemplateId, wabaMasterId, name, language, category, template text/components, status, and metaTemplateId (JSON uses camel case). Use whatsAppTemplateId as templateId when sending. This endpoint does not create or approve templates.
curl https://api.anant8tech.com/api/client/whatsapp/templates \
-H 'Authorization: Bearer <JWT>' \
-H 'Accept: application/json'Marketing template messages
/api/client/whatsapp/messages/marketingBearer JWTPOST /api/client/whatsapp/messages/marketing accepts the same request body and optional Idempotency-Key behavior, but only for an approved template whose category is MARKETING. The standard template route rejects marketing templates with HTTP 409; the marketing route rejects other categories with HTTP 409.
Batch progress
/api/client/whatsapp/messages/batches/{batchId}Bearer JWTGET /api/client/whatsapp/messages/batches/{batchId} returns { success: true, data: ... } for a batch owned by the authenticated client. DELETE on the same route cancels queued items that have not started. A batch belonging to another client is not returned. The progress DTO is maintained by the backend; delivery-level results are available through message history.
Check batch progress or cancel queued work
/api/client/whatsapp/messages/batches/{batchId}Bearer JWTUse GET to inspect an accepted batch or DELETE to cancel queued items that have not started. Both actions are scoped to the authenticated client.
curl https://api.anant8tech.com/api/client/whatsapp/messages/batches/781 \
-H 'Authorization: Bearer <JWT>'
curl -X DELETE https://api.anant8tech.com/api/client/whatsapp/messages/batches/781 \
-H 'Authorization: Bearer <JWT>'Message history
/api/client/whatsapp/messages/historyBearer JWTGET /api/client/whatsapp/messages/history returns newest-first items and a nextCursor. Optional filters: wabaMasterId, phone, wamid, direction, status, messageType, billingStatus, fromUtc, toUtc. pageSize defaults to 50 and is clamped to 1–100. Pass nextCursor as cursor to fetch the next page. Items include local id, recipient, direction, type, status, timestamps, failure fields, and billing fields when available.
curl 'https://api.anant8tech.com/api/client/whatsapp/messages/history?pageSize=25&status=delivered' \
-H 'Authorization: Bearer <JWT>'History response
/api/client/whatsapp/messages/historyBearer JWTThe response is a page of local Anant8 message records. Timestamps can be null until Meta sends the corresponding status update.
{
"success": true,
"data": {
"items": [{
"id": 78123,
"wabaMasterId": 42,
"contactPhone": "+14155550123",
"direction": "Outbound",
"messageType": "template",
"metaMessageId": "wamid.example",
"status": "delivered",
"receivedAtUtc": "2026-11-07T08:30:00Z",
"sentAtUtc": "2026-11-07T08:30:02Z",
"deliveredAtUtc": "2026-11-07T08:30:05Z",
"readAtUtc": null
}],
"nextCursor": null,
"pageSize": 25
}
}Message detail
/api/client/whatsapp/messages/history/{id}Bearer JWTGET /api/client/whatsapp/messages/history/{id} returns message/provider fields, a statusTimeline, and billing details where present. IDs are local Anant8 message IDs. A message not owned by the caller returns HTTP 404. Sent, delivered, read, failed, and their timestamps arrive asynchronously from Meta webhook events. A synchronous /v1 HTTP 200 means Meta accepted the request, while Anant8-specific batch calls acknowledge queue acceptance only.
curl https://api.anant8tech.com/api/client/whatsapp/messages/history/78123 \
-H 'Authorization: Bearer <JWT>'List contacts
/api/client/contactsBearer JWTGET /api/client/contacts supports search, groupId, tagId, status, page, and pageSize filters. Page size is capped at 100. Results include items, totalCount, page, pageSize, and totalContacts.
curl 'https://api.anant8tech.com/api/client/contacts?page=1&pageSize=25&status=Active' \
-H 'Authorization: Bearer <JWT>'Retrieve one contact
/api/client/contacts/{id}Bearer JWTGET /api/client/contacts/{id} returns a contact owned by the authenticated client and partner. A contact outside that tenant is returned as not found.
curl https://api.anant8tech.com/api/client/contacts/314 \
-H 'Authorization: Bearer <JWT>'Create or update a contact
/api/client/contactsBearer JWTPOST /api/client/contacts creates a contact; PUT /api/client/contacts/{id} replaces its editable fields. phoneNumber is required. Other accepted fields are firstName, lastName, name, email, countryCode, company, customFields (string map), status, contactGroupId, and tags. A duplicate phone number returns HTTP 409.
curl -X POST https://api.anant8tech.com/api/client/contacts \
-H 'Authorization: Bearer <JWT>' \
-H 'Content-Type: application/json' \
-d '{"firstName":"Asha","lastName":"Shah","phoneNumber":"+919876543210","email":"asha@example.com","countryCode":"IN","company":"Example Co","customFields":{"segment":"customer"},"status":"Active","tags":["customer"]}'
curl -X PUT https://api.anant8tech.com/api/client/contacts/314 \
-H 'Authorization: Bearer <JWT>' \
-H 'Content-Type: application/json' \
-d '{"firstName":"Asha","lastName":"Shah","phoneNumber":"+919876543210","status":"Active"}'Delete a contact
/api/client/contacts/{id}Bearer JWTDELETE /api/client/contacts/{id} removes a contact owned by the authenticated client. Success returns { success: true, message: "Contact deleted." }.
curl -X DELETE https://api.anant8tech.com/api/client/contacts/314 \
-H 'Authorization: Bearer <JWT>'Contact fields
Contact create/update requests may include firstName, lastName, name, phoneNumber, email, countryCode, company, customFields, status, contactGroupId, and tags. Phone numbers are normalized and validated using the phone parser. Status values accepted as-is are Active, Inactive, and Unsubscribed; other values default to Active.
{
"firstName": "Asha",
"lastName": "Shah",
"phoneNumber": "+919876543210",
"email": "asha@example.com",
"countryCode": "IN",
"company": "Example Co",
"customFields": { "segment": "customer" },
"status": "Active",
"tags": ["customer"]
}JavaScript and .NET examples
These examples send an approved template. Keep both credentials and bearer tokens on your server.
const response = await fetch("https://api.anant8tech.com/api/client/whatsapp/messages/template", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"Idempotency-Key": "order-8472-20261107",
},
body: JSON.stringify({
wabaMasterId: 42,
templateId: 901,
recipients: ["+14155550123"],
components: [{ type: "body", parameters: [{ type: "text", text: "Asha" }] }],
}),
});
const result = await response.json();.NET example
Use System.Net.Http.Json in a server-side .NET application.
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using var client = new HttpClient { BaseAddress = new Uri("https://api.anant8tech.com") };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
using var request = new HttpRequestMessage(HttpMethod.Post, "/api/client/whatsapp/messages/template");
request.Headers.Add("Idempotency-Key", "order-8472-20261107");
request.Content = JsonContent.Create(new {
wabaMasterId = 42,
templateId = 901,
recipients = new[] { "+14155550123" },
components = new[] { new { type = "body", parameters = new[] { new { type = "text", text = "Asha" } } } }
});
using var response = await client.SendAsync(request);
var result = await response.Content.ReadFromJsonAsync<JsonElement>();
response.EnsureSuccessStatusCode();Need help with an integration? Contact Anant8