Webbai / Docs / Webbai API reference

Webbai API reference

The Webbai API lets your own software send WhatsApp messages from your business number, receive every incoming message (including voice notes, photos and files) as a signed webhook, add leads and start automations. It uses the official WhatsApp Business API; Webbai handles the Meta side.

Base URL: https://webbai.nl

Authentication

Every request needs your API key as a Bearer token:

Authorization: Bearer <your API key>

Find the key in the dashboard under Settings → API Key. If the field is empty, click Regenerate key once: from then on the dashboard can show and copy it. Regenerating invalidates the previous key immediately.

The key gives full access to your Webbai account. Keep it on your server; never put it in a browser, mobile app or public repository. A missing or wrong key returns 401 with {"error": "Not authenticated"}.

Conventions

The 24-hour window

WhatsApp only allows free-form messages within 24 hours after the customer's last message to you. Outside that window you must send an approved template. Webbai checks this for you:

Customers who replied STOP are marked as opted out. Webbai won't send them messages from the inbox, automations or /api/conversations/.../send and .../send-template.

Send a message

Reply with free text

POST /api/conversations/{contact_id}/send

Sends immediately, within the 24-hour window.

curl -X POST https://webbai.nl/api/conversations/CONTACT_ID/send \
  -H "Authorization: Bearer $WEBBAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "Thanks! We will call you back today."}'
FieldTypeRequired
messagestringyesThe text to send

Response:

{ "success": true, "message_id": "wamid.HBgL..." }

Errors (HTTP 200 with error): message is required, Contact not found, contact opted out, daily send limit reached, or Outside 24h messaging window. Use a template instead. with "require_template": true.

Send a template to a contact

POST /api/conversations/{contact_id}/send-template

FieldTypeRequired
template_namestringyesName of an approved template
language_codestringnoTemplate language, e.g. nl or en. Default en
variablesstring[]noValues for {{1}}, {{2}}, … in order
header_media_urlstringnoPublic URL for templates with an image, video or document header

Response: { "success": true, "message_id": "wamid..." }. If the variables don't fit the template you get { "success": false, "code": "template_components_incomplete", "error": "..." }.

Send a template to a phone number

POST /api/send-template

For people who aren't a contact yet, e.g. the first message after a form on your website. The contact is created after a successful send.

curl -X POST https://webbai.nl/api/send-template \
  -H "Authorization: Bearer $WEBBAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+31612345678",
    "template_name": "order_ready",
    "language_code": "nl",
    "variables": ["Sanne", "A-1042"],
    "contact_name": "Sanne de Vries"
  }'
FieldTypeRequired
phonestringyesRecipient
template_namestringyesApproved template
language_codestringnoDefault en
variablesstring[]noTemplate variables in order
contact_namestringnoName for the new contact
header_media_urlstringnoMedia header URL

Response: { "success": true, "message_id": "wamid...", "contact_id": "..." }

Only message people who gave you permission. Check your own opt-out list before using this endpoint.

Conversations and contacts

List conversations

GET /api/conversations

Returns the 50 most recently active contacts, newest first.

{
  "conversations": [{
    "id": "c1f0…", "name": "Sanne", "phone": "31612345678", "email": null,
    "source": "whatsapp", "status": "contacted", "type": "conversation",
    "last_message": "🎤 Spraakbericht", "last_activity": "2026-11-17 09:41:02",
    "unread_count": 1, "tags": [], "opted_out_at": null
  }]
}

Conversation history

GET /api/conversations/{contact_id}/timeline

{
  "contact": { "id": "c1f0…", "name": "Sanne", "phone": "31612345678", "opted_out_at": null },
  "can_send_freeform": true,
  "timeline": [
    { "type": "message", "direction": "in", "text": "Are you open on Saturday?", "time": "2026-11-17 09:40:11" },
    { "type": "message", "direction": "in", "text": "🎤 Spraakbericht", "time": "2026-11-17 09:41:02",
      "media": { "type": "audio", "media_id": "1234567890", "mime_type": "audio/ogg; codecs=opus", "voice": true } },
    { "type": "message", "direction": "out", "text": "Yes, 8:00 to 16:00!", "status": "read", "time": "2026-11-17 09:42:30" }
  ]
}

