Documentation

Guides & API

One live flow per account, templates, and the messaging API.

Flow maker

One live flow per account. Open Flow Maker ↗ for a full-window chart: drag blocks, connect ports, zoom, save. New chats always begin at Start. Optional trigger words on any block jump straight to that block when the user types one of them.

  • start — entry (one per flow)
  • message — send text, then continue
  • buttons — interactive reply (max 3); each reply has an orange port on the board to wire the next step
  • List menu — WhatsApp list (up to 10 rows); each row has an orange port
  • image / video / document — media (document uses a public HTTPS file URL)
  • Ask location — native “Send location” button; saves lat/lng
  • WhatsApp Flow — opens a published Meta Flow (forms, DatePicker, multi-screen UI). Date pickers are not a separate message type — build them inside a Flow in Meta, then paste the Flow ID here
  • input — ask and store the reply (unique field name per question)
  • condition — branch on match text
  • Submit to API — POST selected saved inputs (+ contact) to a per-flow HTTPS CRM URL, then continue
  • AI Agent — BYO AI replies, jumps to a labeled block, or fire_api to a labeled API block
  • Transfer to agent — stop the bot and hand the chat to your team (see below)
  • end — stop this path

Typical CRM path: Ask input (name) → Ask input (email) → … → Submit to API → thank-you Message. Turn on Send API response text to WhatsApp if your CRM returns a message to show the customer. Each flow can use a different API URL. Details: Documentation → CRM API.

Catalog / multi-product / address messages need a Meta Commerce catalog (or address API) tied to your WhatsApp account — not available as generic Flow Maker blocks yet. Carousel covers product browse with image + website buttons without a catalog.

Pan with Space or middle-mouse. Zoom with − / + or scroll. Connect from each button’s orange port — not from a single default out.

AI Agent (bring your own key)

Connect your OpenAI, Claude, Gemini, or a custom webhook. WB by TD never hosts the model — your account pays the AI provider. The bot still runs on Flow Maker; AI only decides what to say or which block to open.

1. Connect the provider

  1. Open AI Agent in the dashboard sidebar.
  2. Pick a provider: OpenAI (or OpenAI-compatible), Anthropic, Gemini, or Custom webhook.
  3. Paste your API key (encrypted at rest). For custom webhooks, set the HTTPS URL instead.
  4. Write business instructions — tone, FAQs, and which Flow Maker block ids to use for each topic.
  5. Turn on Enable AI, Save, then use Run test with a sample question.

2. Add an AI block in Flow Maker

  1. Drag an AI Agent block onto the board.
  2. Connect Start (or a button / message) into that AI block.
  3. In the block properties, write extra instructions (e.g. “pricing → goto message_pricing”).
  4. Optional intro message is only sent when the block is entered with no customer text yet.
  5. Copy each target block’s ID from the properties panel (shown under the type label).
  6. Save the flow.

3. How the AI responds

On every customer message while the chat is on the AI block, we call your provider and expect JSON only:

{"action":"reply","text":"Short WhatsApp answer"}
{"action":"goto_block","block_id":"message_pricing","text":"Here are our plans:"}
{"action":"fire_api","block_label":"Submit Lead","text":"Thanks — our team will call you.","fields":{"name":"Ravi","phone":"91…","summary":"Wants premium plan"}}
{"action":"transfer_agent","text":"Connecting you to a teammate…"}
  • reply — send free text and stay on the AI block for follow-ups.
  • goto_block — jump to that Flow Maker node id (message, buttons, carousel, api, transfer, end, …). Invented ids are ignored.
  • fire_api — POST to a labeled Submit to API block in this flow (never invents a URL). Put lead values in fields; stay on AI afterward.
  • transfer_agent — follow the AI block’s out connection if it leads to Transfer, otherwise put the chat in the waiting queue.

4. Example instructions

You are the WhatsApp assistant for Acme Realty.
Be brief and friendly. Never invent prices.
If they ask about pricing or packages → goto_block message_pricing
If they ask for a site visit / booking → goto_block buttons_booking
If they say refund, complaint, or angry → transfer_agent
For everything else, reply in 1–3 short sentences.

5. Trainer fallback for unknown questions

On AI Agent, pick an approved WhatsApp template and enter the body variable name that should receive the customer’s question. That name can be anything you defined in Meta (examples: question, que). It is not a required identifier.

  1. When the model cannot answer, it uses action ask_trainer.
  2. The trainer receives the template (question filled into your chosen variable) plus a request code.
  3. Reply with that code and the answer. The customer gets the answer, and the AI is taught it for next time.

Full steps: Documentation → Unknown-question fallback.

6. Custom webhook

We POST JSON including incoming, history, blocks (id / type / label), and subscriber details. Respond with the same action JSON above. Optional API key is sent as Authorization: Bearer and X-Api-Key.

Tip: keep prepared answers in normal Message / Buttons blocks and let AI only route. That stays WhatsApp-safe and easy to edit without re-prompting the model.

Transfer to live agent

