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

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

async function broadcastMessage() {
  const response = await client.message.broadcast({
    chat_ids: ['919537851844'],
    message: 'Hi from Periskope'
  });

  console.log(response);
}

broadcastMessage();
{
  "broadcast_id": "b25192d5-2370-4a69-b844-aae5e2bfae92"
}

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:

"918527184400"

Body

application/json

Response

200 - application/json
200 OK

The response object contains the broadcast_id

You can check the status and logs of the broadcast jobs from the /queue/jobs endpoint

The broadcast_id can also be mapped in the message object against the broadcast_id (same key)