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

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

async function demoteParticipant() {
  const response = await client.group.demoteParticipant({
    chat_id: '120363371308389685@g.us',
    participants: ['919537851844']
  });

  console.log(response);
}

demoteParticipant();
{
  "919537851844@c.us": {
    "is_success": true
  }
}

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}}"

Path Parameters

chat_id
string
required
Example:

"120363371308389685@g.us"

Body

application/json
participants
string[]
required
  • Provide a list of participants to be demoted in the group (in country_code + number format).
Example:
["919537851844"]

Response

200 - application/json
200 OK

The response is an object with is_success value for each participant