For developers

WhatsApp API & Webhooks documentation

Connect your store, website or CRM to WhatsApp Business through ChatLike: send WhatsApp templates automatically on every order, or control messages, templates and flows from your code and receive events on your server.

Overview: two ways to integrate

Webhook Automation

A private inbound URL. Your store POSTs JSON to it, and ChatLike sends an approved WhatsApp template to the customer using rules you set in the dashboard, without code.

Start with the webhook

CRM API

A REST API for developers with API keys: send text, template, media and interactive messages, start flows, manage templates, and receive message events on your server.

Start with the API
Webhook AutomationCRM API
ForStore owners and no-code toolsDevelopers and CRM systems
DirectionYour system POSTs JSON to one URLYour code calls specific endpoints
AuthenticationA secret per webhookScoped API keys
Message typesApproved templates onlyText, template, media, interactive
Events to your serverNo; results appear in Webhook Logsmessage.received, message.sent, message.status, message.failed
Best forOrder confirmations, shipping updates, remindersCustom apps needing full control and delivery status

Before you start

  1. Create a ChatLike account and subscribe to a plan that includes WhatsApp. The CRM API requires an active WhatsApp subscription; otherwise it returns 403 subscription_required.
  2. Connect your WhatsApp Business number from the Connect page in the dashboard.
  3. Create the message templates you will use and wait for Meta approval. Templates are the only way to message a customer who has not messaged you in the last 24 hours.
  4. Write phone numbers in full international format with the country code, such as 201001234567. Spaces and symbols are removed automatically, but the country code is not added for you.
Keep webhook secrets and API keys in server-side environment variables. Never put them in code that runs in a browser or that customers can access.

Webhook Automation

In the dashboard, go to WhatsApp → Webhook Automation → Manage Webhooks and create a webhook with a descriptive name. You get a unique URL and a secret. Then link it to an approved template under Automation rules.

The request

POSThttps://app.chatlike.net/whatsapp_cloud/incoming_webhook/{webhook_token}
  • Body: raw JSON with the header Content-Type: application/json.
  • Authentication: send the secret in the X-Webhook-Secret header (recommended), or in Authorization: Bearer.
  • The JSON can contain any fields; your rule decides which fields are used.

How the request is processed

  1. The server checks the secret, then that the body is valid JSON.
  2. Every active rule linked to the webhook runs, oldest first. There are no conditions between rules, so three rules mean three messages. Use a separate webhook for each event type (new order, shipped…).
  3. Each rule reads the customer phone from the phone path you set; if missing, it tries phone, then customer.phone.
  4. Template variables {{1}}, {{2}}… are filled from JSON paths in order. Use dot paths such as order.id, and [0] for list items, such as order.items[0].name.
  5. The template is sent, and every run is recorded on the Webhook Logs page with the received payload and the Meta response.
If a variable path is missing from the JSON, that variable is sent empty and Meta usually rejects the message. Make sure every mapped field is always present.

Connecting platforms

  • Zapier / Make / n8n: use an HTTP or “Webhooks: POST” action with JSON, and add the X-Webhook-Secret header.
  • WooCommerce and Shopify: their built-in webhooks cannot add a custom header; route the order through Zapier, Make, n8n or a small relay server that adds the header. The phone is usually at billing.phone in WooCommerce, and customer.phone or shipping_address.phone in Shopify.
  • Custom backend: send the request from your server as in the examples below.

Full example: order confirmation

1 The JSON your store sends

JSON
{
  "event": "order.created",
  "customer": {
    "name": "Ahmed",
    "phone": "+20 100 123 4567"
  },
  "order": {
    "id": "1042",
    "total": "79.90 EGP",
    "items": [ { "name": "Blue T-shirt", "qty": 2 } ]
  }
}

2 The approved template

A Utility template named order_confirmation in en_US:

Template body
Hi {{1}}, your order #{{2}} ({{3}}) is confirmed. Thank you!

3 The automation rule

Phone pathcustomer.phone
Templateorder_confirmation · en_US
{{1}}customer.name
{{2}}order.id
{{3}}order.total

4 Send the request

cURL
curl -X POST "https://app.chatlike.net/whatsapp_cloud/incoming_webhook/{webhook_token}" \
  -H "Content-Type: application/json" \
  -H "X-Webhook-Secret: YOUR_WEBHOOK_SECRET" \
  -d '{"event":"order.created","customer":{"name":"Ahmed","phone":"+20 100 123 4567"},"order":{"id":"1042","total":"79.90 EGP"}}'

