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 updateChatLabels() {
const response = await client.chat.updateLabels({
labels: '< LABEL 1 > , < LABEL 2 >',
chat_ids: ['< CHAT_ID 1 >', '< CHAT_ID 2 >']
});
console.log(response);
}
updateChatLabels();curl -X PATCH \
https://api.periskope.app/v1/chats/labels \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"labels": "< LABEL 1 > , < LABEL 2 >"
"chat_ids": ["< CHAT_ID 1 >', '< CHAT_ID 2 >"]
}'{}{
"code": "VALIDATION_ERROR",
"fields": {
"chat_ids": {
"message": "chat_ids is missing"
},
"labels": {
"message": "labels is missing"
}
},
"message": "Invalid body. All of the following keys are required: chat_ids, labels",
"name": "Validation Error",
"status": 422
}Chat APIs
Update Chat Labels
This endpoint updates the labels for specific chats
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 updateChatLabels() {
const response = await client.chat.updateLabels({
labels: '< LABEL 1 > , < LABEL 2 >',
chat_ids: ['< CHAT_ID 1 >', '< CHAT_ID 2 >']
});
console.log(response);
}
updateChatLabels();curl -X PATCH \
https://api.periskope.app/v1/chats/labels \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"labels": "< LABEL 1 > , < LABEL 2 >"
"chat_ids": ["< CHAT_ID 1 >', '< CHAT_ID 2 >"]
}'{}{
"code": "VALIDATION_ERROR",
"fields": {
"chat_ids": {
"message": "chat_ids is missing"
},
"labels": {
"message": "labels is missing"
}
},
"message": "Invalid body. All of the following keys are required: chat_ids, labels",
"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
Response
204 OK
204 No Content
Was this page helpful?