How to Build a Simple WhatsApp Auto-Reply Bot in Four Steps
By Nimana · Last updated November 18, 2026 · 3 min read
Build a simple WhatsApp auto-reply bot in four steps: connect a number, receive messages, choose a reply, and send it, with tips to keep your bot helpful and safe.
Why This Matters
Most customer messages repeat: "What are your opening hours?", "Where are you?", "How much is it?". A small business can lose hours a day typing the same answers, and customers who wait too long for a reply often give up.
A simple bot handles the common questions straight away, and leaves your team free for the conversations that need a person. You do not need artificial intelligence to start. A bot that recognises a few keywords already saves a lot of time.
How a WhatsApp Bot Works
Every bot, simple or advanced, follows the same four steps:
- Connect a WhatsApp number so the bot can send and receive messages.
- Receive incoming messages. The messaging service sends each new message to a URL on your server, called a webhook.
- Decide the reply. Your code reads the message and picks an answer.
- Send the reply back to the customer.
Choosing the Reply
The simplest way to decide is keyword matching. Here is the idea:
function getReply(message) {
const text = message.toLowerCase();
if (text.includes('hours') || text.includes('open')) {
return 'We are open Monday to Saturday, 8 AM to 6 PM.';
}
if (text.includes('price') || text.includes('cost')) {
return 'Our price list is on our website. Tell us what you need and we will help.';
}
if (text.includes('help') || text.includes('support')) {
return 'Thanks for reaching out! A team member will reply as soon as they can.';
}
return 'Thanks for your message! How can we help you today?';
}
Start with three or four topics, read what customers really ask, and add more over time.
Seven Tips for a Bot People Like
- Introduce your business. Customers should know who is answering.
- Keep replies short. A few lines, not a wall of text.
- Always have a fallback reply for messages the bot does not understand.
- Offer a human. Tell customers how to reach a person for anything complicated.
- Only respond to the messages you want. Ignore status updates and your own outgoing messages, or the bot may reply to itself.
- Keep volume modest. A bot that replies to one customer at a time is fine. Do not use it to message people who did not write to you first.
- Test with your own number before you let real customers in.
Common Mistakes
- Replying to everything, including events that are not customer messages
- Building a bot that cannot say "I do not know"
- No way to reach a person
- Using the bot for promotions to people who never contacted you
How SendAPI Helps
SendAPI has a WhatsApp Bot Tutorial that follows these four steps. A few details from it:
- Connect a number in minutes: you create a WhatsApp session and pair any WhatsApp number by scanning a QR code, with no Meta Business verification required.
- Receive messages by webhook: incoming messages arrive as a
whatsapp.message.receivedevent, containing the sender, the text, and the session ID. - Reply with the send endpoint: one call to
POST /v1/whatsapp/sendwith the session ID, the recipient, and the content.
Here is the core of the webhook handler:
app.post('/webhook', async (req, res) => {
const event = req.body;
// Only process incoming messages
if (event.type !== 'whatsapp.message.received') {
return res.json({ received: true });
}
const { from, text, session_id } = event.data;
// Send an auto-reply
await fetch('https://sendapi.co/v1/whatsapp/send', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SENDAPI_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ session_id, to: from, content: getReply(text) })
});
res.json({ received: true });
});
One more tip from the docs: WhatsApp's own anti-spam logic may temporarily throttle your session if you send too quickly, so for direct sends from a bot, keep volume modest.
All of this comes with WhatsApp, SMS, OTP, and email under one API from $9.99 a month.