Skip to content

Create Broadcast ​

POSThttps://api.repliz.com/public/broadcast

Send one message to many chats of a Facebook, Instagram, TikTok, or Telegram account, for example to follow up the chats nobody answered yet.

Endpoint Details ​

  • Authentication: Basic Auth (Authorization: Basic Base64(AccessKey:SecretKey)) or Bearer token from Login with Repliz
  • Scope (Bearer only): broadcast:write
  • Access Tier: Premium+

Request Body ​

FieldTypeRequiredDescription
accountIdstringYesThe Facebook, Instagram, TikTok, or Telegram account to send from, the _id from Get Account. It has to be connected.
audiencestringYesunreplied or all, the list the chats come from, as in Get Broadcast Audience. With unreplied, a chat answered before its turn is skipped.
delaynumberYesSeconds between two messages: 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, or 3600 (1 hour).
isAllbooleanNotrue sends to the whole audience (its 1,000 newest chats) except excludedChatIds, without listing it first. Otherwise chatIds says who gets it.
chatIdsstring[]Unless isAllUp to 1,000 chat _ids from Get Broadcast Audience. Chats that no longer match the audience are left out.
excludedChatIdsstring[]NoWith isAll, the chats to leave out.
textstringUnless mediaUp to 1,000 characters. {name} becomes each person's name and {Hi|Hello} picks one at random, so each person gets their own version.
mediaobjectNoOne image or video, sent right after the text as its own message, see the Media Object. Facebook, Instagram, and Telegram only.

Media Object ​

FieldTypeRequiredDescription
typestringYesimage or video.
urlstringYesPublic URL of the file, for example from Storage. The platform downloads it from here.
mimetypestringYesFor example image/jpeg or video/mp4.
thumbnailstringNoPreview shown in Repliz, and the video cover on Telegram.
durationnumberNoVideo length in seconds.

How It Works ​

  • Repliz sends to one chat at a time, delay seconds apart. On Facebook, Instagram, and TikTok the chats closest to the end of their 24-hour window go first.
  • Just before each send it checks the chat again. A chat whose 24-hour window closed, or that was answered before its turn with unreplied, is skipped. Telegram has no window.
  • The text goes first, then the image or video. Sent messages show in the chat like any message the account sends, and the broadcast doesn't pause the chat's automation.
  • One broadcast runs per account at a time. Follow it with Get One Broadcast and Get Broadcast Recipient, and stop it with Cancel Broadcast.
  • Broadcasts are kept for 30 days after their last send.

Example Request ​

bash
curl -X POST "https://api.repliz.com/public/broadcast" \
  -H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "680affa5ce12f2f72916f67e",
    "audience": "unreplied",
    "delay": 5,
    "isAll": true,
    "excludedChatIds": [],
    "text": "{Halo|Hai} {name}, maaf baru sempat balas 🙏 Ada yang bisa kami bantu?"
  }'
javascript
import axios from 'axios';

const response = await axios.post(
  'https://api.repliz.com/public/broadcast',
  {
    accountId: '680affa5ce12f2f72916f67e',
    audience: 'unreplied',
    delay: 5,
    isAll: true,
    excludedChatIds: [],
    text: '{Halo|Hai} {name}, maaf baru sempat balas 🙏 Ada yang bisa kami bantu?',
  },
  {
    auth: {
      username: 'YOUR_ACCESS_KEY',
      password: 'YOUR_SECRET_KEY',
    },
  },
);

console.log(response.data);
javascript
const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');

const response = await fetch('https://api.repliz.com/public/broadcast', {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    accountId: '680affa5ce12f2f72916f67e',
    audience: 'unreplied',
    delay: 5,
    isAll: true,
    excludedChatIds: [],
    text: '{Halo|Hai} {name}, maaf baru sempat balas 🙏 Ada yang bisa kami bantu?',
  }),
});

const data = await response.json();
console.log(data);

Response ​

FieldTypeDescription
broadcastIdstringID of the new broadcast.
totalnumberChats it goes to.
json
{
  "broadcastId": "6927e1c2e4b0a1f2c3d4e5f6",
  "total": 120
}
json
{
  "code": 400,
  "message": "none of the chats can receive a broadcast now"
}
json
{
  "code": 404,
  "message": "account not found"
}
json
{
  "code": 409,
  "message": "a broadcast is still running on this account"
}
json
{
  "code": 401,
  "message": "unauthorized"
}