title: WhatsApp bot prompt engineering: getting better AI responses description: >- Improve your WhatsApp bot with prompt engineering techniques that produce better AI responses — five methods with before-and-after examples for 2026. date: '2026-07-15' author: Rebecca Pearson authorAvatar: /blog/authors/rebeca-avatar.webp category: Resources cover: /blog/whatsapp-bot-prompt-engineering/blog-thumbnail-blank.png readingTime: 7 tags:
- WhatsApp bot prompt engineering
- WhatsApp AI system prompt
- chatbot prompt writing
- WhatsApp bot optimisation sourceUrl: 'https://www.codewords.ai/blog/whatsapp-bot-prompt-engineering'
The AI model powering your WhatsApp bot is only as good as the instructions you give it. Two bots running on the same model can produce wildly different conversation quality based entirely on how their system prompts are written. This article covers five prompt engineering techniques that produce better responses — with concrete before-and-after examples you can apply directly.
TL;DR
- Prompt engineering for WhatsApp bots means writing system prompts that produce specific, reliable, on-brand responses — not just "be helpful."
- Five techniques cover format specificity, hard limits, example responses, knowledge boundaries, and tone instructions.
- Most system prompts fail for the same reasons — vague instructions, no length guidance, no fallback behaviour. All of these are fixable.
What prompt engineering means for WhatsApp bots
In the broader AI world, prompt engineering refers to the craft of writing inputs that produce better model outputs. For WhatsApp bots, the prompt engineering happens almost entirely in the system prompt — the set of instructions your bot runs on every conversation.
A system prompt tells the AI: who you are, what you know, how to speak, what to do in specific situations, and what to do when you don't know what to do.
Most system prompts are written once, never revisited, and underestimate how much specificity matters. The five techniques below address the most common gaps.
Technique 1: be specific about format and length
The single most impactful instruction you can give a WhatsApp bot is how long its replies should be.
AI models, by default, tend to be thorough. They'll give you a five-paragraph answer when a two-sentence answer is what the user needs. On WhatsApp — a mobile, conversational medium — long replies are friction.
Weak instruction: "Keep responses concise."
Strong instruction: "Keep responses to two or three sentences for simple questions. For information-heavy answers (like listing options or explaining a process), use bullet points with dashes and keep each bullet to one line. Never write more than five sentences in a single message. If the full answer requires more, split it into a natural two-part exchange."
The strong version gives the AI a clear decision rule. It doesn't have to guess what "concise" means — it has specific numbers and a formatting approach to follow.
Also specify when to use formatting. Bold for the most important piece of information. Dashes for lists. Line breaks between distinct thoughts. These small specifications produce dramatically more readable output on a mobile screen.
Technique 2: define what the bot should never do
Most system prompts focus on what the bot should do. The most important instructions are often what it should never do.
Weak instruction: "Help customers with their questions."
Strong instruction: "Never guess at prices — only state prices you know for certain from the information provided. Never promise delivery times unless explicitly confirmed in the product data. Never discuss competitor businesses. Never ask for credit card details or payment information over WhatsApp. If a customer seems distressed or mentions a complaint, don't try to resolve it yourself — pass them to the team immediately."
Hard limits protect your business from the specific failure modes that could cause real damage. Think through the scenarios where a confident but wrong response would be harmful — and make each one an explicit prohibition.
Technique 3: give examples of ideal responses
Telling an AI what good looks like is dramatically more effective than describing it abstractly. If you want a particular tone, voice, or structure — show it.
Without examples: "Respond in a warm, professional tone."
With examples: "Here are examples of the kind of responses we want:
Customer: What are your prices? Bot: Our classic haircuts start from £35, and colouring from £80. Prices vary based on length and what you're after — worth a quick consultation. Want to book one?
Customer: Do you have appointments this week? Bot: Let me check! What day works best for you, and do you have a preference for morning or afternoon?
Customer: I'm not happy with my last appointment. Bot: I'm really sorry to hear that. I want to make sure the team knows — can I take your name so they can reach out to you directly?"
Three examples communicate more than three paragraphs of description. They show the AI the exact vocabulary, length, and energy you want. The AI pattern-matches to these examples consistently.
Technique 4: set knowledge boundaries clearly
A bot that makes up information is worse than one that admits it doesn't know. The key is being explicit about what the bot knows, and giving it a clear behaviour for the boundaries.
Weak instruction: "Answer questions about our products."
Strong instruction: "You have complete information about our current menu (listed below) and our opening hours. You do not have information about stock levels, dietary modifications, or allergen details beyond what's listed — for these, always direct customers to call us on [number] or ask in store. If a customer asks something not covered here, say: 'I don't have that detail to hand — the team would know for sure. Want me to pass on your question?'"
The strong version does three things: it defines what the bot knows, it defines what it doesn't know, and it gives it a specific response for the latter case. This is the pattern that produces honest, reliable behaviour.
Technique 5: include explicit tone instructions
Tone is one of the hardest things to convey abstractly ("be friendly") and one of the easiest to convey specifically ("use these words, avoid these phrases").
Weak instruction: "Be professional and friendly."
Strong instruction: "Tone: warm and direct. Use contractions (it's, we'll, you're). Avoid corporate phrases like 'I'd be happy to assist' or 'certainly.' Use the customer's first name if they've shared it, but only once per reply — not in every message. Light humour is fine when the context is clearly casual, but don't force it. Never use exclamation marks. If you're delivering bad news (fully booked, can't help), be honest and empathetic — don't dress it up."
The instruction about exclamation marks might seem minor. But a bot that ends every reply with "Great to hear from you!" creates a tone that most customers find grating. Small, specific instructions like this make a real difference in perceived quality.
Common system prompt mistakes
Too vague: "Be helpful and answer questions." This gives the AI almost no guidance and produces generic, inconsistent output.
No length guidance: Without explicit instructions, AI models default to thorough — which on WhatsApp means long. Always specify target length.
No fallback behaviour: What does the bot do when it hits a question outside its scope? If you don't define this, the AI will guess — and often it will guess wrong (either making something up or giving an unhelpful "I don't know" with nothing to follow it).
Aspirational rather than accurate information: Prompts that say "we offer the best service in the city" create a bot that makes claims your customers can fact-check. Keep the information factual and specific.
No hard limits: Without explicit prohibitions, the AI will try to be helpful in situations where you need it to disengage — complex complaints, sensitive topics, requests it can't safely fulfil.
How to iterate on prompts through Cody
A system prompt is not a one-time document. The best WhatsApp bots are running on a prompt that's been refined through dozens of small iterations based on real conversation data.
The workflow:
- Read through the last 20–30 conversations from real users
- Identify the three to five moments where the bot's response was wrong, weak, or off-brand
- Add a specific instruction to your system prompt addressing each failure mode
- Test with the same scenarios that produced the original failures
- Repeat monthly
CodeWords makes this iteration fast. Describe the change you want to make to Cody, the AI automation assistant, and Cody updates the prompt structure for you. You don't need to manually edit prompt text — describe the behaviour you want and Cody writes the instruction.
Over two to three months of iteration, most bots reach a point where they handle 85%+ of conversations without any human involvement — and the remaining 15% are appropriately escalated to a person.