import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.chats.updateChatAccess({
access: {
'user@example.com': true,
},
chat_ids: [
'120363000000000000@g.us',
'922222222222@c.us',
],
});
console.log(response);
}
main();curl -X PATCH 'https://api.periskope.app/v1/chats/access' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"access": {
"user@example.com": true
},
"chat_ids": [
"120363000000000000@g.us",
"922222222222@c.us"
]
}'{
"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
}Update Chat Access
Overrides member access on one or more chats via a map of member email to access flag. Merges into existing overrides unless replace is true. Pass null or an empty object as access with replace true to remove every override.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.chats.updateChatAccess({
access: {
'user@example.com': true,
},
chat_ids: [
'120363000000000000@g.us',
'922222222222@c.us',
],
});
console.log(response);
}
main();curl -X PATCH 'https://api.periskope.app/v1/chats/access' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"access": {
"user@example.com": true
},
"chat_ids": [
"120363000000000000@g.us",
"922222222222@c.us"
]
}'{
"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
Your Periskope API token, sent as Authorization: Bearer <token>. Generate one from the Periskope dashboard under Settings → API & Webhooks. API access requires an active Pro or Enterprise plan.
Body
Map of workspace member emails to access flags. Set an email to true to grant the member access to the chats, false to revoke it. Pass null or an empty object together with replace true to remove every access override from the chats; without replace an empty map changes nothing.
Show child attributes
Show child attributes
{ "user@example.com": true }
Ids of the chats whose access overrides to update
1[
"120363000000000000@g.us",
"922222222222@c.us"
]
When true, the existing access overrides of each chat are fully replaced with the given access map (an empty or null map then removes every override). Defaults to false (the map is merged into the existing overrides; an empty or null map changes nothing).
false
Response
Chat access overrides updated — no content
Was this page helpful?