← Blog

·

Flowise + official WhatsApp Business API: an AI chatbot

Updated on November 24, 2026

To connect Flowise to WhatsApp through the official API, you put a bridge between the two: it receives Meta’s webhook, calls the Flowise Prediction API (POST /api/v1/prediction/{id}) with the customer’s question and one sessionId per number, and sends the text field of the response through the WhatsApp messages endpoint. Flowise handles the AI flow and the memory; the bridge handles the WhatsApp protocol. With a Flowise API key and the right sessionId, every customer gets their own conversation.

This guide covers the Prediction API fields that matter for WhatsApp, how to protect the chatflow, how to separate memory by number, the full bridge code in Node.js, and what to watch out for with audio, latency and Meta’s rules.

What Flowise exposes through its API

Flowise is a visual tool for building chatflows and agentflows with language models, tools and knowledge bases. To integrate it with another system, you use the Prediction API. We found no native WhatsApp integration in the indexes of the official Flowise documentation, which is why the webhook bridge is needed.

The endpoint is POST /api/v1/prediction/{id}, where id is the flow ID. The body fields, according to the API reference:

FieldUse for WhatsApp
questionThe text the customer sent
overrideConfigRuntime settings; this is where sessionId goes
historyHistory you send yourself, with role set to userMessage or apiMessage
uploadsImages, audio or files, as base64 or URL
streamingfalse for WhatsApp, which only sends the finished reply
formAlternative to question in Agentflow V2

The response includes text (the model’s answer), chatId, chatMessageId, sessionId and, depending on the flow, sourceDocuments and usedTools. For WhatsApp, you use text. The documentation examples use http://localhost:3000 as the base, the default port of a local install; in production, use the public URL of your instance.

Protect the chatflow with an API key

This deserves attention before any code. The chatflow-level authorization page states that flows are public by default: anyone with the chatflow ID can run predictions through the API or the embed.

To lock it down:

  1. In the Flowise dashboard, open API Keys. There is a DefaultKey, and you can create more.
  2. Create a key just for the WhatsApp bridge.
  3. In the chatflow, select that key in the authorization settings.
  4. In the bridge, send Authorization: Bearer <key> on every call.

Without the key, the API returns 401. With one key per integration, you can revoke one without breaking the others.

Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →

Per-number memory with sessionId

WhatsApp delivers messages from many customers to the same webhook. If they all go to the same chatflow without separation, one customer “inherits” another’s conversation. The documented fix is sessionId.

According to the memory documentation, every memory node has a Session ID parameter, and in the Prediction API you separate conversations by sending a unique sessionId inside overrideConfig:

{
  "question": "Do you deliver to Natal?",
  "overrideConfig": {
    "sessionId": "wa:5584999999999"
  }
}

The session management section of the Prediction API confirms that each session keeps its own context and memory. Two things to watch:

  • Override is off by default. The documentation says configuration override is disabled for security and is enabled under Settings → Configuration → Security. If sessionId isn’t separating conversations, check this setting.
  • Starting over. To reset the context, for example after a support case is closed, change the sessionId (such as wa:5584999999999:2026-11-24). The documentation also describes a Message API (GET and DELETE /api/v1/chatmessage/{id}, filterable by sessionId) to look up or delete the history.

If you’d rather keep the history in your own database and leave Flowise stateless, send the latest messages in the history field on each call. That gives you more control over what the model sees and makes it easier to delete data when a customer asks.

Bridge architecture

  1. Meta (or your provider) sends the webhook to the bridge.
  2. The bridge validates the source and replies 200 immediately.
  3. In the background, it ignores statuses and repeated messages, builds the sessionId from the number and calls the Prediction API.
  4. It sends the text of the response through the messages endpoint.
  5. On error or when the customer asks for an agent, it sends a handover message and alerts the team.

Replying 200 before calling Flowise is mandatory in practice: models with tools and document search can take several seconds, and slow webhooks get resent, which produces duplicate replies.

Bridge code in Node.js

Node 18 or later (it uses native fetch) and Express. The bridge accepts the webhook straight from Meta (validating X-Hub-Signature-256) or forwarded by a provider (validating a key in the URL).

import express from "express";
import crypto from "node:crypto";

