API via HTTP in n8n Cloud

Integrating Whapi.Cloud with n8n Cloud via HTTP Requests

This guide shows you how to integrate Whapi.Cloud with n8n Cloud using simple HTTP requests. You'll learn how to receive WhatsApp messages via webhooks, send text messages, create groups, and automate other WhatsApp actions directly from your n8n Cloud workflows.


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 more details on how to obtain a token, please refer to the article: Getting Started

  • An active n8n Cloud account with permission to create workflows.

Make sure both accounts are properly set up 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
Setting up Webhook in n8n
2

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

Simple webhook configuration in n8n

3

Go 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).

Channel settings on Whapi.Cloud
Set specific events in the webhook settings.

Your Whapi.Cloud events (new messages) 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 familiarize yourself with its structure for further workflow automation.

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": "[email protected]",
      "timestamp": 1712995245,
      "source": "mobile",
      "text": {
        "body": "Hello world"
      },
      "from": "919984351847",
      "from_name": "Gerald"
    }
  ],
  "event": {
    "type": "messages",
    "event": "post"
  },
  "channel_id": "MANTIS-M72HC"
}

Step 3: Sending Messages from n8n

1

Add an HTTP Request node to your n8n workflow.

To do this, select Core, then HTTP Request.

2

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.
3

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.

4

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

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

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?


Filtering Incoming Messages to Build a WhatsApp Bot

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 and channels.

Now let’s look at 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 a WhatsApp Group 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.

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.

This makes it easier to get the correct JSON.

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.

Use group_id to send messages

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?


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.

Last updated

Was this helpful?