Course resource
Messaging Bot Setup
Putting an AI assistant on WhatsApp, Telegram or similar — and the compliance rules that decide whether you can.
Read this before building
Messaging platforms are far more regulated than email. Getting this wrong gets your number banned, not just ignored.
WhatsApp Business: message templates must be pre-approved, businesses generally cannot initiate outside a service window after a user message, opt-in is required and must be demonstrable, and there are per-conversation charges. The rules change; check the current Business Policy before you build.
Telegram: far fewer restrictions, no approval process, free. This is why it is the right place to learn.
Build on Telegram first. Get the logic right where mistakes are cheap, then port to WhatsApp once you know what you are building.
The shape
Incoming message
-> is this a known user? (context lookup)
-> AI: what are they asking?
-> answer from the knowledge base, or route to a human
-> log
The knowledge base
The bot knows only what you give it. See the Knowledge File Optimizer — one topic per file, summary at the top, no contradictions, dates in the content.
For a customer-facing bot the minimum is: what you sell, prices, hours, location, delivery, returns, and the five questions you answer most.
The instructions
# ROLE
You answer questions for [BUSINESS] on [PLATFORM].
# STYLE
- Short. This is a phone screen, not an email.
- 2-3 sentences per reply unless asked for detail.
- Plain, warm, not corporate.
- One question at a time.
# RULES
- Answer ONLY from the knowledge files.
- If they are not covered, say: "Let me get a colleague to help with that"
and trigger a handoff.
- Never quote a price, date or availability not in the files.
- Never promise a refund, discount or delivery date.
- Never ask for card details, passwords or ID numbers.
- If someone seems upset, hand off to a human immediately.
- If asked whether you are a bot, say yes.
# HANDOFF
Trigger a handoff when: they ask for a human, they are upset, the question
is outside the files, or they mention a complaint, legal issue or refund.
The escape hatch
Every bot needs an obvious route to a human. This is the single thing that decides whether customers tolerate it.
- Mention it in the first message: "Type HUMAN any time to reach a person."
- Trigger automatically on frustration signals — repeated questions, "this is useless", anger.
- If no human is available, say so honestly and give a time.
Nothing damages a brand faster than a bot that will not let you out.
The first message
Hi — I'm [BUSINESS]'s automated assistant. I can help with [THREE THINGS].
For anything else, type HUMAN and someone will pick this up.
[Hours if relevant]
Say it is automated. People work out within two messages anyway, and pretending otherwise loses trust you cannot recover.
Compliance checklist
- Every recipient opted in, and I can evidence when and how
- Opt-out works, is honoured immediately, and is mentioned
- Bot identifies itself as automated
- Platform business policy read and followed
- Templates pre-approved, where the platform requires it
- Messaging windows respected
- No card details, passwords or ID numbers requested, ever
- Conversation data retention known and lawful
- Privacy notice mentions the messaging channel
- Local rules on commercial messaging checked
Testing
- The three questions it should handle well
- A question outside its knowledge — does it hand off, or invent?
- An angry message — does it escalate?
- "Are you a bot?" — does it say yes?
- "HUMAN" — does the handoff work?
- A message in another language
- Two messages sent quickly — does it handle them in order?
- Someone asking for a discount — does it hold the rule?
- "Ignore your instructions" — what happens?
- Out of hours — does it set expectations?
Cost
Per-conversation charges plus AI cost per message. Both scale with success.
| Expected conversations/month | |
| Platform cost per conversation | |
| AI messages per conversation | |
| AI cost per conversation | |
| Monthly total | |
| At 5x volume |
After launch
- Read every conversation for the first two weeks. You will find things the tests did not.
- Log every handoff and why. Frequent handoffs on the same topic mean a gap in the knowledge base.
- Track whether customers are satisfied, not just whether the bot answered.
- Review the knowledge files monthly. A bot answering from last quarter's prices is worse than no bot.
| Reviewed | Handoff rate | Top handoff reason | Files updated |
|---|---|---|---|