TypeScript
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: '919876543210', // the phone to act with (x-phone)
});
async function main() {
const response = await client.messages.purgeMessageQueues({
queue_ids: [
'00000000-0000-0000-0000-000000000000',
],
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/message/queues/purge' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210' \
-H 'Content-Type: application/json' \
-d '{
"queue_ids": [
"00000000-0000-0000-0000-000000000000"
]
}'{
"purged": true,
"mode": "queue_ids",
"queue_ids": [
"00000000-0000-0000-0000-000000000000"
],
"broadcast_id": null
}{
"code": "ERROR",
"message": "The phone is off or its server is unreachable",
"status": 400
}{
"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
}Message APIs
Purge Message Queues
Removes unsubmitted jobs from the send queue of the phone, by queue_ids or broadcast_id. Warning: an empty body purges the entire queue.
TypeScript
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: '919876543210', // the phone to act with (x-phone)
});
async function main() {
const response = await client.messages.purgeMessageQueues({
queue_ids: [
'00000000-0000-0000-0000-000000000000',
],
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/message/queues/purge' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210' \
-H 'Content-Type: application/json' \
-d '{
"queue_ids": [
"00000000-0000-0000-0000-000000000000"
]
}'{
"purged": true,
"mode": "queue_ids",
"queue_ids": [
"00000000-0000-0000-0000-000000000000"
],
"broadcast_id": null
}{
"code": "ERROR",
"message": "The phone is off or its server is unreachable",
"status": 400
}{
"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
Headers
Body
application/json
Response
Confirmation of the purge
Was this page helpful?