Skip to main content

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

ParameterCLI optionTypeRequiredDescription
Token--tokenStringBot token
ChatID--chatidString, NumberChat ID for message sending
Text--textStringMessage text
ReplyID--replyString, NumberReplying message id if necessary
Keyboard--keyboardArray Of StringButtons to the message if necessary
Markup--parsemodStringMarkup type for message text: MarkdownV2 or HTML

Returns: Map Of KeyAndValue - serialized JSON response from VK Teams


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


1C:Enterprise/OneScript code example
    Token  = "001.3501506236.091...";
ChatID = "AoLI0egLWBSLR1Ngn2w";
Text = "Message text";

Result = OPI_VKTeams.SendTextMessage(Token, ChatID, Text);

ChatID = "689203963@chat.agent";
ReplyID = "7428324441567793059";
Text = "<b>Bold text</b>";
Markup = "HTML";

Keyboard = New Array;
ButtonsLineArray = New Array;

ButtonsLineArray.Add(OPI_VKTeams.MakeActionButton("Button1", "ButtonEvent1", , "attention"));

ButtonsLineArray.Add(OPI_VKTeams.MakeActionButton("Button2", , "https://openintegrations.dev"));

Keyboard.Add(ButtonsLineArray);
Keyboard.Add(ButtonsLineArray);

Result = OPI_VKTeams.SendTextMessage(Token, ChatID, Text, ReplyID, Keyboard, Markup);
    oint vkteams SendTextMessage \
--token "***" \
--chatid "689203963@chat.agent" \
--text "<b>Bold text</b>" \
--reply "7431899937417204081" \
--keyboard "[[{'text':'Button1','callbackData':'ButtonEvent1','style':'attention'},{'text':'Button2','url':'https://openintegrations.dev','style':'base'}],[{'text':'Button1','callbackData':'ButtonEvent1','style':'attention'},{'text':'Button2','url':'https://openintegrations.dev','style':'base'}]]" \
--parsemod "HTML"
Result
{
"msgId": "7423657487154285625",
"ok": true
}