Skip to content

Send Typing ​

POST /typing

This endpoint sends a presence update (whatever the proper name is, lol): the "typing…" or "recording audio…" indicator in the recipient's chat. It makes your bot feel more human instead of replying out of nowhere.

The indicator shows for 5 seconds, then disappears on its own.

Endpoint Details ​

  • Base URL: https://api-zawa.azickri.com
  • Headers: id, session-id, and Content-Type: application/json
  • Requires: a connected session (isConnected: true)

Headers ​

HeaderTypeRequiredDescription
idstringYesThe id from Create Session.
session-idstringYesThe sessionId from Create Session.

Request Body ​

FieldTypeRequiredDescription
phonestringOne of*Recipient number in international format, e.g. 6281234567890.
groupstringOne of*Group ID, e.g. [email protected].
typestringNotext for "typing…" (default), audio for "recording audio…".

* Fill in either phone or group. If both are set, group is used.

Example Request ​

bash
curl -X POST "https://api-zawa.azickri.com/typing" \
  -H "id: YOUR_ID" \
  -H "session-id: YOUR_SESSION_ID" \
  -H "Content-Type: application/json" \
  -d '{"phone":"6281234567890","type":"text"}'
javascript
import axios from 'axios';

const response = await axios.post(
  'https://api-zawa.azickri.com/typing',
  {
    phone: '6281234567890',
    type: 'text',
  },
  {
    headers: {
      'id': 'YOUR_ID',
      'session-id': 'YOUR_SESSION_ID',
    },
  },
);

console.log(response.data);
javascript
const response = await fetch('https://api-zawa.azickri.com/typing', {
  method: 'POST',
  headers: {
    'id': 'YOUR_ID',
    'session-id': 'YOUR_SESSION_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    phone: '6281234567890',
    type: 'text',
  }),
});

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

Response ​

json
{
  "id": "68b3f0a2c1d4e5f6a7b8c9d0"
}
json
// No recipient
{
  "statusCode": 400,
  "message": "invalid phone or group"
}

// Missing headers
{
  "statusCode": 400,
  "message": "invalid header"
}
json
{
  "statusCode": 404,
  "message": "session not found"
}
json
{
  "statusCode": 500,
  "message": "session not connected"
}
FieldTypeDescription
idstringThe ID of the session that sent the indicator. This is not a message ID.

Recipe: Reply Like a Human ​

Pair it with Send Message so your bot's replies don't feel robotic:

javascript
const BASE_URL = 'https://api-zawa.azickri.com';
const headers = {
  'id': 'YOUR_ID',
  'session-id': 'YOUR_SESSION_ID',
  'Content-Type': 'application/json',
};
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

async function replyLikeHuman(phone, text) {
  // 1. Show "typing…"
  await fetch(`${BASE_URL}/typing`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ phone, type: 'text' }),
  });

  // 2. Pretend to think for a moment (5 seconds at most, matching the indicator)
  await sleep(Math.min(5000, 1000 + text.length * 50));

  // 3. Send the message
  await fetch(`${BASE_URL}/message`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ phone, type: 'text', text }),
  });
}

await replyLikeHuman('6281234567890', 'Got it, your order is being processed! 🙌');