can_send_freeform tells you whether the 24-hour window is open. Reading the timeline marks the incoming messages as read in the dashboard. Download media with GET /media/{media_id}.

Opt a contact out or back in

POST /api/conversations/{contact_id}/unsubscribe stops all messages to this contact and cancels their pending automation steps. Response: { "success": true, "opted_out": true, "flows_cancelled": 2 }.

POST /api/conversations/{contact_id}/resubscribe undoes it (cancelled steps are not restarted). Both return 404 for an unknown contact.

Leads and automations

Add a lead

POST /webhook/inbound/generic

Use this from forms, landing pages, Zapier/Make/n8n or your CRM. The contact is created or updated by phone number, and every automation for new leads starts, such as a welcome template.

curl -X POST https://webbai.nl/webhook/inbound/generic \
  -H "Authorization: Bearer $WEBBAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+31612345678",
    "name": "Sanne de Vries",
    "email": "sanne@example.com",
    "source": "website",
    "metadata": { "form": "offerte", "product": "kitchen" }
  }'
FieldTypeRequired
phonestringyes
name, email, companystringnoFilled in on the contact if empty
sourcestringnoDefault generic. Automations can filter on it
event_typestringnoDefault new_lead
metadataobjectnoStored on the contact

Response: { "success": true, "contact_id": "...", "lead_id": "..." }. Errors: 400 without phone, 401 for an invalid key.

POST /api/leads/manual does the same with phone, name, email, company, source, notes and fire_automations (default true), and returns automations_fired.

List leads

GET /api/leads returns the 100 newest leads plus stats. Filter with ?tags=vip,hot (any of the tags).

Start an automation for a contact

POST /api/flows/{flow_id}/trigger

Starts a flow whose trigger is Manual in the dashboard. flow_id is the id from GET /api/flows.

curl -X POST https://webbai.nl/api/flows/Offerte%20opvolging/trigger \
  -H "Authorization: Bearer $WEBBAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "+31612345678", "name": "Sanne", "metadata": {"quote_id": "Q-88"}}'

Response: { "success": true, "contact_id": "...", "steps_queued": 3, "steps": [...] }. Steps are queued with their delays; opt-outs and send limits are checked when each step is sent. Errors: 404 flow not found or inactive, 400 flow not set to manual.

Templates

MethodPath
GET/api/templatesYour templates and their Meta status (APPROVED, PENDING, REJECTED)
POST/api/templatesCreate a template and submit it to Meta
PATCH/api/templates/{name}Edit and resubmit
DELETE/api/templates/{name}Delete (all languages)

Create:

{
  "name": "order_ready",
  "category": "UTILITY",
  "language": "nl",
  "body_text": "Hoi {{1}}, je bestelling {{2}} ligt klaar!",
  "body_examples": ["Sanne", "A-1042"],
  "footer_text": "Bar Company",
  "buttons": ["Thanks!", { "type": "URL", "text": "Track", "url": "https://example.com/track" }]
}

Rules: name uses lowercase letters, digits and _. Every {{n}} needs an example. At most 3 buttons of 25 characters. Footer up to 60 characters, without variables. Meta usually reviews within minutes to a few hours. With an event webhook you get a template.status event when it's decided.

Event webhooks

Webbai POSTs every WhatsApp event to your URL as JSON: incoming messages (including voice notes, photos and files), delivery status, messages you send from the WhatsApp Business app, and template decisions.

Set up

In the dashboard under Settings → Event webhook, or with the API:

curl -X PUT https://webbai.nl/api/webhooks \
  -H "Authorization: Bearer $WEBBAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://your-app.com/webbai", "events": ["message.received", "message.status"]}'

The response contains secret (starts with whsec_) only when the webhook is created. Store it; you need it to verify requests.

