Create a WhatsApp group from an n8n workflow
Create a WhatsApp group from n8n the moment a deal, ticket or booking needs one, with the founding members pulled from the trigger record. One HTTP Request node posts the subject and the participants to Wapito, and a Set node keeps the returned group id on the record so later nodes can message the group without looking it up again.
Before you start
- An n8n Cloud or self-hosted instance where you can create credentials and workflows.
- A Wapito channel that is connected, and its channel token copied from the dashboard.
- A trigger that carries a group name and at least one phone number in international format, such as a CRM deal-won event or a form submission.
Step by step in n8n
Store the channel token as a Header Auth credential
In n8n open Credentials, add a Header Auth credential and name it Wapito. Set the header name to Authorization and the value to the word Bearer, a space, and your channel token. Every HTTP Request node in this recipe selects this credential, so the token is never pasted into a node parameter and never ends up in an exported workflow JSON.
Field map Wapito field Where it comes from AuthorizationHeader Auth credential "Wapito" — value: Bearer wpt_… Add the trigger and shape the participants list
Start with the node that knows a group is needed: a CRM trigger, a form trigger or a Webhook node fed by your own system. Follow it with a Code node that builds an array of phone numbers in international format from the trigger fields, dropping blanks and duplicates. Wapito accepts numbers with or without the leading plus, but every entry has to be dialable or the whole request is rejected with invalid_recipient.
Field map Wapito field Where it comes from participantsCode node output — an array of strings such as ["+15551234567", "+15559876543"] Post the group to Wapito with an HTTP Request node
Add an HTTP Request node, set the method to POST and the URL to https://api.wapito.com/v1/groups, choose Generic Credential Type, then Header Auth, and pick the Wapito credential. Set Body Content Type to JSON and use expressions rather than string concatenation for every field, so a name containing a quote or an emoji does not produce a malformed body.
Field map Wapito field Where it comes from description{{ $json.summary }} — optional, set on the group immediately after creation participants{{ $('Code').item.json.participants }} — the array from the previous step subject{{ $json.deal_name }} — the group name, up to 100 characters Keep the group id with a Set node
The response is the group as WhatsApp created it, and the field you need is id, a long numeric string ending in @g.us. Add a Set node that copies {{ $json.id }} into a field on your record and marks it as a string. n8n keeps it as text on its own, but any downstream sheet or database column that is numeric will round the id and every later message to the group will fail.
Field map Wapito field Where it comes from group_id{{ $json.id }} — store as text, for example 120363041234567890@g.us invite_code{{ $json.invite_code }} — optional, if you want to share a join link later Send the welcome message to the new group
Add a second HTTP Request node that posts to https://api.wapito.com/v1/messages/text with the same credential, using the stored group id as the recipient. A typing_time of a few seconds makes the first message arrive at a human pace, which matters most on a number that has just created a group. Connect an IF node on the response status if you want to alert someone when the send is refused.
Field map Wapito field Where it comes from bodyWelcome text with expressions from the trigger, for example {{ $json.customer_name }} to{{ $('Set').item.json.group_id }} — the @g.us id from the previous step typing_time3 Handle the response and the failure branch
Switch on Continue On Fail for both HTTP Request nodes and route the error output to a Slack or email node, so a refused request is visible instead of silently ending the execution. The error body from Wapito carries a code such as invalid_recipient or channel_not_connected, and reading it in the alert saves a trip to the execution log.
Field map Wapito field Where it comes from error.code{{ $json.error.code }} — the Wapito error code on the failure branch
Test it
Run the workflow manually with a test record whose participants are your own second phone. The execution should show a 201 from the groups node with an id ending in @g.us, the phone should receive the group invitation and the welcome message within a few seconds, and the Set node's output should carry the id as a string.
Errors you may hit
- invalid_recipient 400Recipient is not valid
- invalid_request 400Request failed validation
- channel_not_connected 409Channel not connected
- unauthorized 401Missing or invalid token
- rate_limited 429Too many requests
Frequently asked questions
Can I add participants later instead of at creation time?
Yes. Create the group with the linked number alone or with one member, then call the participants endpoint from a later node whenever a new person needs adding. It is the better pattern when members trickle in over time, because each addition is its own request with its own error handling, and a single bad number does not stop the group being created.
Why does the group id break when I write it to Google Sheets or Airtable?
The id is a numeric string longer than a 64-bit integer, followed by @g.us. n8n treats it as text, but a spreadsheet cell or a numeric database column will parse the digits and round them, and the rounded value is not a group anyone can message. Format the destination column as text before the first run, or prefix the value in a way your sheet will not parse.
Does creating a group from n8n carry ban risk?
Creating groups is one of the clearest automation signals WhatsApp watches for, so it is a high-risk operation on any unofficial API. Run this recipe from a number you can afford to lose, keep the rate to what a person could plausibly do by hand, and prefer sharing an invite link over adding people who never asked to be in the group.
Can I use the n8n WhatsApp Business Cloud node instead?
No, because that node wraps Meta's official Cloud API, and the official API has no endpoint for creating a group, adding members or reading a group's participants. The generic HTTP Request node against Wapito is the only route to groups from n8n, which is why this recipe never touches the built-in WhatsApp node.
Related
Endpoints this recipe calls
Try it on your own number
Create a channel, link a WhatsApp number by QR or pairing code, and call the API in a couple of minutes. The Sandbox plan is free and needs no card.