AnyLinga
EN
Log in Try it free

Help Center/AI agent

WhatsApp AI chatbot: how to connect via n8n in AnyLinga

Updated: 2026-11-11

Need a WhatsApp AI chatbot that replies to customers while your sales rep sees the conversation in Kommo? AnyLinga Connect sends incoming messages to n8n and sends your AI agent's reply back to the customer.

The n8n WhatsApp integration uses a webhook and callback. Below, learn how to connect a WhatsApp AI chatbot, set up message processing, and test replies without Salesbot.

What you'll need

  • An active AnyLinga account: it must not be blocked due to nonpayment or an expired trial. Connect is available on all plans.
  • WhatsApp or WhatsApp Business API connected to AnyLinga.
  • Your AI agent and an n8n workflow with an HTTPS URL for the Webhook node.
  • A connected Kommo account to work with conversations and lead filters.

How messages pass through n8n

AnyLinga sends each incoming customer message to your n8n workflow's webhook, subject to the configured filters. The AI agent processes the message, and the workflow returns a reply through the callback.

AnyLinga translates the reply if needed, sends it to the customer through the same channel, and adds it to the Kommo chat. Incoming messages continue to reach Kommo as usual: Connect runs in parallel.

This lets AI handle first-line questions while keeping the entire conversation available to your sales rep in Kommo. Connect works not only with WhatsApp but also with other channels connected to AnyLinga: Telegram, Instagram, Facebook, and others.

Photos, videos, files, and voice messages are also sent to n8n: the type is in message_type, the link is in media_url, and the caption is in caption. Voice messages include a transcript if voice message transcription is enabled. Learn more: which messages are sent to the agent.

Connect the webhook in AnyLinga

1. Open the AI gateway

  • Under Tools & Settings, open AI gateway.
  • On the Connect your AI page, find the gateway settings.
The “Connect your AI” page with the “Enable gateway” toggle and the “n8n webhook URL” field.

2. Download the template and prepare the webhook URL

  • In the n8n starter template section, click Download .json.
  • Import the file into n8n and get the URL of your workflow's Webhook node.
  • Paste the URL into the n8n webhook URL field.
The webhook requires an HTTPS URL.

3. Save the gateway settings

  • Turn on Enable gateway: incoming customer messages will be forwarded to your n8n webhook.
  • Click Save.

4. Copy the callback and signing details

  • Copy the Callback URL and Callback token to send replies from n8n.
  • Copy the Signing secret (X-AnyLinga-Signature) to verify incoming requests.
  • Use Copy next to the value you need. The fields are read-only; use Regenerate to update the values.
The callback URL, token, and signing secret fields, along with the starter template section and its “Download .json” button.

Set up processing and replies in n8n

5. Set up message reception

  • The webhook must immediately return 2xx, within 10 seconds. Send the AI reply in a separate request to the callback URL. AnyLinga does not read the webhook response body: a reply returned in it will not reach the customer.
  • In the imported workflow, configure the Webhook to receive JSON.
  • Use the incoming fields: message_text, translated_text, message_type, media_url, caption, conversation_id, channel, contact_id, ad, lang, agent_lang, correlation_id, callback_url. Learn more: what data the workflow receives.
  • Keep the correlation_id to reply to this message.
  • Set up HMAC-SHA256 verification of the X-AnyLinga-Signature header using the secret you copied.
  • The starter template does not verify the signature. Add verification yourself.
If there is no response within 10 seconds or the response is 4xx, there are no retries. For a connection error or 5xx, there are up to 5 retries with delays of 2, 5, 10, 20, and 30 seconds. Learn more: why replies do not arrive.

6. Connect your AI agent's processing

  • Pass the text from the incoming request to your AI agent.
  • Prepare the reply text for the reply_text field.
  • Keep the reply linked to the original correlation_id.

7. Set up replies through the callback

  • Send a POST request to the address in Callback URL.
  • Add the header Authorization: Bearer <callback token>, using the value from Callback token.
  • Send the JSON body { "correlation_id": "<incoming message correlation_id>", "reply_text": "<reply text>" }.
Duplicate correlation_id values are ignored. The callback limit is up to 120 requests per minute.

Choose when to trigger the AI agent

8. Set filters for an open lead

  • Open the Trigger filters section.
  • Set Pipelines (lead is in any of these) if needed.
  • Add Lead tags (lead has any of these) or the Lead field is filled condition.
  • Click Save.
The “Trigger filters” section with conditions for pipelines, tags, and a filled lead field.
Filters require a connected Kommo account. The gateway triggers if the customer's open lead matches at least one configured condition, not necessarily all of them.

9. Leave filters empty to include all messages

  • If you do not need lead-based restrictions, leave Trigger filters empty.
  • In this case, the gateway sends every incoming customer message to n8n.

Test the connection and conversation

10. Test the webhook response

  • Click Test connection.
  • If the test succeeds, n8n responded in N ms appears.
  • If you see No valid response from n8n, check the n8n webhook URL and request processing in the workflow, then test again.

11. Test the full message flow

  • Send a message from a customer's WhatsApp account to the connected channel. If filters are configured, use a customer with a matching open lead.
  • Check that n8n received the message and sent a callback with the original correlation_id and reply_text.
  • Make sure the reply reached the customer in WhatsApp and appeared in the Kommo chat.
  • Check that the customer's original message is also still in Kommo.
A successful webhook test confirms the connection to n8n. Use a separate test message to check the AI agent and callback delivery.
Did you find this article helpful?

Get in touch

We reply during business hours.

Already using AnyLinga?

Describe your question and we'll reply on WhatsApp or by email.

New to AnyLinga?

Try it yourself, or we'll set it up for you when you pay for the first month.

Discuss setup

What you need