In 2026, an AI agent in WhatsApp or Telegram is a common tool for business. An LLM answers customers, helps them choose products and books appointments. At the same time, more businesses lose their numbers. A company connects ChatGPT, the bot answers every message in one second, and after a few days the number is banned.
You can connect an AI agent to a messenger safely if you follow the platform rules and set up the agent properly.
Table of Contents
What is an AI agent in a messenger
A classic chatbot follows a script: buttons, menus and ready answers. If a customer writes something that is not in the script, the bot does not understand and shows the menu again.
An AI agent uses an LLM (large language model). It can:
- understand free text, typos and voice messages after transcription;
- remember the context of the chat, so it does not ask the same question twice;
- call tools: find an order in the CRM, check stock in the catalog, book a free time slot.
You can use any LLM that has an API, for example ChatGPT, Claude or Gemini. The agent works the same way in every messenger, but each platform has its own rules.
AI agent architecture

This is how the agent handles one customer message, step by step:
- Incoming message. The messenger sends it to your server with a webhook.
- Your server. It checks if there is a need for the agent answer: is this a private chat, is there a stop word, is an operator already in the chat. Then it loads the chat history and builds a request to the model.
- LLM. The model gets the system prompt, the history, parts of the knowledge base and a list of tools. It returns text or asks to call a tool, for example to find an order.
- Reply. The server shows the “typing…” status, waits a short time and sends the message through the messenger API.
Chat history. Store it on your side, in a database or Redis, with the chat ID as the key. The model does not remember anything between requests. Your server sends the context every time.
Context length. You do not need to send the full chat history. The last 10–20 messages and a short summary of older messages are enough. The request costs less, and the model makes fewer mistakes.
Handover to an operator. Each chat needs a flag “operator in charge”. When the agent passes the chat to an operator, the flag is on, and the server stops sending messages to the LLM. The operator can turn the flag off and give the chat back to the agent.
Platform rules for AI bots
| Platform | What is allowed | Limits and risks |
|---|---|---|
| WhatsApp Business API (WABA) | Business bots for support, sales, bookings and notifications about your own products and services | Since January 15, 2026, general-purpose AI assistants are not allowed. If the business writes first, it must use an approved template. Customers need a clear way to reach an operator |
| WhatsApp API with a QR code connection | There is no special rule about AI | WhatsApp checks how the number behaves: reply speed, complaints, messages to strangers |
| Telegram Bot API | Any bot that follows Telegram rules | A bot cannot write first: the user must start it. No more than one message per second in one chat and 20 messages per minute in a group |
| Telegram user account through an API | The agent answers from the account | The limits of a normal user apply. For example, no more than 50 new chats per day with people who are not in your contacts |
WABA. The Meta rule is in section 4.7 of the Meta Terms for WhatsApp Business Platform. It is for companies whose main product is an AI assistant, for example a service that says “ask ChatGPT anything in WhatsApp”. A store bot that answers questions about orders and delivery is allowed. Where local law requires it, Meta allows AI providers to answer users from Brazil, Italy, Türkiye and European Economic Area countries. They can send only service messages, as replies inside an open 24-hour window. The same section has a rule that is important for any AI agent: you cannot allow WhatsApp Business Platform data to be used to train AI models. You can only fine-tune a model for your own use. Before you connect an LLM, check its data settings: the provider must not use your chats to train its models.
WhatsApp with a QR code. Section 4.7 applies only to WABA. A normal account that is connected as a linked device has no special rule about AI. WhatsApp bans numbers for their behavior. The next section explains which behavior.
Since October 2026, WhatsApp tests a Restricted Chat mode in beta. A person turns it on in one private chat, and the chat remains only on the main phone. Linked devices do not get this chat. A GREEN-API instance connects to WhatsApp as a linked device. So, based on the beta descriptions, the agent will not see new messages in such a chat. Only some beta testers have this mode now, and WhatsApp has not announced a release date. If a customer turns it on, an employee must answer in this chat from the main phone.
Telegram. You can build a Telegram AI bot with ChatGPT or another LLM in two ways. The official Bot API is good when customers find the bot themselves. An API for a user account is useful when customers already write to a personal or work account. For the second way, follow the limits in the guide how to reduce the risk of blocking in Telegram.
Why messengers ban AI agents
A messenger cannot tell whether your bot uses an LLM. It only sees how the number behaves. These signals often lead to a WhatsApp AI chatbot ban or a blocked Telegram account:
- Instant replies with no pause. A person cannot answer a long question in half a second. An LLM can.
- Replies to every message. The agent replies to everything it gets, even group chats, spam, stickers and short messages like “ok”. A real employee would skip most of these.
- The agent writes first to strangers. Messages to people who did not write to you and did not give you their number quickly get complaints.
- The same text to many people. One greeting sent to a hundred people looks like bulk messaging.
- Complaints from users. A customer taps “Block” or “Report spam” because the bot gives wrong or too many answers.
- Hallucinations. The agent promises a discount, a delivery date or a service that the business does not offer. The customer complains, and the business loses trust.
General rules for a WhatsApp number, including number warm-up and reply rate, are in the guide how to protect a number from a ban.
How to make the agent behave like a person
With these steps, the bot behaves like a polite support employee. They are not a way to hide bulk messaging. If you write to people who did not contact you, pauses will not save you from complaints.
- The “typing…” status. Before the reply, call the SendTyping method to show the “typing…” status. The
typingTimeparameter sets how long the status shows, from 1 to 20 seconds. The SendMessage method has the same parameter. - A pause based on reply length. The pause before sending must grow with the text. For example, 1 second for every 20 characters, but not less than 2 seconds and not more than 15 seconds. The send queue interval adds to this pause.
- Read receipts. Mark the chat as read with the ReadChat method before the reply. Or turn on the
markIncomingMessagesReadedOnReplyinstance setting, and messages will be marked as read when you reply. - Private chats only. Answer only in private chats. In WhatsApp, the chat ID shows the chat type: a private chat ends with
@c.us, a group ends with@g.us. The agent does not need to answer stickers, reactions or short messages like “ok”. - A limit of messages per minute. Limit how many replies the agent sends per minute to one customer and in total. The
delaySendMessagesMillisecondsparameter of the SetSettings method sets the interval between messages in the queue. - Stop words and handover to an operator. Words like “operator”, “human”, “complaint” and “stop” pass the chat to an operator at once. The agent tells the customer that a manager will answer, and then it stops.
The SendTyping, ReadChat and SendMessage methods have the same names in the GREEN-API APIs for WhatsApp and Telegram.
How to limit the LLM
The system prompt is the main protection against hallucinations. It says what the agent talks about and what it does not talk about. Here is an example for Shelfly, a fictional online store:
You are the AI assistant of the Shelfly store. Answer only about products,
orders, delivery and returns, with facts from the knowledge base and the CRM.
Give prices, discounts and dates only after a check.
If you do not know the answer, pass the chat to an operator.
If a question is not about Shelfly orders, say that you help only with them.
In the first message, say that you are an AI and the customer can write
"operator" to talk to an operator.
Two more rules work together with the prompt:
- Answers from the knowledge base. Add delivery terms, return rules, working hours and product descriptions to the knowledge base. The server finds the right parts and sends them to the model with the question.
- Data from tools. The agent gets prices and order status from the CRM or the catalog with a tool call. It does not invent them.
These limits protect you from hallucinations and from the WABA rule. An agent that talks only about your products and services is a business bot, not a general-purpose assistant.
MCP: give an agent access to WhatsApp from Claude and Cursor
MCP (Model Context Protocol) is a standard that lets an AI client call external tools. The GREEN-API MCP server gives Claude, Cursor, VS Code and other clients access to WhatsApp. The agent can read chat history, send messages and files, and work with groups and contacts. The server already runs at https://mcp.green-api.com/mcp, so you do not need to install anything. GREEN-API plans to add Telegram support to the MCP server later.
MCP is useful when an employee works with the agent. For example, the employee asks Claude to collect all unanswered questions of the day and prepare replies, then checks them and sends them. For an agent that answers customers on its own 24 hours a day, the webhook design from the architecture section is a better choice.
AI agent with GREEN-API
GREEN-API connects a normal WhatsApp or Telegram account through an API. Both messengers use the same request and webhook format. You write your AI assistant once, and it works in both channels.
You do not need to build the agent from zero. Use the ready GPT bot libraries for Python and Go. For WhatsApp, there are versions for Python, Go and Node.js. The Python library keeps the chat history, supports middleware, transcribes voice messages with Whisper and works with images.
A GPT bot with the GREEN-API WhatsApp API connects with a QR code, and you do not need template approval. You can try it at green-api.com.
FAQ
Can I connect ChatGPT to WhatsApp in 2026?
Yes. Meta banned AI providers whose main product is a general-purpose AI assistant or another LLM service. A bot that answers customers about your products and services is allowed in WABA and with a QR code connection.
Will WhatsApp ban my number if the bot answers instantly?
The risk is higher. Instant replies to every message are a clear sign of automation. Show the “typing…” status and add a pause based on the reply length.
How do I tell a customer that they talk to an AI?
Say it in the first message: “Hello! I am the AI assistant of the Shelfly store. I can help with your order. If you want to talk to an operator, write ‘operator’.” The customer does not feel tricked, and you get fewer “this is a bot” complaints.
Which LLM should I choose?
Any LLM with an API works. The model is less important than the limits: the system prompt, the knowledge base and the handover to an operator.
Can the agent write first?
In WABA, a business can write first only with an approved template and only to people who gave consent. In Telegram, a bot cannot start a chat before the user starts the bot. A normal account connected through an API is most often banned for messages to strangers. Let the agent answer people who wrote first or who gave their number and agreed to get messages.
Connect an AI agent to WhatsApp and Telegram with one API: green-api.com.