5 The result

The phone becomes 201001234567 and the customer receives:

Hi Ahmed, your order #1042 (79.90 EGP) is confirmed. Thank you!

The URL replies with 200:

JSON
{
  "success": true,
  "message": "Processed webhook.",
  "sent": 1,
  "failed": 0,
  "errors": []
}

Responses & errors

sent is the number of messages Meta accepted, failed the number of failed rules, and errors their details. Full details of every attempt are on the Webhook Logs page.

CodeMeaningFix
200Processed. If no rule is active, the request is logged as “Skipped” and nothing is sent.Check sent and errors.
400Invalid JSON, or the URL token is missing.Send raw JSON with Content-Type: application/json.
403The secret is missing, wrong, or was regenerated.Copy the current secret from Manage Webhooks.
404Wrong URL, or the webhook is inactive or deleted.Copy the URL again and make sure it is active.
503The WhatsApp number linked to the webhook is not connected.Reconnect the number in the dashboard.

Per-rule errors appear in errors with a 200 response. Common ones: phone not found in the payload, a template that is not approved or uses a different language, a variable count that does not match the template, or a recipient not allowed on a Meta test number.

This feature only sends approved templates, which can be sent at any time, so the 24-hour window never affects webhook messages.

CRM API

Create an API key in the dashboard under WhatsApp → CRM API. The key is shown only once when created, so copy it and store it securely. When you create it, you choose:

  • Scopes: read, send, templates, flows, contacts, webhooks. Give each system only what it needs.
  • Allowed IPs (optional): exact addresses or CIDR ranges.
  • WhatsApp account (optional): to bind the key to one number; you can then omit account_id from requests.

Base URL and headers

BASEhttps://app.chatlike.net/crm_api/v1
Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Idempotency-Key: order-1042-confirmation
  • Authorization: Bearer is required on every request.
  • Idempotency-Key: send a stable, unique value with every POST. Retrying with the same value returns the original response without a duplicate send; reusing it with a different body returns 409 idempotency_conflict.
  • Every response is JSON: {"success", "status", "data"} on success, or {"success": false, "status", "error": {"code", "message"}} on error.

Endpoints

ScopeRequestPurpose
readGET /accountsYour WhatsApp numbers and their IDs
readGET /conversationsList conversations
readGET /conversations/{contact_id}/messagesMessages in a conversation
readGET /eventsPoll new events instead of receiving them
readGET /media/{media_id}Download inbound message media
sendPOST /messages/textText message (inside the 24-hour window)
sendPOST /messages/templateApproved template (any time)
sendPOST /messages/mediaImage, video, document or audio
sendPOST /messages/interactiveMessage with buttons
templatesGET /templates · POST /templatesList templates or submit a new one for approval
templatesGET|PUT /templates/{name}/actionsWhat each quick-reply button does: plain reply, start a flow, or stop marketing messages
flowsGET /flows · GET /flows/{id}List and read flows
flowsPOST /flows/import · POST /flows/{id}/updateImport or update a flow
flowsPOST /flows/{id}/startStart a flow for a customer
contactsPOST /contacts/{contact_id}/pause_bot · resume_botPause or resume the bot for a contact
webhooksGET|POST /webhooks · DELETE /webhooks/{id} · POST /webhooks/{id}/testManage outbound events to your server

Sending messages

Text, media and interactive messages need an open customer service window (the customer messaged you in the last 24 hours). Outside it the API returns 409 session_closed; send an approved template instead.

Text message

cURL
curl -X POST "https://app.chatlike.net/crm_api/v1/messages/text" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: reply-7781" \
  -d '{"account_id": 1, "to": "201001234567", "message": "Hello Ahmed, how can we help?"}'

Approved template

body_variables fill {{1}}, {{2}}… in order.

JSON
POST https://app.chatlike.net/crm_api/v1/messages/template
{
  "account_id": 1,
  "to": "201001234567",
  "template_name": "order_confirmation",
  "language": "en_US",
  "body_variables": ["Ahmed", "1042", "79.90 EGP"]
}

Media

media_type: image, video, document, audio or sticker. Use a public https link; add filename for documents.

JSON
POST https://app.chatlike.net/crm_api/v1/messages/media
{
  "account_id": 1,
  "to": "201001234567",
  "media_type": "image",
  "media_url": "https://example.com/invoice-1042.jpg",
  "caption": "Your invoice"
}

