TypeScript
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: '919876543210', // the phone to act with (x-phone)
});
async function main() {
const response = await client.chats.addGroupParticipants({
chat_id: '120363000000000000@g.us',
participants: [
'922222222222',
],
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/chats/120363000000000000@g.us/add' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210' \
-H 'Content-Type: application/json' \
-d '{
"participants": [
"922222222222"
]
}'{
"922222222222@c.us": {
"is_success": true,
"message": "Invite sent to participant"
}
}{
"code": "ERROR",
"message": "The phone is disconnected or its server is off/unreachable",
"status": 400
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Group Settings APIs
Add Participant to Group
Adds the given phone numbers to the group. Participants whose privacy settings disallow direct adds receive an invite; returns a per-participant outcome map.
TypeScript
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: '919876543210', // the phone to act with (x-phone)
});
async function main() {
const response = await client.chats.addGroupParticipants({
chat_id: '120363000000000000@g.us',
participants: [
'922222222222',
],
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/chats/120363000000000000@g.us/add' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210' \
-H 'Content-Type: application/json' \
-d '{
"participants": [
"922222222222"
]
}'{
"922222222222@c.us": {
"is_success": true,
"message": "Invite sent to participant"
}
}{
"code": "ERROR",
"message": "The phone is disconnected or its server is off/unreachable",
"status": 400
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Authorizations
Headers
Optional. Phone to act with: country code + number without symbols or spaces (e.g. 911111111111), or a phone_id (phone-xxxxxxxxxxxx). Omit to let the API select an eligible phone automatically — within the token's phone scopes and connected; chat actions use a phone that has the chat (a group admin where required), message actions use the phone the message belongs to.
Example:
"919876543210"
Path Parameters
Body
application/json
Was this page helpful?