const {
  FLOWISE_URL,
  FLOWISE_FLOW_ID,
  FLOWISE_API_KEY,
  WA_SEND_URL,
  WA_TOKEN,
  VERIFY_TOKEN,
  META_APP_SECRET,
  WEBHOOK_KEY,
} = process.env;

const app = express();
app.use(express.json({ verify: (req, _res, buf) => { req.rawBody = buf; } }));
const processed = new Set(); // use Redis with expiration in production

app.get("/webhook", (req, res) => {
  if (req.query["hub.mode"] === "subscribe" && req.query["hub.verify_token"] === VERIFY_TOKEN) {
    return res.type("text/plain").send(req.query["hub.challenge"]);
  }
  res.sendStatus(403);
});

function isValidSource(req) {
  if (META_APP_SECRET) {
    const expected = Buffer.from(
      "sha256=" + crypto.createHmac("sha256", META_APP_SECRET).update(req.rawBody).digest("hex")
    );
    const received = Buffer.from(req.get("x-hub-signature-256") || "");
    return expected.length === received.length && crypto.timingSafeEqual(expected, received);
  }
  return Boolean(WEBHOOK_KEY) && req.query.key === WEBHOOK_KEY;
}

app.post("/webhook", (req, res) => {
  if (!isValidSource(req)) return res.sendStatus(401);
  res.sendStatus(200);

  const messages = (req.body.entry || [])
    .flatMap((entry) => entry.changes || [])
    .flatMap((change) => (change.value && change.value.messages) || []);

  for (const msg of messages) {
    if (processed.has(msg.id)) continue;
    processed.add(msg.id);
    if (msg.type === "text") {
      reply(msg.from, msg.text.body).catch((error) => console.error(error));
    }
  }
});