MethodPath
GET/api/webhooksConfiguration and the 50 most recent deliveries
PUT/api/webhooksCreate or update: url (https), events, active
DELETE/api/webhooksStop forwarding
POST/api/webhooks/testSend a webhook.test event now and return your server's answer
POST/api/webhooks/reveal-secretShow the signing secret
POST/api/webhooks/rotate-secretNew secret; the old one stops working
GET/api/webhooks/deliveriesDelivery log
GET/api/webhooks/deliveries/{id}One delivery, with the full payload
POST/api/webhooks/deliveries/{id}/replaySend a delivery again

Events

EventWhen
message.receivedA customer sent you something: text, voice note, photo, video, document, sticker, location, contact card, reaction, button or list reply
message.statusA message you sent was sent, delivered, read or failed
message.echoYou sent a message from the WhatsApp Business app on your phone
template.statusMeta approved or rejected a template
webhook.testYou pressed "Send test event"

Payload

Each request is one event:

{
  "id": "evt_8c2f…",
  "type": "message.received",
  "created_at": "2026-11-17T09:41:03.120Z",
  "number": "+31612344821",
  "contact_id": "c1f0…",
  "from": { "phone": "+31687654321", "name": "Sanne" },
  "message": {
    "id": "wamid.HBgL…",
    "type": "audio",
    "timestamp": "2026-11-17T09:41:02.000Z",
    "text": null,
    "media": {
      "id": "1234567890",
      "mime_type": "audio/ogg; codecs=opus",
      "voice": true,
      "url": "https://webbai.nl/media/1234567890?c=…&exp=…&sig=…",
      "url_expires_at": "2026-11-24T09:41:03.000Z"
    },
    "raw": { }
  },
  "window_open_until": "2026-11-18T09:41:02.000Z"
}

A message.status event:

{
  "id": "evt_…", "type": "message.status", "number": "+31612344821",
  "message": { "id": "wamid…", "status": "delivered", "to": "+31687654321", "timestamp": "…", "errors": null }
}

Verify the signature

Every request has these headers:

X-Webbai-Event: message.received
X-Webbai-Delivery: evt_8c2f…
X-Webbai-Timestamp: 1794908463
X-Webbai-Signature: sha256=5b0e…

The signature is an HMAC-SHA256, with your webhook secret, of the timestamp, a dot and the raw request body. Compare in constant time and reject old timestamps:

import crypto from 'node:crypto';

function verifyWebbai(rawBody, headers, secret) {
  const ts = headers['x-webbai-timestamp'];
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
  const got = headers['x-webbai-signature'] || '';
  return got.length === expected.length && crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected));
}
import hmac, hashlib, time

def verify_webbai(raw_body: bytes, headers, secret: str) -> bool:
    ts = headers["X-Webbai-Timestamp"]
    if abs(time.time() - int(ts)) > 300:
        return False
    expected = "sha256=" + hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, headers.get("X-Webbai-Signature", ""))

Delivery and retries

Media

GET /media/{media_id}

Downloads a voice note, photo, video or document a customer sent you. Two ways to authenticate:

The response is the file itself with its Content-Type, e.g. audio/ogg for voice notes. WhatsApp keeps media for about 30 days; after that you get 404, so store files you need.

MCP for AI agents

The same account is available as an MCP server for Claude, ChatGPT, Cursor and other agents:

https://webbai.nl/mcp

It uses streamable HTTP and OAuth sign-in in the browser. Claude Code can also authenticate with the API key:

claude mcp add --transport http webbai https://webbai.nl/mcp --header "Authorization: Bearer $WEBBAI_API_KEY"

Main tools: get_inbound_messages, send_whatsapp_message, send_whatsapp_template, list_whatsapp_templates, create_whatsapp_template, get_send_logs, search_contacts, get_leads, send_bulk_template and list_automations. Step-by-step instructions for agents: /agents.md.

Limits

API requests100 per minute per IP
Free-form messages per dayDepends on your plan, see Settings
Messages per hour80
Webhook timeout10 seconds
Signed media URL7 days

Meta charges separately for templates outside the 24-hour window. You pay those costs directly to Meta.

Support

Questions or something not working? Email support from the dashboard (Settings → Contact), and include the X-Webbai-Delivery id or the message_id you're asking about.

Last reviewed: 2026-11-17 · Markdown · llms.txt