Create a WhatsApp group from a Make scenario

Create a WhatsApp group from a Make scenario whenever a new project, order or cohort needs its own chat, with the members mapped from the trigger. An HTTP module posts the group to Wapito, Make parses the response, and the group id is written back to the record that started the scenario.

Before you start

  • A Make account on any plan that allows the HTTP app and at least a handful of operations per run.
  • A Wapito channel that is connected, and its channel token.
  • A trigger module whose bundle carries a name for the group and the phone numbers of the first members, for example a Watch Records module on a CRM or a form tool.

Step by step in Make

  1. Add the trigger and an array aggregator for the members

    Start the scenario with the module that knows a group is needed, then add an Array Aggregator that collects the phone numbers into one array, because the participants field has to be a single JSON array rather than a bundle per person. If the numbers live in one text field separated by commas, a Text parser module splitting on the comma feeds the aggregator instead.

    Field map
    Wapito fieldWhere it comes from
    participantsArray Aggregator output — one element per phone number, in international format
  2. Configure HTTP > Make a request against the groups endpoint

    Add an HTTP > Make a request module. Set the URL to https://api.wapito.com/v1/groups and the method to POST, add a header named Authorization whose value is Bearer followed by your channel token, and add a second header Content-Type with the value application/json. Set the body type to Raw and the content type to JSON so the module sends exactly the bytes you map.

    Field map
    Wapito fieldWhere it comes from
    AuthorizationHeader — Bearer wpt_… (your channel token)
    Content-TypeHeader — application/json
  3. Map the request body from the bundle

    In the request content, write the JSON object with mapped pills rather than pasted values: the subject from the trigger's name field, the participants from the aggregator, and an optional description. Wrap the subject pill in quotes as the JSON needs, and use the aggregator's array pill directly for participants so Make serialises it as a real array instead of a string that looks like one.

    Field map
    Wapito fieldWhere it comes from
    description{{1.summary}} — optional text set on the group at creation
    participants{{3.array}} — the aggregated phone numbers
    subject{{1.name}} — the group name, up to 100 characters
  4. Switch on Parse response and read the group id

    Enable Parse response on the HTTP module so the reply becomes fields the next modules can map, instead of a JSON string you would have to parse yourself. The group id is the id field of the data output, a long numeric string ending in @g.us; Make keeps it as text, but the module you write it to has to as well, or a numeric column will round the digits away.

    Field map
    Wapito fieldWhere it comes from
    group_id{{4.data.id}} — store as text, for example 120363041234567890@g.us
    invite_code{{4.data.invite_code}} — optional, for a join link later in the scenario
  5. Write the id back to the source record

    Add an Update Record module for the app that triggered the scenario and map the group id into a text field on that record. The scenario now owns the link between the project and its group, which means a later scenario can message the group by reading one field, and a re-run on the same record can check the field and skip creation instead of opening a second group.

    Field map
    Wapito fieldWhere it comes from
    record.whatsapp_group{{4.data.id}} — a text field on the triggering record
  6. Add an error handler so a refused request is visible

    Right-click the HTTP module, add an error handler, and route it to a Slack, email or Data store module that records the response body. Wapito answers a refused creation with a JSON error whose code names the reason, such as invalid_recipient for a number that is not dialable or channel_not_connected when the linked phone is offline, and that code is what the alert should show.

    Field map
    Wapito fieldWhere it comes from
    error.code{{4.data.error.code}} inside the error handler route

Test it

Run the scenario once with a record whose members are your own second phone. The HTTP module's output should show status 201 and a data.id ending in @g.us, the phone should receive the group invitation, and the triggering record should now carry that id in its text field.

Errors you may hit

Frequently asked questions

How many Make operations does creating a group use?

One operation for the HTTP module, plus one for each other module in the run: the trigger, the aggregator, the update. A scenario that creates one group per run therefore costs a handful of operations, and the only way it becomes expensive is a trigger that fires once per member instead of once per group, which the aggregator step exists to prevent.

Should I store the token in a connection instead of a header?

Make's HTTP app offers an API-key connection that can carry the Authorization header for you, and it is the better choice when several scenarios call Wapito, because rotating the token then means editing one connection. A plain header is fine for a single scenario; either way the token should not be visible in a scenario shared with a teammate.

Why is a member missing from the group after a successful run?

WhatsApp lets a person block being added to groups by strangers, and Wapito cannot override that setting. The creation still succeeds and the response still lists the group, but that person is not in it. Read the participants back after creation if membership matters, and share the invite link with anyone who was not added so they can join on their own terms.

Related

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.