Node.js
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();curl -X POST \
https://api.periskope.app/v1/chats/{chat_id}/demote \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"participants": ['919537851844']
}'{
"919537851844@c.us": {
"is_success": true
}
}Group Settings APIs
Demote Participant to Member
This endpoint demotes a participant in a group to member
Node.js
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();curl -X POST \
https://api.periskope.app/v1/chats/{chat_id}/demote \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"participants": ['919537851844']
}'{
"919537851844@c.us": {
"is_success": true
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
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
Example:
"120363371308389685@g.us"
Body
application/json
- 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
Was this page helpful?