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.getMessageQueuesHealth();
console.log(response);
}
main();curl -X GET 'https://api.periskope.app/v1/message/queues/health' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210'{
"is_running": true,
"active": 0,
"pending": 2,
"completed": 40,
"failed": 1
}{
"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
}Get Status of Message Queues
Returns live counters of the send queue of the phone: running state plus active, pending, completed and failed job counts.
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.getMessageQueuesHealth();
console.log(response);
}
main();curl -X GET 'https://api.periskope.app/v1/message/queues/health' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210'{
"is_running": true,
"active": 0,
"pending": 2,
"completed": 40,
"failed": 1
}{
"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
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.
Headers
Phone to act with: country code + number without symbols or spaces (e.g. 911111111111), or a phone_id (phone-xxxxxxxxxxxx). The phone must be connected to the org and accessible by the API token.
1"919876543210"
Response
The current queue counters of the phone
Live counters of the message send queue of a phone
Whether the send queue of the phone is currently processing jobs
true
Number of jobs currently being processed
0
Number of jobs waiting to be processed
2
Number of completed jobs still retained in the queue
40
Number of failed jobs retained in the queue
1
Was this page helpful?