import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.contacts.updateContactLabels({
contact_ids: [
'911111111111',
'911111111111',
],
labels: 'lead, priority',
});
console.log(response);
}
main();curl -X PATCH 'https://api.periskope.app/v1/contacts/labels' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contact_ids": [
"911111111111",
"911111111111"
],
"labels": "lead, priority"
}'{
"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 Contact Labels
Sets the labels of one or more contacts; label names that do not exist yet are created automatically. Pass null or an empty string as labels to remove every label.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.contacts.updateContactLabels({
contact_ids: [
'911111111111',
'911111111111',
],
labels: 'lead, priority',
});
console.log(response);
}
main();curl -X PATCH 'https://api.periskope.app/v1/contacts/labels' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contact_ids": [
"911111111111",
"911111111111"
],
"labels": "lead, priority"
}'{
"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
Phone numbers of the contacts to update: country code + number without symbols or spaces (e.g. 911111111111). The @c.us suffix is also accepted.
11["911111111111", "911111111111"]
Comma-separated list of labels to put on the contact (e.g. 'lead, priority'). Labels are matched case-insensitively and labels that do not exist yet are created automatically. This replaces all current labels of the contact — pass the full desired list. Pass null or an empty string to remove every label from the contacts.
"lead, priority"
Response
Labels updated — no content
Was this page helpful?