Create a group

Works on
  • iMessage

Start a group chat with an opening message

POST/v1/commands/group.create

Creates a group chat and sends its first message in one operation. iMessage has no concept of an empty group, so the opening message is required.

Once the group exists it is a conversation too. A message someone writes in it arrives under the group's own conversationId, with isGroup: true; on that id you can send into the group, rename it or change its members with group.update, and leave it with group.leave.

Honors Idempotency-Key: a retry under the same key returns the first command, so a retried group.create never makes a second group.

Body

Target

Prop

Type

Mapier reads each participant the way the channel reads an address (a phone number to E.164, an email lower-cased) and checks the list before anything is sent. The first participant is read first: the command's line is the one that person is on. A participant that is refused, the first included, is reported at the list's own field (the one you wrote, participantExternalIds or participants) and its index. Each refusal is 422 validation_failed, the line's channel in the entry:

  • a participant the channel cannot read, at target.participantExternalIds[i] (or target.participants[i]);
  • any participant, the first included, that is an email with a control character in it, over 512 characters or not in composed Unicode (NFC), at target.participantExternalIds[i] (or target.participants[i]);
  • fewer than 2 or more than 32 people once a repeat — the same person written two ways — is counted once, at target.participantExternalIds (or target.participants).

A first participant who opted out, is blocked or is paused is 403 recipient_not_allowed, with details.reason saying which, as a send to them would be.

Payload

Prop

Type

Example request

curl https://api.mapier.ai/v1/commands/group.create \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: create-trip-planning-group" \
  -H "x-mapier-version: 2026-12-01" \
  -d '{
    "target": {
      "kind": "new_group",
      "channel": "imessage",
      "participantExternalIds": ["+14155550100", "+14155550111"]
    },
    "payload": { "firstMessage": "kickoff" }
  }'

Retry under the same Idempotency-Key. A new key is a new command, and a new group.create makes a second group. If a group.create times out, wait for the result on the stream before deciding whether to retry.

Response

202 Accepted
{
  "commandId": "0192b3e2-92c4-75a8-86d9-b4f172a3e598",
  "status": "queued",
  "repeated": false,
  "lineId": "0192a7b0-3e4f-7051-8c6d-7e8f9a0b1c2d",
  "lineSelection": "reused_active_chat"
}

A succeeded command event names the new group: conversationId is its id, and group carries the same id. A conversation.created of kind: "group" announces it too. Keep the id: it is the target.conversationId that sends into the group.

event: command
{
  "commandId": "0192b3e2-92c4-75a8-86d9-b4f172a3e598",
  "logicalActionId": "0192b3e2-92c4-75a8-86d9-b4f172a3e598",
  "status": "succeeded",
  "errorCode": null,
  "conversationId": "a0000000-0000-4000-8000-000000000002",
  "failureClass": null,
  "group": { "conversationId": "a0000000-0000-4000-8000-000000000002" }
}

whatsapp.group.create

Makes a new group on a WhatsApp line. Only a number Meta has made an Official Business Account can make one, and the command is accepted only on a number Mapier has confirmed is one: on any other it is 404 unsupported_command with reason: not_on_line, and nothing is written. GET /v1/whoami lists it among a line's capabilities once the number is confirmed. Nobody is added: people join by the group's invite link, which the result carries.

Honors Idempotency-Key.

Target

Address the line at target.lineId. target.participants is a 422 validation_failed at that field.

Payload

Field
subjectRequired. The group's name, 1 to 128 characters.
descriptionOptional. The group's description, up to 2,048 characters.

Request

curl -X POST https://api.mapier.ai/v1/commands/whatsapp.group.create \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: launch-group-1" \
  -H "x-mapier-version: 2026-12-01" \
  -d '{
    "target": { "lineId": "0192a7b0-3e4f-7051-8c6d-7e8f9a0b1c2d" },
    "payload": { "subject": "Launch day" }
  }'

Result

The answer is a 202, and the command ends when WhatsApp reports the group:

  • succeeded, with group: { conversationId, inviteLink } on the command event and on GET /v1/commands/{commandId}, and a conversation.created of kind: group for the new conversation. Send into it by that conversationId, and send the invite link to the people who should join. The link works for 90 days; keep it.
  • failed with groups_not_eligible: Meta refused the group; the number cannot use groups.
  • ambiguous with group_create_unconfirmed: WhatsApp did not confirm the group in time.

Sent to a line of another channel, the type is 404 unsupported_command with reason: not_on_channel.

Errors

Every command can return the errors listed under How commands work › Errors. Specific to this command:

  • No participants is 422 validation_failed at target.participants, before a line is resolved; a participant list the channel cannot take is refused as above, before anything is sent.
  • firstMessage empty or over 16,384 bytes: 422 validation_failed, reason invalid_text.
  • On a test line on a shared number, 404 unsupported_command with reason: shared_line unless group chats are turned on for your organization. Once they are, 2 to 10 people who are all this project's connected Test contacts, or 403 recipient_not_allowed with group_member_not_test_contact (or recipient_must_write_first for a member who must text first). Sent again under its Idempotency-Key, the same people are the same group, never a second one, and other people are 409 conflict with idempotency_key_reused. See Groups on a test line.

Result codes you will see for this command: gateway_rejected when iMessage refuses the group.

group_content_unverified is not a failure: its command event ends ambiguous, and it means the line could not confirm the group was created, not that it was not. A blind retry there makes a second group. See Groups.

Guide