English
Send Typing
POST/typingShow a "typing..." or "recording audio..." indicator in the receiving chat for 5 seconds. Call it a few seconds before Send Message so your replies feel more human.
Endpoint Details
- Base URL:
https://api-zate.azickri.com - Headers:
id,session-id, andContent-Type: application/json - Requirement: the session must be connected (
isConnected: true)
Headers
| Header | Type | Required | Description |
|---|---|---|---|
id | string | Yes | id from Create Session. |
session-id | string | Yes | sessionId from Create Session. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
group | string | One of* | Group ID or a public group's username. |
user | string | One of* | Telegram user ID. |
username | string | One of* | Recipient username, with or without @, or a t.me link. |
phone | string | One of* | Phone number in international format. Only works if the person's privacy allows it. |
type | string | No | audio for "recording audio...". Anything else (or empty) shows "typing...". |
* Fill in one of group, user, username, or phone. The priority order is the same as Send Message, minus channel, since channels have no typing indicator.
Example Request
bash
curl -X POST "https://api-zate.azickri.com/typing" \
-H "id: YOUR_ID" \
-H "session-id: YOUR_SESSION_ID" \
-H "Content-Type: application/json" \
-d '{"username":"@azickri","type":"text"}'javascript
import axios from 'axios';
const response = await axios.post(
'https://api-zate.azickri.com/typing',
{
username: '@azickri',
type: 'text',
},
{
headers: {
'id': 'YOUR_ID',
'session-id': 'YOUR_SESSION_ID',
},
},
);
console.log(response.data);javascript
const response = await fetch('https://api-zate.azickri.com/typing', {
method: 'POST',
headers: {
'id': 'YOUR_ID',
'session-id': 'YOUR_SESSION_ID',
'Content-Type': 'application/json',
},
body: JSON.stringify({
username: '@azickri',
type: 'text',
}),
});
const data = await response.json();
console.log(data);Response
json
{
"id": "68b3f0a2c1d4e5f6a7b8c9d0"
}json
// No receiver
{
"statusCode": 400,
"message": "invalid phone, username, user or group"
}
// Username or ID not found
{
"statusCode": 400,
"message": "chat not found"
}json
{
"statusCode": 404,
"message": "session not found"
}json
{
"statusCode": 500,
"message": "session not connected"
}| Field | Type | Description |
|---|---|---|
id | string | Session ID. |
Make It Feel Human
Combine typing with a short pause before sending the message:
javascript
const BASE_URL = 'https://api-zate.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 replyLikeAHuman(username, text) {
await fetch(`${BASE_URL}/typing`, {
method: 'POST',
headers,
body: JSON.stringify({ username, type: 'text' }),
});
// The indicator shows for 5 seconds, send the message before it ends
await sleep(3000);
await fetch(`${BASE_URL}/message`, {
method: 'POST',
headers,
body: JSON.stringify({ username, type: 'text', text }),
});
}