import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function purgeQueueJobs() {
const result = await client.message.purgeQueueJobs({
queue_ids: ['5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400']
});
console.log(result);
}
purgeQueueJobs();curl -X POST \
https://api.periskope.app/v1/message/queues/purge \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"queue_ids": ["5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400"]
}'{
"purged": true,
"mode": "queue_ids",
"queue_ids": [
"5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400"
]
}Purge Message Queues
This endpoint purges jobs from the message queue
If neither queue_ids nor broadcast_id are provided in the request body, this will purge all the message jobs across all the queues.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function purgeQueueJobs() {
const result = await client.message.purgeQueueJobs({
queue_ids: ['5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400']
});
console.log(result);
}
purgeQueueJobs();curl -X POST \
https://api.periskope.app/v1/message/queues/purge \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"queue_ids": ["5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400"]
}'{
"purged": true,
"mode": "queue_ids",
"queue_ids": [
"5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400"
]
}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
"918527184400"
Body
Provide the queue_id of the message to purge only jobs in that queue (or an array of queue_id to purge multiple queues)
["5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400"]
Provide the broadcast_id to purge all messages of that broadcast
"b25192d5-2370-4a69-b844-aae5e2bfae92"
Response
200 OK
The response confirms the purge operation
Whether the purge operation was successful
true
The purge mode used, indicating the scope of the purge operation
all, queue_ids, broadcast "queue_ids"
The broadcast ID or queue IDs that were purged
["5df4cb6d-9f2b-46b6-936e-8e6f4b1a5400"]
Was this page helpful?