# Automatic line message

`POST /v1/bots/:botId/openlines/session/auto-message`

Bitrix24 method: `imopenlines.bot.session.message.send`. Requires `imbot` and `imopenlines`, the key owning the bot and write access.

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/bots/621/openlines/session/auto-message" \
  -H "X-Api-Key: $VIBE_API_KEY" -H "Content-Type: application/json" \
  -d '{"chatId": 2043, "type": "DEFAULT", "message": "VIBE-PROBE Hello"}'
```

`type` is required: `WELCOME` sends the line welcome template; `DEFAULT` sends a system message to the client connector. DEFAULT requires a string `message`, excluding empty string and `"0"`, which Bitrix24 silently skips. This is not a normal bot message. Bitrix24 does not report whether a message was sent: a missing session or an internal validation refusal can still return true. `accepted` acknowledges only the REST call. This method does not need `CLIENT_ID`.

```json
{
  "success": true,
  "data": {
    "chatId": 2043,
    "accepted": true
  }
}
```

Identifiers: `chatId` / `dialogId` / `CHAT_ID` follow the [shared rules](../openlines.md).

## Refusals

| HTTP | Codes |
|---|---|
| 400 | INVALID_BOT_ID / INVALID_CHAT_ID / INVALID_PARAMS / MISSING_REQUIRED_FIELDS / MISSING_TRANSFER_TARGET / INVALID_TRANSFER_TARGET |
| 401 | MISSING_API_KEY / TOKEN_MISSING |
| 403 | SCOPE_DENIED / BOT_ACCESS_DENIED / WRITE_BLOCKED_READONLY_KEY / BITRIX_ACCESS_DENIED |
| 404 | BOT_NOT_FOUND / ENTITY_NOT_FOUND |
| 410 | BOT_DISABLED |
| 422 | BITRIX_ERROR; b24Code carries the Bitrix24 refusal, such as WRONG_CHAT, BOT_ID_ERROR, OPERATOR_WRONG or WRONG_AUTH_TYPE |
| 429 | RATE_LIMITED or portal queue refusal |
| 502 | OPENLINE_BOT_SESSION_FAILED / BITRIX_UNAVAILABLE |
| 503 | BITRIX_TIMEOUT or key-owner deletion freeze |

Bitrix24 business prose is preserved with credentials removed. Do not mutate other users' sessions when testing.
