import { PeriskopeApi } from '@periskope/periskope-client';

const client = new PeriskopeApi({
  authToken: 'YOUR_API_KEY',
  phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});

async function getQueueJobs() {
  const response = await client.queue.getJobs({
    queue_id: '63cda77b-73de-433e-a652-a8f489100d43'
  });

  console.log(response);
}

getQueueJobs();
[
  {
    "addedTimestamp": 1737373507280,
    "attemptsMade": 1,
    "attemptsStarted": 1,
    "data": {
      "body": "You have been invited to join Test Czech Republic\n\nhttps://chat.whatsapp.com/invite/B7NJcQ8qKR68G4CMHvSx9n. \n\nIf you cannot click the link, please respond to this message, and the link will become active",
      "chat_id": "919537851844@c.us"
    },
    "finishedTimestamp": 1737373510691,
    "id": "63cda77b-73de-433e-a652-a8f489100d43",
    "message_id": "3EB0BB657AE18C4D3BB276DFB67F6CCA7DD13234",
    "processedTimestamp": 1737373507380,
    "stacktrace": [],
    "status": "completed"
  }
]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-phone
string

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

Example:

"{{orgPhone}}"

Query Parameters

queue_id
string

Provide the queue_id of the message to filter for that job

Example:

"63cda77b-73de-433e-a652-a8f489100d43"

broadcast_id
string

Provide the broadcast_id to filter all messages of that broadcast

Example:

""

Body

application/json · any

The body is of type any.

Response

200 - application/json
200 OK

The response is a JSON object of the message job. Refer to the message job object here