2024-08-13 12:24:12 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 1
|
|
|
|
---
|
|
|
|
|
|
|
|
# Send text message
|
|
|
|
Sends a text message to a chat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function SendTextMessage(Val Token, Val ChatID, Val Text, Val ReplyID = 0, Val Keyboard = "", Val Markup = "MarkdownV2") Export`
|
|
|
|
|
2024-08-13 14:52:26 +02:00
|
|
|
| Parameter | CLI option | Type | Description |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Bot token |
|
|
|
|
| ChatID | --chatid | String, Number | Chat ID for message sending |
|
|
|
|
| Text | --text | String | Message text |
|
|
|
|
| ReplyID | --reply | String, Number | Replying message id if necessary |
|
|
|
|
| Keyboard | --keyboard | Array Of String | Buttons to the message if necessary |
|
|
|
|
| Markup | --parsemod | String | Markup type for message text: MarkdownV2 or HTML |
|
|
|
|
|
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - Serialized JSON response from VK Teams
|
2024-08-13 12:24:12 +02:00
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
:::tip
|
|
|
|
You can mention a user by appending their userId to the text in the following format @[userId]
|
|
|
|
|
|
|
|
Method at API documentation: [GET /messages/sendText](https://teams.vk.com/botapi/#/messages/get_messages_sendText)
|
|
|
|
:::
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
```bsl title="Code example"
|
2024-08-13 14:52:26 +02:00
|
|
|
Token = FunctionParameters["VkTeams_Token"];
|
|
|
|
ChatID = FunctionParameters["VkTeams_ChatID"];
|
|
|
|
Text = "Message text";
|
|
|
|
|
|
|
|
Result = OPI_VKTeams.SendTextMessage(Token, ChatID, Text);
|
|
|
|
|
|
|
|
OPI_TestDataRetrieval.WriteLog(Result, "SendTextMessage)", "VkTeams");
|
|
|
|
|
|
|
|
ChatID = FunctionParameters["VkTeams_ChatID2"];
|
|
|
|
ReplyID = FunctionParameters["VkTeams_MessageID"];
|
|
|
|
Text = "<b>Bold text</b>";
|
|
|
|
Markup = "HTML";
|
|
|
|
|
|
|
|
Result = OPI_VKTeams.SendTextMessage(Token, ChatID, Text, ReplyID, , Markup);
|
2024-08-13 12:24:12 +02:00
|
|
|
```
|
2024-08-13 14:52:26 +02:00
|
|
|
|
2024-08-13 12:24:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
```sh title="CLI command example"
|
2024-08-13 14:52:26 +02:00
|
|
|
|
|
|
|
oint vkteams SendTextMessage --token "001.3501506236.091..." --chatid "689203963@chat.agent" --text "<b>Bold text</b>" --reply "7402287649739767956" --keyboard %keyboard% --parsemod "HTML"
|
2024-08-13 12:24:12 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
|
2024-08-13 14:52:26 +02:00
|
|
|
```json title="Result"
|
2024-08-13 12:24:12 +02:00
|
|
|
|
2024-08-13 14:52:26 +02:00
|
|
|
```
|