Use the Transfer to agent block when the bot should stop and a human should continue the WhatsApp chat.

From a Buttons block

  1. On your Buttons block, add a Reply button (e.g. title Talk to agent, id talk_agent).
  2. Drag a Transfer to agent block onto the board.
  3. From that reply’s orange port, drag a line into the Transfer block’s left (in) port.
  4. On Transfer, choose Assign to (queue or a specific agent) and optional handoff message.
  5. Wire Start → Buttons, and other buttons’ orange ports to whatever should happen next (message, end, etc.). Save — auto-save also runs.

When the customer taps that reply button, WhatsApp returns the button id; the flow follows that orange connection and runs Transfer (bot stops for that chat).

Setup checklist

  1. Add agents under Dashboard → Agents (invite by email). They log in with OTP like you do.
  2. In Flow Maker, connect a path into a Transfer to agent block.
  3. In properties, set Assign to:
    • Waiting queue (any agent) — chat appears in Inbox as waiting; assign manually
    • A specific agent — chat is assigned to that agent immediately and shows in their My live chats
  4. Optional Handoff message is sent to the customer (default text is used if empty).

After transfer, the bot no longer answers that conversation until the agent clicks End chat → bot in their live chat window.

After the agent ends the chat

  1. Connect the green out port on Transfer to agent → your next bot block (message, buttons, end, etc.).
  2. When the agent ends the chat, a closing note is sent to the customer and the flow continues on that connection.
  3. If nothing is connected after Transfer, the chat returns to bot mode and waits for the next customer message from Start / triggers.

Agents use a live chat screen (polls for new WhatsApp messages; sending does not reload the page).

Tip: put trigger words like agent, human, or support on the Transfer block so customers can jump straight to a person without a button.

Buttons setup

WhatsApp session messages allow up to 3 buttons, mixed as:

  • Up to 2 Websites (URL)
  • Up to 1 Call Number
  • Up to 1 WhatsApp Call
  • Up to 3 Quick Replies

Any combination is fine as long as those caps and the total of 3 are respected. Reply / Connect flow buttons get orange ports on the board.

WhatsApp Cloud API still sends one interactive type per bubble, so mixed types (for example Reply + Website) go out as a follow-up message. Call Number is sent as a tappable phone line (template PHONE_NUMBER buttons are templates only).

Image & video

  • Image — JPG/PNG/WebP, max 5 MB
  • Video — MP4/3GP, max 16 MB
  • With reply buttons: media is the interactive message header; set body + optional footer the same as a buttons block
  • Without buttons: sends as a normal image/video with caption

Templates

Create with body text, optional text/image header, footer, and buttons (quick reply, URL, call). Name: lowercase + underscores.

Sync from WhatsApp pulls templates from your WABA. Submit to WhatsApp sends a draft for Meta review.

For APPROVED templates, use View to see a demo with dummy variables and a ready-to-copy curl for POST /api/v1/messages/template.

Sending a template auto-subscribes the number if needed. Invalid / non-WhatsApp / failed numbers move to Invalid numbers and are skipped by campaigns and the API until you delete them from that list.

API

Base URL: https://wb.thedhwalin.com/api/v1

Authentication

Authorization: Bearer YOUR_TOKEN — create tokens under Dashboard → API Tokens.

Send a template message

POST /messages/template

If to is not a subscriber yet, it is subscribed first. Numbers on the invalid list return 422 and are not messaged.

{
  "to": "919876543210",
  "template_name": "order_update",
  "language": "en",
  "components": []
}

List subscribers

GET /subscribers

Website widget

Add a floating Chat on WhatsApp button to any website. Visitors open WhatsApp with a prefilled message; your Flow Maker / AI bot replies on the connected number. This is click-to-chat (not an in-page WhatsApp iframe).

  1. Dashboard → Website widget — set greeting, label, color, position.
  2. Copy the one-line <script> snippet onto your site before </body>.
  3. Keep WhatsApp connected with a display phone number.

Details: Documentation → Website widget.

Meta Pixel, Conversion API & Google Tag

Set values in the server .env, then restart PHP / clear config cache. Leave blank to disable that tag.

  1. META_PIXEL_ID — Meta Events Manager → Data sources → Pixel → copy Pixel ID.
  2. META_CAPI_ACCESS_TOKEN — same Pixel → Settings → Generate access token (Conversions API).
  3. META_CAPI_TEST_EVENT_CODE (optional) — Test events tab while verifying; remove in production.
  4. GOOGLE_TAG_ID — GA4 Admin → Data streams → Web → Measurement ID (G-…).
  5. GOOGLE_ADS_ID (optional) — Google Ads → Goals → Conversions → tag setup (AW-…).
  6. GOOGLE_ADS_SIGNUP_LABEL / GOOGLE_ADS_PURCHASE_LABEL (optional) — conversion label after the slash in AW-xxx/label.

Events fired automatically: PageView on public + app pages; CompleteRegistration / sign_up after OTP register; Purchase / purchase after successful Razorpay payment (Pixel + CAPI deduped by event_id).