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 updateLabels() {
const response = await client.contact.updateLabels({
contact_ids: ['919537851844'],
labels: 'Test, Demo'
});
console.log(response);
}
updateLabels();curl -X PATCH \
https://api.periskope.app/v1/contacts/labels \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"contact_ids": ["919537851844"],
"labels": "Test, Demo"
}'{}{
"code": "VALIDATION_ERROR",
"fields": {
"contact_ids": {
"message": "contact_ids is missing"
},
"labels": {
"message": "labels is missing"
}
},
"message": "Invalid body. All of the following keys are required: contact_ids, labels",
"name": "Validation Error",
"status": 422
}Contact APIs
Update Contact Labels
This endpoint updates the labels for specific contacts
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 updateLabels() {
const response = await client.contact.updateLabels({
contact_ids: ['919537851844'],
labels: 'Test, Demo'
});
console.log(response);
}
updateLabels();curl -X PATCH \
https://api.periskope.app/v1/contacts/labels \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"contact_ids": ["919537851844"],
"labels": "Test, Demo"
}'{}{
"code": "VALIDATION_ERROR",
"fields": {
"contact_ids": {
"message": "contact_ids is missing"
},
"labels": {
"message": "labels is missing"
}
},
"message": "Invalid body. All of the following keys are required: contact_ids, labels",
"name": "Validation Error",
"status": 422
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
204 OK
204 No Content
Was this page helpful?