DEV Community

Cover image for Building WhatsApp Automation with n8n Cloud: Complete Integration Guide
WhatsApp API for developers
WhatsApp API for developers

Posted on

Building WhatsApp Automation with n8n Cloud: Complete Integration Guide

Learn how to integrate Whapi.Cloud with n8n Cloud using HTTP requests to build powerful WhatsApp automation workflows. This comprehensive guide covers everything from receiving webhooks and sending messages to creating groups, managing channels, and building community engagement tools directly from your n8n Cloud workflows.

Note: This guide focuses on integrating Whapi.Cloud via HTTP requests in n8n Cloud. If you're using Self-Hosted n8n, we offer a dedicated custom module for seamless integration. Learn more here → Custom Node for n8n


Prerequisites

To follow this guide, you'll need:

  • An active Whapi.Cloud account and your channel's API Token (available in your Whapi.Cloud dashboard). For detailed token setup instructions, refer to: Getting Started
  • An active n8n Cloud account with workflow creation permissions.

Ensure both accounts are properly configured before proceeding.

Step 1: Setting up Webhook in n8n

  1. In your n8n Cloud workflow, add a new Webhook node.

Setting up Webhook in n8n

  1. Configure the node by selecting POST as the HTTP method. Copy the generated Webhook URL provided by n8n.

Simple webhook configuration in n8n

  1. Navigate to your Whapi.Cloud channel settings and paste the copied URL into the webhook URL field. Enable the events you wish to receive (e.g., incoming messages, group updates, channel activities).

Set specific events in the webhook settings

Your Whapi.Cloud events (new messages, group interactions, community updates) will now trigger this Webhook node in n8n.

Step 2: Receiving Messages in n8n

  • Ensure your Webhook node in n8n is active and configured for POST requests.
  • Send a test message to your connected WhatsApp number.
  • The Webhook node in n8n will capture the incoming message instantly.
  • Inspect the received JSON payload to understand its structure for further workflow automation.

Example JSON payload

Example JSON payload

You can view all examples of incoming callbacks here: Incoming webhooks format

Example JSON payload:

{
  "messages": [
    {
      "id": "p.w30M7fgwWD4XwHu.g4CA-gBgTwl0rVw",
      "from_me": false, // Please note this parameter, which allows you to understand whether the message is incoming or outgoing. In the future, we will filter webhooks based on this parameter.
      "type": "text",
      "chat_id": "919984351847@s.whatsapp.net",
      "timestamp": 1712995245,
      "source": "mobile",
      "text": {
        "body": "Hello world"
      },
      "from": "919984351847",
      "from_name": "Gerald"
    }
  ],
  "event": {
    "type": "messages",
    "event": "post"
  },
  "channel_id": "MANTIS-M72HC"
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Sending Messages from n8n

  1. Add an HTTP Request node to your n8n workflow. To do this, select Core, then HTTP Request.

Add an HTTP Request node

  1. Configure the HTTP Request node as follows: You will need to use the correct request configuration from the Whapi.Cloud documentation. Examples and convenient documentation with examples can be found here: API Docs
  • HTTP Method: POST
  • URL: https://gate.whapi.cloud/messages/text

Information for the request can be easily obtained from our docs.

Information for the request can be easily obtained from our docs

  1. Authentication:
    To authorize, you will need to select Bearer Auth in the Credential Type field. After that, enter and save your channel token from Whapi.Cloud.

  2. In the Body section, select RAW / JSON and enter:

{
  "to": "recipient_number",
  "body": "Hello from n8n and Whapi.Cloud!"
}
Enter fullscreen mode Exit fullscreen mode

Replace "recipient_number" with the recipient's WhatsApp number (international format, no +).

Parameters for sending a message in WhatsApp

You can specify either the recipient's number in international format or the chat ID. It doesn't matter which one you use. For more information about what a chat ID is, see: Chat ID. What is it and how to get it?


Building a WhatsApp Bot with Message Filtering

So far, we've covered the basic setup of connecting the WhatsApp API to n8n, allowing you to receive incoming messages and send messages to any number — including groups, channels, and community members.

Now let's explore a common use case: building an automated bot in WhatsApp. In this scenario, you typically want the bot to respond only to incoming messages, and ignore outgoing ones to avoid loops.

To achieve this, you'll need to filter incoming webhooks. Let's add a Filter node to your workflow.

Your goal is to distinguish incoming messages from outgoing ones. This can be done by checking the from_me parameter in the webhook payload:

  • from_me = true → the message was sent by you (outgoing)
  • from_me = false → the message was received from the user (incoming)

By filtering for from_me = false, your bot will respond only to actual user messages and won't react to its own replies. Make sure to set the data type to Boolean when configuring the filter, as shown in the example below.


Creating WhatsApp Groups and Managing Communities via n8n

Now let's walk through how to create a new WhatsApp group and send a message to it - along the way, we'll highlight a few important details for community management.

To create a group, use the Create Group endpoint. You can find the full documentation here: 👉 https://whapi.readme.io/reference/creategroup

In n8n, add an HTTP Request node:

  • Set the method to POST
  • URL: https://gate.whapi.cloud/groups
  • Add your channel's Authorization Bearer Token to the headers

Now let's review the required parameters:

  • subject: the name of the group
  • participants: an array of phone numbers (as strings) to be added to the group during creation

The easiest way to pass the participants array is by selecting "Specify Body → Using JSON" in the HTTP node. This allows you to enter the full JSON payload directly in the body. (There is also a more advanced method using a Set node to build the array dynamically, but we won't cover that here.)

You can copy a ready-to-use JSON body directly from our documentation: https://whapi.readme.io/reference/creategroup. This helps avoid issues with extra line breaks or formatting.

After sending the request, the response will include full details of the newly created group. Make sure to save the **group_id**, as you'll need it later in the to parameter when sending messages to the group.

Also note the optional field unprocessed_participants. This indicates which numbers could not be added to the group. To understand why this may happen and how to avoid it, see our guide: Why aren't participants being added to the group?


Unlock advanced WhatsApp features in n8n

With Whapi.Cloud and n8n, you can extend your automation to include:

  • Group Management: Add/remove participants, update group settings, manage admin roles
  • Channel Operations: Create and manage WhatsApp channels for broadcasting
  • Community Engagement: Automate responses, schedule announcements, and manage member interactions
  • Analytics Integration: Track message delivery, engagement rates, and community growth

Need help getting started? We will tell you exactly how to create the scenario you need or help you find a mistake. Our support team is always here to assist you: https://whapi.cloud/n8n-whatsapp-integration

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.