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 updateChatOverrideAccess() {
const response = await client.chat.updateChatOverrideAccess({
access: {
"alice@example.com": true,
"bob@example.com": false
},
chat_ids: [
"91882424xxxx@c.us",
"91910024xxxx@c.us"
],
replace: false
});
console.log(response);
}
updateChatOverrideAccess();curl -X PATCH \
https://api.periskope.app/v1/chats/access \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"access": {
"alice@example.com": true,
"bob@example.com": false
},
"chat_ids": [
"91882424xxxx@c.us",
"91910024xxxx@c.us"
],
"replace": false
}'{}{
"code": "VALIDATION_ERROR",
"fields": {
"chat_ids": {
"message": "chat_ids is missing"
},
"access": {
"message": "access is missing"
}
},
"message": "Invalid body. All of the following keys are required: chat_ids, access",
"name": "Validation Error",
"status": 422
}Chat APIs
Update Chat Access
This endpoint overrides the default chat access for a user. This can only be used to provide access to users for a chat and cannot be used to remove access.
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 updateChatOverrideAccess() {
const response = await client.chat.updateChatOverrideAccess({
access: {
"alice@example.com": true,
"bob@example.com": false
},
chat_ids: [
"91882424xxxx@c.us",
"91910024xxxx@c.us"
],
replace: false
});
console.log(response);
}
updateChatOverrideAccess();curl -X PATCH \
https://api.periskope.app/v1/chats/access \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"access": {
"alice@example.com": true,
"bob@example.com": false
},
"chat_ids": [
"91882424xxxx@c.us",
"91910024xxxx@c.us"
],
"replace": false
}'{}{
"code": "VALIDATION_ERROR",
"fields": {
"chat_ids": {
"message": "chat_ids is missing"
},
"access": {
"message": "access is missing"
}
},
"message": "Invalid body. All of the following keys are required: chat_ids, access",
"name": "Validation Error",
"status": 422
}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}}"
Body
application/json
- An object mapping user emails to boolean access flags
- Note: This replaces the current override chat access property of the chats
Example:
{ "alice@gmail.com": true, "bob@gmail.com": false }
- An array of chat_ids to update
- When true, the existing chat access overrides are fully replaced with the access map provided in this request
- When false, the provided access values are merged into the existing overrides (only updating the specified users without removing others)
Response
204 OK
204 No Content
Was this page helpful?