Interactive buttons

JSON
POST https://app.chatlike.net/crm_api/v1/messages/interactive
{
  "account_id": 1,
  "to": "201001234567",
  "body": "How would you like to continue?",
  "buttons": [
    {"id": "track", "title": "Track order"},
    {"id": "support", "title": "Talk to support"}
  ]
}

Start a flow

JSON
POST https://app.chatlike.net/crm_api/v1/flows/{flow_id}/start
{
  "account_id": 1,
  "to": "201001234567",
  "text": "start"
}

Response format

Success
HTTP/1.1 201 Created
{
  "success": true,
  "status": 201,
  "data": {
    "account_id": 1,
    "message_id": "wamid.HBgM...",
    "local_message_id": 5521,
    "to": "201001234567",
    "type": "text"
  }
}

API errors

Error example
HTTP/1.1 409 Conflict
{
  "success": false,
  "status": 409,
  "error": {
    "code": "session_closed",
    "message": "24-hour customer service window is closed. Send a template instead."
  }
}
Statuserror.codeMeaning
401unauthorizedMissing, invalid or revoked API key.
403forbiddenThe key lacks the required scope.
403ip_not_allowedYour IP is not allowed for this key.
403subscription_requiredNo active WhatsApp subscription.
403forbidden_accountThe key is bound to a different WhatsApp account.
404account_not_foundWrong account_id.
409session_closed24-hour window closed; send a template.
409not_connected · account_pausedThe number is disconnected or paused.
409idempotency_conflictIdempotency-Key reused with a different request.
422invalid_requestRequired fields are missing or invalid.
502meta_api_errorMeta rejected the send (template not approved, invalid number…). The original Meta message is in error.message.

Outbound events to your server

Add your server URL on the CRM API page or with POST /webhooks, and choose the events you want. The signing secret is shown only once when created.

EventWhen it is sent
message.receivedA new message from a customer. Includes Click-to-WhatsApp ad data in referral when available.
message.sentA message was sent from your account.
message.statusA message status changed (delivered, read…). Sent only if you select it explicitly.
message.failedA message failed to deliver.
flow.startedA flow started for a customer.
webhook.testA test event from the Test action.
Example request
POST https://your-server.example/whatsapp-events
Content-Type: application/json
X-CRM-API-Event: message.received
X-CRM-API-Signature: sha256=5f2b9c...

{
  "event": "message.received",
  "created_at": "2026-11-27T10:15:00+02:00",
  "account_id": 1,
  "data": {
    "message": {
      "wa_id": "201001234567",
      "direction": "in",
      "type": "text",
      "body": "Where is my order?"
    }
  }
}

Verifying the signature

Every request carries X-CRM-API-Signature: sha256=<HMAC-SHA256> computed over the raw body with your secret. Compute it over the bytes exactly as received, compare in constant time, and reject the request if it differs.

Node.js
import crypto from "node:crypto";

// rawBody must be the exact bytes received (not re-serialized JSON)
function isValid(rawBody, signatureHeader, secret) {
  const expected = "sha256=" +
    crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected), b = Buffer.from(signatureHeader || "");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}
  • Return a 2xx within 8 seconds, then process the event in the background if it takes longer.
  • Failed attempts and your server responses appear under Webhook Deliveries on the CRM API page.
  • If you have no public URL, poll events with GET /events.

FAQ

Do I need a subscription to use the API?

Yes. You need a ChatLike account and a connected WhatsApp number, and the CRM API requires an active WhatsApp subscription. Meta message fees are separate from the subscription. Estimate message fees

Which should I choose: Webhook Automation or the CRM API?

If you only need to send a fixed template when something happens in your store, the webhook is faster and needs no code. If you need free text, media, reading conversations or delivery status, use the CRM API.

Can I message a customer who never messaged me?

Yes, with an approved template only, and only after the customer has agreed to receive your WhatsApp messages under Meta policies.

What happens if I regenerate the webhook secret?

The old secret stops working immediately, and every integration that uses it gets 403 until it is updated with the new one.

Where can I see request logs?

Webhook requests are on Webhook Logs; CRM API requests and outbound event deliveries are on the CRM API page in the dashboard.

Ready to integrate?

Create your account, connect a WhatsApp number, and get your webhook URL or API key from the dashboard.