👥 Groups

Endpoints

See the list of engines that support the feature ->.

Endpoints for groups. Please look at swagger for details.

  • {session} - use the session name for Whatsapp instance that you created with POST /api/session/start endpoint
  • {groupId} - group id in format 123123123123@g.us. You can get the id in a few ways:

Create a new group

POST /api/{session}/groups

Request:

{
  "name": "Group name",
  "participants": [
    {
      "id": "123123123123@c.us"
    }
  ]
}

Get all groups

GET /api/{session}/groups

Get the group

GET /api/{session}/groups/{groupId}

Delete the group

DELETE /api/{session}/groups/{groupId}

Leave the group

POST /api/{session}/groups/{groupId}/leave

Set group subject

Updates the group subject.

Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.

PUT /api/{session}/groups/{groupId}/subject

Request:

{
  "subject": "Group name"
}

Set group description

Updates the group description.

Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.

PUT /api/{session}/groups/{groupId}/description

Request:

{
  "description": "Group description"
}

Security - update group info

Updates the group settings to only allow admins to edit group info (title, description, photo). PUT /api/{session}/groups/{groupId}/settings/security/info-admin-only

{
  "adminsOnly": true
}

Get the group settings to only allow admins to edit group info (title, description, photo).

GET /api/{session}/groups/{groupId}/settings/security/info-admin-only

{
  "adminsOnly": true
}

Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.

Security - who can send messages

Updates the group settings to only allow admins to send messages.

PUT /api/{session}/groups/{groupId}/settings/security/messages-admin-only

{
  "adminsOnly": true
}

Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.

Get the group settings to only allow admins to send messages.

GET /api/{session}/groups/{groupId}/settings/security/messages-admin-only

{
  "adminsOnly": true
}

Participants

Get participants

GET /api/{session}/groups/{groupId}/participants

Add participants

POST /api/{session}/groups/{groupId}/participants/add

{
  "participants": [
    {
      "id": "123123123123@c.us"
    }
  ]
}

Remove participants

POST /api/{session}/groups/{groupId}/participants/remove

{
  "participants": [
    {
      "id": "123123123123@c.us"
    }
  ]
}

Admin

Promote to admin

Promote participants to admin users.

POST /api/{session}/groups/{groupId}/admin/promote

{
  "participants": [
    {
      "id": "123123123123@c.us"
    }
  ]
}

Demote to regular users

Demote participants by to regular users.

POST /api/{session}/groups/{groupId}/admin/demote

{
  "participants": [
    {
      "id": "123123123123@c.us"
    }
  ]
}

Invite code

Get invite code

GET /api/{session}/groups/{groupId}/invite-code

Then you can put it in the url https://chat.whatsapp.com/{inviteCode} and send it to contacts.

Revoke invite code

Invalidates the current group invite code and generates a new one.

POST /api/{session}/groups/{groupId}/invite-code/revoke

Webhooks

See the list of engines that support the feature ->.

group.join

{
  "event": "group.join",
  "session": "default",
  "engine": "WEBJS",
  "payload": {
    ...
  }
}

group.leave

{
  "event": "group.left",
  "session": "default",
  "engine": "WEBJS",
  "payload": {
    ...
  }
}