async function askFlowise(waId, text) {
  const response = await fetch(`${FLOWISE_URL}/api/v1/prediction/${FLOWISE_FLOW_ID}`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${FLOWISE_API_KEY}`,
    },
    body: JSON.stringify({
      question: text,
      streaming: false,
      overrideConfig: { sessionId: `wa:${waId}` },
    }),
    signal: AbortSignal.timeout(60000),
  });
  if (!response.ok) throw new Error(`Flowise returned ${response.status}`);
  const data = await response.json();
  return data.text;
}

async function sendWhatsApp(waId, text) {
  await fetch(WA_SEND_URL, {
    method: "POST",
    headers: { "Content-Type": "application/json", Authorization: `Bearer ${WA_TOKEN}` },
    body: JSON.stringify({
      messaging_product: "whatsapp",
      to: waId,
      type: "text",
      text: { body: text.slice(0, 4096) },
    }),
  });
}

async function reply(waId, text) {
  let answer;
  try {
    answer = await askFlowise(waId, text);
  } catch (error) {
    console.error(error);
    answer = "I ran into a problem answering right now. Someone from our team will take it from here.";
  }
  await sendWhatsApp(waId, answer);
}

app.listen(8080);

The variables in each scenario:

VariableDirect Cloud APIThrough Vectalk
WA_SEND_URLhttps://graph.facebook.com/v27.0/<PHONE_NUMBER_ID>/messageshttps://apis.vectalk.com.br/api/messages
WA_TOKENSystem user tokenVectalk instance token
ValidationMETA_APP_SECRETWEBHOOK_KEY in the registered URL
FLOWISE_URLPublic URL of your Flowise instanceSame

The bridge runs on port 8080 so it doesn’t clash with Flowise’s default port. A Node bot without AI, built from scratch, is in WhatsApp bot with Node.js, and event deduplication is covered in duplicate WhatsApp webhooks.

Audio, images and documents

The Prediction API accepts the uploads field. For audio, the documentation lists the types audio/mp4, audio/webm, audio/wav and audio/mpeg, with the content as base64 or a URL. According to the uploads page, transcription depends on a speech-to-text module chosen in the chatflow configuration (OpenAI, AssemblyAI or LocalAI). WhatsApp voice notes arrive as OGG with Opus, which isn’t on that list. Convert them to one of the accepted formats before sending, or transcribe outside Flowise and send the text in question. Downloading the media by its webhook ID is covered in transcribing WhatsApp voice messages.

For images, the same uploads field works when the model supports images and the Allow Image Upload option is on; the documentation warns that image processing only works with certain chains and agents. For PDFs the customer sends, consider whether it makes sense to pass the file to the model or just forward it to an agent.

If you also want the bot to reply with voice, the STT, model and TTS flow is in AI that replies with audio on WhatsApp.

Knowledge base and tools

Flowise’s strength is building, visually, everything between the question and the answer: a retriever over the company’s documents, tools that look up an order or a calendar, and rules in the prompt. For WhatsApp, three design decisions matter more than the model you pick:

  • Narrow scope. The prompt should say what the bot does and tell it to decline everything else. That improves service and keeps the bot within Meta’s policy.
  • Citable source. With a knowledge base, ask the model to answer only from what is in the documents and to say “I don’t know” when it can’t find it. The full design is in WhatsApp chatbot with a knowledge base (RAG).
  • Actions with confirmation. Tools that change data (cancelling an order, rescheduling) should ask the customer for explicit confirmation before running.

Meta’s rules and costs

24-hour window. Free-form replies are only allowed inside the customer service window, which opens with every customer message. To get back in touch later, you need an approved template.

AI Providers policy. Since January 15, 2026, section 4.7 of the Meta Terms for WhatsApp Business Platform prohibits AI Providers from using the platform when a general-purpose AI assistant is the primary functionality. A bot that serves the company’s own customers is still allowed. The same section prohibits using platform data to create, train or improve AI models. Details in Meta’s AI policy in 2026. This is not legal advice; consult a lawyer.

Human agent. Define clear triggers (the customer asks, a complaint, a sensitive topic) and what the bridge does in each case. The pattern is in from bot to human on WhatsApp.

Cost per message. Replies inside the window are service messages: since October 1, 2026, each number gets 1,000 free per month and pays from the 1,001st on (BRL 0.0350 per message to Brazilian numbers). The cost of the model configured in Flowise is separate.

How to do it with Vectalk

Vectalk is a proxy for Meta’s official WhatsApp Cloud API. It has no native AI in the panel: the AI is your Flowise chatflow, and Vectalk takes care of the number and delivery.

  1. Connect the number in the panel under Instâncias → Conectar conta (Instances → Connect account), via Embedded Signup, without creating an app on Meta.
  2. Create an instance token under Configurações → API Tokens (Settings → API Tokens) and use it as WA_TOKEN.
  3. Register the bridge with POST https://apis.vectalk.com.br/api/webhooks (instance_id, url, name), with ?key= at the end of the URL. According to the webhooks documentation, the forwarded payload is the same as Meta’s and the 200 response must go out within 20 seconds, which the bridge already does before calling Flowise.
  4. Send replies with POST https://apis.vectalk.com.br/api/messages, using the Cloud API body, as described in Send text.

Each delivered message is deducted from your prepaid balance, with no card registered with Meta. Create your account at apps.vectalk.com.br/register. For the big picture, see the guide to the official WhatsApp Business API.

Frequently asked questions

Does Flowise have a WhatsApp node?

We found no native integration with the WhatsApp Cloud API in the indexes of the official Flowise documentation. The integration goes through the Prediction API, with a bridge that receives the WhatsApp webhook.

Why does the bot mix up conversations from different customers?

There’s no sessionId per number, or configuration override is disabled. Send overrideConfig.sessionId with the customer’s number and check Settings → Configuration → Security.

Can I use streaming?

WhatsApp sends the finished message, so streaming: false is the simplest option. If the flow is slow, mark the message as read and show the typing indicator while you wait.

Flowise or Dify?

Both expose the AI through an API and use the same bridge architecture. The difference is in how you build the flow and in the API: Dify uses conversation_id and user, Flowise uses sessionId. The step-by-step for the other one is in Dify + official WhatsApp API.

Can I run Flowise and the bridge on the same server?

Yes, on different ports and with public HTTPS only on the bridge. Flowise can stay reachable only on the internal network, which reduces the chatflow’s exposure.


Official sources consulted on November 24, 2026: Prediction (Flowise); Prediction API reference (Flowise); Chatflow-level authorization (Flowise); Memory (Flowise); Uploads (Flowise); Meta Terms for WhatsApp Business Platform, section 4.7; Webhooks in the Vectalk documentation; Send text in the Vectalk documentation.

Put your business on the official WhatsApp

Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.