import { PeriskopeApi } from '@periskope/periskope-client';

const client = new PeriskopeApi({
  authToken: 'YOUR_API_KEY',
  phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});

async function createGroup() {
  const response = await client.group.create({
    group_name: 'Test New 1040',
    participants: ['919876543210', '918527184400']
  });

  console.log(response);
}

createGroup();
{
  "assigned_to": null,
  "chat_access": {
    "bharat@hashlabs.dev": true
  },
  "chat_id": "120363392071406466@g.us",
  "chat_image": null,
  "chat_name": "Test New 1040",
  "chat_type": "group",
  "closed_at": null,
  "created_at": "2025-01-27T11:07:52+00:00",
  "custom_properties": {},
  "group_description": null,
  "info_admins_only": false,
  "invite_link": "https://chat.whatsapp.com/invite/DsDQQZB3AhpLPhBTx0w6SO",
  "is_exited": false,
  "is_muted": false,
  "label_ids": {},
  "labels": [],
  "latest_message": null,
  "member_count": 1,
  "messages_admins_only": false,
  "org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
  "org_phone": "918527184400@c.us",
  "updated_at": "2025-01-27T11:07:56.025233+00:00"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-phone
string

Please provide the number of the phone you want to call with this API in the header. The number must be in country code + number format without any characters or spaces, e.g. 919876543210; Alternatively, provide the phone_id (phone-xxxxxxxxxxxx) in the header

Example:

"{{orgPhone}}"

Body

application/json

Response

200 - application/json
200 OK

The response is a chat object for the new created group. Refer to the chat object here