2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 1
2025-05-05 11:15:20 +03:00
description: Send text message and other functions to work with Telegram in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Send text message
Sends a text message to a chat or channel
`Function SendTextMessage(Val Token, Val ChatID, Val Text, Val Keyboard = "", Val Markup = "Markdown", Val RepliedID = 0) Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Bot token |
| ChatID | --chat | String, Number | ✔ | Target chat ID or ChatID*TopicID |
| Text | --text | String | ✔ | Message text |
2025-01-16 21:22:31 +03:00
| Keyboard | --keyboard | String, Structure Of KeyAndValue | ✖ | Keyboard. See FormKeyboardFromButtonArray |
2024-10-15 15:15:47 +03:00
| Markup | --parsemode | String | ✖ | Text processing type (HTML, Markdown, MarkdownV2) |
| RepliedID | --reply | String, Number | ✖ | Reply to message ID |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Method at API documentation: [sendMessage](https://core.telegram.org/bots/api#sendmessage)
2024-10-15 10:16:04 +03:00
:::
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-10-21 11:36:43 +03:00
Token = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
ChannelID = "@testsichee";
Text = "Строковое значение";
2024-10-15 10:16:04 +03:00
2025-01-16 21:22:31 +03:00
KeyboardButtonsArray = New Array;
KeyboardButtonsArray.Add("Button1");
KeyboardButtonsArray.Add("Button2");
2025-09-22 22:16:56 +03:00
// With keyboard, in chat
2025-01-16 21:22:31 +03:00
Keyboard = OPI_Telegram.FormKeyboardFromButtonArray(KeyboardButtonsArray, True);
2025-09-22 22:16:56 +03:00
Result = OPI_Telegram.SendTextMessage(Token, ChatID, Text, Keyboard);
2024-10-15 10:16:04 +03:00
2025-09-22 22:16:56 +03:00
// Simple, to channel
2024-10-15 10:16:04 +03:00
Result = OPI_Telegram.SendTextMessage(Token, ChannelID, Text);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint telegram SendTextMessage \
2024-10-22 08:59:24 +03:00
--token "***" \
2025-10-15 14:32:00 +03:00
--chat "-1001971186208*12117" \
2025-09-16 09:07:33 +03:00
--text "Строковое значение"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint telegram SendTextMessage ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2025-10-15 14:32:00 +03:00
--chat "-1001971186208*12117" ^
2025-09-16 09:07:33 +03:00
--text "Строковое значение"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"ok": true,
"result": {
2025-10-15 14:32:00 +03:00
"message_id": 17185,
2024-10-15 10:16:04 +03:00
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
2025-09-12 20:23:31 +03:00
"last_name": "Titovets",
"username": "bayselonarrend",
2024-10-15 10:16:04 +03:00
"type": "private"
},
2025-10-15 14:32:00 +03:00
"date": 1760516108,
2025-09-12 20:23:31 +03:00
"text": "Строковое значение",
"reply_markup": {
"inline_keyboard": [
[
{
"text": "Button1",
"callback_data": "Button1"
}
],
[
{
"text": "Button2",
"callback_data": "Button2"
}
]
]
}
2024-10-15 10:16:04 +03:00
}
}
```