Skip to content

Sender Action ​

POSThttps://api.repliz.com/public/chat/{chatId}/action

Shows or hides the typing indicator in a conversation, or marks the person's messages as seen.

Endpoint Details ​

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

Parameters ​

ParameterTypeRequiredDescription
chatIdstringYesID of the chat to send the action to, the _id from Get Chat.

Request Body ​

FieldTypeRequiredDescription
actionstringYestyping_on shows the typing indicator, typing_off hides it, and mark_seen marks the person's messages as seen and clears the unreadCount of the chat in Repliz.

Platforms ​

Platformtyping_ontyping_offmark_seen
FacebookYes, until you send a message or for about 20 secondsYesYes
InstagramYes, until you send a message or for about 20 secondsYesYes
TikTokYes, for 5 secondsNoYes
TelegramYes, for 5 seconds or until you send a messageYesYes

To keep the indicator on while you prepare a longer reply, send typing_on again before it runs out. typing_off on TikTok returns 400 typing_off is not supported on tiktok. When the platform refuses an action, for example outside its reply window, the request fails with the platform's error.

mark_seen only marks the messages on the platform; it doesn't change the status of any message in Repliz. To clear the unread count without the person seeing it, use Read Chat instead.

Example Request ​

bash
curl -X POST "https://api.repliz.com/public/chat/680affa5ce12f2f72916f67e/action" \
  -H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "typing_on"
  }'
javascript
import axios from 'axios';

const chatId = '680affa5ce12f2f72916f67e';

const response = await axios.post(
  `https://api.repliz.com/public/chat/${chatId}/action`,
  { action: 'typing_on' },
  {
    auth: {
      username: 'YOUR_ACCESS_KEY',
      password: 'YOUR_SECRET_KEY',
    },
  },
);

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

const chatId = '680affa5ce12f2f72916f67e';

const response = await fetch(`https://api.repliz.com/public/chat/${chatId}/action`, {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ action: 'typing_on' }),
});

console.log(response.status);

Reply like a person ​

Show the typing indicator for a moment, then send the reply with Send Message. Sending the message hides the indicator.

javascript
const auth = { username: 'YOUR_ACCESS_KEY', password: 'YOUR_SECRET_KEY' };
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

async function reply(chatId, text) {
  await axios.post(
    `https://api.repliz.com/public/chat/${chatId}/action`,
    { action: 'mark_seen' },
    { auth },
  );
  await axios.post(
    `https://api.repliz.com/public/chat/${chatId}/action`,
    { action: 'typing_on' },
    { auth },
  );

  await sleep(3000);

  await axios.post(
    `https://api.repliz.com/public/chat/${chatId}/message`,
    { type: 'text', text },
    { auth },
  );
}

Response ​

json
// No content returned on success
json
// action is not one of typing_on, typing_off, mark_seen
{
  "code": 400,
  "message": "action must be one of the following values: typing_on, typing_off, mark_seen"
}

// typing_off on TikTok
{
  "code": 400,
  "message": "typing_off is not supported on tiktok"
}
json
{
  "code": 404,
  "message": "chat not found"
}
json
{
  "code": 401,
  "message": "unauthorized"
}