Skip to content
Daleel Web

AI agents & automation

Build a WhatsApp and Telegram AI customer service agent with n8n

Connect WhatsApp Business or Telegram to an AI agent in n8n that answers customers in their own language, looks up orders and hands hard cases to a human.

By Daleel Web Editorial TeamPublished 3 min read
Chat bubbles connected to an automation flow, representing a WhatsApp AI agent
On this page

For businesses across the Middle East, WhatsApp is the sales and support channel. An AI agent that answers common questions instantly, in the customer's own language, and passes complex cases to a person can save hours every day. This guide shows how to build one with n8n on your own server.

What you need

  • n8n on your server with a public HTTPS address. Meta and Telegram must be able to reach n8n's webhook. Our n8n installation guide sets this up.
  • An AI model API key (OpenAI, Anthropic, Google or similar).
  • For WhatsApp: a Meta developer account, a Meta business portfolio, and a Meta app with the WhatsApp product added.
  • For Telegram: just a Telegram account.

How the agent works

The workflow has three parts:

  1. Trigger: a new message arrives (WhatsApp Trigger or Telegram Trigger).
  2. AI Agent node: reads the message, decides what to do, and uses tools. n8n's docs say the agent needs a chat model and at least one tool; add memory so it remembers the conversation.
  3. Reply: sends the answer back on the same channel.

Useful tools to give the agent: a lookup in Google Sheets or your database for order status, your FAQ or price list, and a "notify a human" step.

Option A: Telegram (quickest to test)

  1. In Telegram, message @BotFather, send /newbot, choose a name and a username ending in bot, and copy the token.
  2. In n8n, add a Telegram Trigger and create a credential with that token.
  3. In the trigger options, use Restrict to User IDs while testing so only you can reach the bot.
  4. Add the AI Agent node and a Telegram node to send the reply.

Option B: WhatsApp Business

WhatsApp needs a few more steps on Meta's side:

  1. Create a Meta app, add the WhatsApp product and link your business portfolio. Meta requires a privacy policy URL and terms of service URL, and the app must be switched to Live.
  2. In n8n, create two credentials:
    • For sending messages (WhatsApp Business Cloud node): an access token and your WhatsApp Business Account ID.
    • For receiving messages (WhatsApp Trigger): OAuth2 with your Meta App ID as Client ID and App Secret as Client Secret.
  3. Add a WhatsApp Trigger listening for Messages, then the AI Agent, then a WhatsApp Business Cloud node to send the reply.

Also note: WhatsApp allows one webhook per app, so switching between n8n's test and production URLs overwrites the registration. Full launch also needs Meta's business verification and app review.

Instructions that work well for customers

The agent's system message decides most of its behaviour. A solid starting point:

You are the customer service assistant for [Store name].
- Reply in the same language and dialect the customer uses.
- Keep answers short and friendly.
- Use the order lookup tool before answering any question about an order.
- Never invent prices, delivery dates or order details. If you don't know, say so.
- If the customer is angry, asks for a refund, or asks for a person,
  reply that a team member will contact them and use the notify tool.

Replying in the customer's own language and dialect matters: Gulf, Egyptian and North African customers write very differently, and a modern model handles all of them well when told to mirror the customer.

Before you go live

  • Test with real past questions from your customers.
  • Check costs: model usage plus any WhatsApp charges from Meta. Our cost guide shows how to estimate them.
  • Keep a human in the loop for refunds, complaints and anything involving payment.

Frequently asked questions

Can I use my personal WhatsApp number?

Not with the official WhatsApp Business Cloud API that n8n uses. You need a number registered to a WhatsApp Business account in Meta's business tools.

Should I start with WhatsApp or Telegram?

Start with Telegram to build and test the agent: it only needs a bot token. Move to WhatsApp once the agent behaves well, since its setup takes longer and needs business verification for full launch.

Sources & references

  1. n8n docs: WhatsApp Business Cloud node
  2. n8n docs: WhatsApp Trigger node
  3. n8n docs: WhatsApp credentials
  4. n8n docs: Telegram credentials
  5. n8n docs: AI Agent node

AI agents & automation

How much does it cost to run an AI agent 24/7?

The real costs of running an AI agent: the server, the AI model's API usage and the hidden extras. A simple formula to estimate your monthly bill before you start.

2 min read