1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-03-25 21:39:21 +02:00
2024-08-14 09:06:31 +03:00

1.5 KiB

sidebar_position
1

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 Description
Token --token String Token
Text --text String Message text
UserID --user String, Number User ID. For channel > administrator, for bot > recipient
SendingToChannel --ischannel Boolean Sending to channel or bot chat
Keyboard --keyboard Structure Of String See CreateKeyboardFromArrayButton

Returns: Map Of KeyAndValue - serialized JSON response from Viber


  
  BotToken = "523b5b25ed27e6ec-111111111111111-2222222222222222";
  UserID = "d3jxe1111111111jYGgZg==";
  
  ButtonArray = New Array;
  
  ButtonArray.Add("Button 1");
  ButtonArray.Add("Button 2");
  ButtonArray.Add("Button 3");
  
  Keyboard = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray);
  
  Response = OPI_Viber.SendTextMessage(BotToken, "Hello", UserID, False, Keyboard); //Map
  Response = OPI_Tools.JSONString(Response); //JSON string
    
  oint viber SendTextMessage --token %token% --text %text% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel% --keyboard %keyboard%

{
  "chat_hostname": "SN-CHAT-10_",
  "message_token": 5925400810709476620,
  "status_message": "ok",
  "status": 0
  }