---
sidebar_position: 1
description: Send text message and other functions to work with Viber in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Viber]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Send text message
 Sends a text message to a chat or channel



`Function SendTextMessage(Val Token, Val Text, Val UserID, Val SendingToChannel, Val Keyboard = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Token |
  | Text | --text | String | &#x2714; | Message text |
  | UserID | --user | String, Number | &#x2714; | User ID. For channel > administrator, for bot > recipient |
  | SendingToChannel | --ischannel | Boolean | &#x2714; | Sending to channel or bot chat |
  | Keyboard | --keyboard | Structure Of String | &#x2716; | See CreateKeyboardFromArrayButton |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Viber



```bsl title="1C:Enterprise/OneScript code example"
    Text = "TestMessage";

    UserID           = "d3jxe61Z4W73nmNkjYGgZg==";
    Token            = "523b5b25ed27e6ec-fdf013e4...";
    SendingToChannel = False;

    ButtonArray = New Array;
    ButtonArray.Add("Button 1");
    ButtonArray.Add("Button 2");
    ButtonArray.Add("Button 3");

    Keyboard = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray);

    Result = OPI_Viber.SendTextMessage(Token, Text, UserID, SendingToChannel, Keyboard);

    UserID           = "tMNGhftyUPrB3r1lD+bT4g==";
    Token            = "523b58ba82afffaa-7ef3b426...";
    SendingToChannel = True;

    Result = OPI_Viber.SendTextMessage(Token, Text, UserID, SendingToChannel, Keyboard);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint viber SendTextMessage \
             --token "***" \
             --text "TestMessage" \
             --user "d3jxe61Z4W73nmNkjYGgZg==" \
             --ischannel false \
             --keyboard "{'Buttons':[{'ActionType':'reply','ActionBody':'Button 1','Text':'Button 1','BgColor':'#2db9b9','Coloumns':3},{'ActionType':'reply','ActionBody':'Button 2','Text':'Button 2','BgColor':'#2db9b9','Coloumns':3},{'ActionType':'reply','ActionBody':'Button 3','Text':'Button 3','BgColor':'#2db9b9','Coloumns':3}],'Type':'keyboard'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint viber SendTextMessage ^
             --token "***" ^
             --text "TestMessage" ^
             --user "d3jxe61Z4W73nmNkjYGgZg==" ^
             --ischannel false ^
             --keyboard "{'Buttons':[{'ActionType':'reply','ActionBody':'Button 1','Text':'Button 1','BgColor':'#2db9b9','Coloumns':3},{'ActionType':'reply','ActionBody':'Button 2','Text':'Button 2','BgColor':'#2db9b9','Coloumns':3},{'ActionType':'reply','ActionBody':'Button 3','Text':'Button 3','BgColor':'#2db9b9','Coloumns':3}],'Type':'keyboard'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "status": 0,
 "status_message": "ok",
 "message_token": 6024682517702263447,
 "chat_hostname": "SN-CHAT-01_",
 "billing_status": 3
}
```
