Background

Complete Guide to Creating a Customer Service Bot on WhatsApp with n8n and Baileys

post.publishedOn 2 November 2025
08:00 post.readingTimeSuffix

Introduction: The new era of customer service via WhatsApp

WhatsApp has established itself as one of the main communication channels between companies and customers. In 2025, the demand for efficient and automated customer service bots has surged, especially with the advancement of low-code automation tools like n8n, and powerful libraries like Baileys.

In this guide, you will learn how to create a customer service bot on WhatsApp with n8n and Baileys, in a practical, secure, and scalable way - even if you are not an experienced programmer.


Why use WhatsApp with n8n and Baileys?

Integrating WhatsApp with n8n through Baileys offers several advantages:

  • Visual and customizable automation with n8n.
  • Zero cost: no monthly fees from third-party platforms.
  • Full control of data and bot logic.
  • Easy integration with CRMs, spreadsheets, databases, and APIs.

What you need to get started

Before getting your hands dirty, make sure you have:

  1. Server with Node.js installed (VPS or local).
  2. n8n instance running (Docker or direct installation).
  3. Baileys library installed for WhatsApp connection.
  4. Code editor (VS Code recommended).
  5. WhatsApp account (personal or dedicated number).

Step by step to create your customer service bot

1. Install and configure Baileys

Baileys is a JavaScript library that allows you to control a WhatsApp Web session via code.

npm install @whiskeysockets/baileys

Configure a simple instance to start the session, capture QR Code, and keep the connection active.

2. Create endpoint in n8n

Within n8n, create a workflow with the HTTP Webhook node to receive messages processed by Baileys.

  • Method: POST
  • URL: /webhook/whatsapp
  • Action: store, respond, or forward messages according to your logic.

3. Connect Baileys to n8n

In your Baileys script, when receiving a message, send it to the n8n Webhook:

axios.post('https://yourdomain.com/webhook/whatsapp', {
  from: msg.key.remoteJid,
  message: msg.message.conversation,
})

4. Create logic in n8n

In the n8n workflow, add nodes such as:

  • IF to detect commands (e.g., "1 - View products").
  • HTTP Request to query APIs or send messages back via Baileys.
  • Function to customize responses or execute more complex actions.

5. Send response with Baileys

Create an additional endpoint for n8n to send commands to Baileys:

await sock.sendMessage(remoteJid, { text: 'Hello! How can I help?' })

Practical use cases

Order service

Allow customers to place orders directly through WhatsApp with automated flow: product consultation, confirmation, and forwarding to a human operator.

Automatic scheduling

Use n8n to connect with Google Calendar or Notion and allow the bot to make real-time appointments.

Lead capture

Store name, phone, interest, and send to a CRM like Pipedrive, RD Station, or even a Google spreadsheet.


Final tips to scale your bot

  • Use message queue to avoid WhatsApp blocks.
  • Store sessions to maintain the connection even after server restart.
  • Implement logs and error routines.
  • Respect Meta's guidelines, avoiding SPAM and API abuse.

Conclusion

Creating a customer service bot on WhatsApp with n8n and Baileys is totally possible - and highly effective. This combination allows robust automation, low cost, and total flexibility to adapt the bot to your needs. In 2025, companies that adopt this approach get ahead by offering fast, personalized service available 24/7.

Ready to automate your WhatsApp customer service?

Talk to our specialists and see how we can set up your custom bot.

share.title

Comentários

Carregando comentários...

Você precisa estar logado para deixar um comentário.