
## Typing indicator

`POST /v1/bots/:botId/typing`

Shows a status indicator in the chat. Call it before sending a reply so the user can see the bot is working.

## Request fields (body)

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `dialogId` | string | yes | — | Dialog ID: numeric user ID for direct messages, `chatXXX` for group chats |
| `statusMessageCode` | string | no | — | Action status code (see [the table below](#status-codes)). Without the parameter — the standard "typing" indicator |
| `duration` | number | no | — | Display duration in seconds (1-600) |

## Status codes

| Code | Description |
|-----|---------|
| `IMBOT_AGENT_ACTION_THINKING` | Thinking |
| `IMBOT_AGENT_ACTION_SEARCHING` | Searching |
| `IMBOT_AGENT_ACTION_GENERATING` | Generating |
| `IMBOT_AGENT_ACTION_ANALYZING` | Analyzing |
| `IMBOT_AGENT_ACTION_PROCESSING` | Processing |
| `IMBOT_AGENT_ACTION_TRANSLATING` | Translating |
| `IMBOT_AGENT_ACTION_CONNECTING` | Connecting |
| `IMBOT_AGENT_ACTION_CHECKING` | Checking |
| `IMBOT_AGENT_ACTION_CALCULATING` | Calculating |
| `IMBOT_AGENT_ACTION_READING_DOCS` | Reading documentation |
| `IMBOT_AGENT_ACTION_COMPOSING` | Composing a reply |

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/typing \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dialogId": "chat123",
    "statusMessageCode": "IMBOT_AGENT_ACTION_THINKING",
    "duration": 30
  }'
```

### curl — OAuth app

```bash
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/typing \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "dialogId": "chat123",
    "statusMessageCode": "IMBOT_AGENT_ACTION_THINKING",
    "duration": 30
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/typing', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    dialogId: 'chat123',
    statusMessageCode: 'IMBOT_AGENT_ACTION_THINKING',
    duration: 30,
  }),
})

const { success, data } = await res.json()
```

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/typing', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    dialogId: 'chat123',
    statusMessageCode: 'IMBOT_AGENT_ACTION_THINKING',
    duration: 30,
  }),
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `data.result` | boolean | `true` on successful send |

## Response example

```json
{
  "success": true,
  "data": {
    "result": true
  }
}
```

## Error response example

404 — bot not found:

```json
{
  "success": false,
  "error": {
    "code": "BOT_NOT_FOUND",
    "message": "Bot 999 not found. Register it first via POST /v1/bots."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_BOT_ID` | `botId` is not a number |
| 404 | `BOT_NOT_FOUND` | No bot found with this ID |
| 403 | `BOT_ACCESS_DENIED` | The bot belongs to a different API key |
| 502 | `BITRIX_ERROR` | Bitrix24 error (error text in `message`) |
| 403 | `SCOPE_DENIED` | The API key lacks the `imbot` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**AI bots:** use `statusMessageCode` for an informative status. For example, `IMBOT_AGENT_ACTION_ANALYZING` while processing the request, then `IMBOT_AGENT_ACTION_COMPOSING` before sending the reply.

**Automatic hiding:** the indicator disappears when the bot sends a message or after `duration` elapses.

## See also

- [Input field control](/docs/bots/ui/text-field)
- [Send message](/docs/bots/messages/send)
- [Bot platform](/docs/bots)
- [Limits and optimization](/docs/optimization)
