You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-06 08:49:29 +02:00
Создание MD файлов документации
This commit is contained in:
committed by
Vitaly the Alpaca (bot)
parent
9c2d012d41
commit
09822c04ec
@@ -1,72 +1,72 @@
|
||||
---
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
# Create a keyboard from an array of buttons
|
||||
Returns a keyboard structure for messages
|
||||
|
||||
|
||||
*Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9b9") Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| ButtonArray | --buttons | Array of String | Array of buttons |
|
||||
| ButtonColor | --color | String | HEX color of buttons with # at the beginning |
|
||||
|
||||
|
||||
Returns: Structure - Create a keyboard from an array of buttons:
|
||||
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
ButtonArray = New Array;
|
||||
ButtonArray.Add("Button 1");
|
||||
ButtonArray.Add("Button 2");
|
||||
ButtonArray.Add("Button 3");
|
||||
|
||||
Keyboard = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray); //Structure
|
||||
JSON = OPI_Tools.JSONString(Keyboard); //String
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber CreateKeyboardFromArrayButton --buttons %buttons% --color %color%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"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"
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
# Create a keyboard from an array of buttons
|
||||
Returns a keyboard structure for messages
|
||||
|
||||
|
||||
*Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9b9") Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| ButtonArray | --buttons | Array of String | Array of buttons |
|
||||
| ButtonColor | --color | String | HEX color of buttons with # at the beginning |
|
||||
|
||||
|
||||
Returns: Structure - Create a keyboard from an array of buttons:
|
||||
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
ButtonArray = New Array;
|
||||
ButtonArray.Add("Button 1");
|
||||
ButtonArray.Add("Button 2");
|
||||
ButtonArray.Add("Button 3");
|
||||
|
||||
Keyboard = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray); //Structure
|
||||
JSON = OPI_Tools.JSONString(Keyboard); //String
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber CreateKeyboardFromArrayButton --buttons %buttons% --color %color%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"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"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# Send contact
|
||||
Sends a contact with a phone number to a chat or channel
|
||||
|
||||
|
||||
*Function SendContact(Val Token, Val ContactName, Val PhoneNumber, Val UserID, Val SendingToChannel) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| ContactName | --name | String | Contact name |
|
||||
| PhoneNumber | --phone | String | Phone number |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
BotToken = "523b5b25ed27e6ec-111111111111111-2222222222222222";
|
||||
UserID = "d3jxe1111111111jYGgZg==";
|
||||
|
||||
Response = OPI_Viber.SendContact(BotToken, "John Doe", "+749521231", UserID, False); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendContact --token %token% --name %name% --phone %phone% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"billing_status": 1,
|
||||
"chat_hostname": "SN-CHAT-15_",
|
||||
"message_token": 5925747984748149627,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# Send contact
|
||||
Sends a contact with a phone number to a chat or channel
|
||||
|
||||
|
||||
*Function SendContact(Val Token, Val ContactName, Val PhoneNumber, Val UserID, Val SendingToChannel) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| ContactName | --name | String | Contact name |
|
||||
| PhoneNumber | --phone | String | Phone number |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
BotToken = "523b5b25ed27e6ec-111111111111111-2222222222222222";
|
||||
UserID = "d3jxe1111111111jYGgZg==";
|
||||
|
||||
Response = OPI_Viber.SendContact(BotToken, "John Doe", "+749521231", UserID, False); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendContact --token %token% --name %name% --phone %phone% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"billing_status": 1,
|
||||
"chat_hostname": "SN-CHAT-15_",
|
||||
"message_token": 5925747984748149627,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# SendFile
|
||||
Sends a file (document) to a chat or channel
|
||||
|
||||
|
||||
*Function SendFile(Val Token, Val URL, Val UserID, Val SendingToChannel, Val Extension, Val Size = "") Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| URL | --file | String | File URL |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
| Extension | --ext | String | File extension |
|
||||
| Size | --size | Number | File size. If not filled in > determined automatically by downloading the file |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
ChannelToken = "523b58ba82afffaa-111111111111111-2222222222222222";
|
||||
UserID = "tMNGh111111111D+bT4g==";
|
||||
|
||||
Response = OPI_Viber.SendFile(ChannelToken, "https://api.athenaeum.digital/1.txt", UserID, True, "txt"); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendFile --token %token% --file %file% --user "tMNGh111111111D+bT4g" --ischannel %ischannel% --ext %ext% --size %size%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"chat_hostname": "SN-CHAT-09_",
|
||||
"message_token": 5925491906424759104,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# SendFile
|
||||
Sends a file (document) to a chat or channel
|
||||
|
||||
|
||||
*Function SendFile(Val Token, Val URL, Val UserID, Val SendingToChannel, Val Extension, Val Size = "") Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| URL | --file | String | File URL |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
| Extension | --ext | String | File extension |
|
||||
| Size | --size | Number | File size. If not filled in > determined automatically by downloading the file |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
ChannelToken = "523b58ba82afffaa-111111111111111-2222222222222222";
|
||||
UserID = "tMNGh111111111D+bT4g==";
|
||||
|
||||
Response = OPI_Viber.SendFile(ChannelToken, "https://api.athenaeum.digital/1.txt", UserID, True, "txt"); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendFile --token %token% --file %file% --user "tMNGh111111111D+bT4g" --ischannel %ischannel% --ext %ext% --size %size%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"chat_hostname": "SN-CHAT-09_",
|
||||
"message_token": 5925491906424759104,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Send image
|
||||
Sends an image to a chat or channel
|
||||
|
||||
|
||||
*Function SendImage(Val Token, Val URL, Val UserID, Val SendingToChannel, Val Description = "") Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| URL | --picture | String | Image URL |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | boolean | Sending to channel or bot chat |
|
||||
| Description | --description | String | Image annotation |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
ChannelToken = "523b58ba82afffaa-111111111111111-2222222222222222";
|
||||
UserID = "tMNGh111111111D+bT4g==";
|
||||
|
||||
Response = OPI_Viber.SendImage(ChannelToken, "https://api.athenaeum.digital/logo.png", UserID, True, "Alpaca"); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendImage --token %token% --picture %picture% --user "tMNGh111111111D+bT4g" --ischannel %ischannel% --description %description%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"chat_hostname": "SN-CHAT-12_",
|
||||
"message_token": 5925484936191962157,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Send image
|
||||
Sends an image to a chat or channel
|
||||
|
||||
|
||||
*Function SendImage(Val Token, Val URL, Val UserID, Val SendingToChannel, Val Description = "") Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| URL | --picture | String | Image URL |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | boolean | Sending to channel or bot chat |
|
||||
| Description | --description | String | Image annotation |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
ChannelToken = "523b58ba82afffaa-111111111111111-2222222222222222";
|
||||
UserID = "tMNGh111111111D+bT4g==";
|
||||
|
||||
Response = OPI_Viber.SendImage(ChannelToken, "https://api.athenaeum.digital/logo.png", UserID, True, "Alpaca"); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendImage --token %token% --picture %picture% --user "tMNGh111111111D+bT4g" --ischannel %ischannel% --description %description%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"chat_hostname": "SN-CHAT-12_",
|
||||
"message_token": 5925484936191962157,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# SendLink
|
||||
Sends a URL with a preview to a chat or channel
|
||||
|
||||
|
||||
*Function SendLink(Val Token, Val URL, Val UserID, Val SendingToChannel) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| URL | --url | String | SentLink |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
BotToken = "523b5b25ed27e6ec-111111111111111-2222222222222222";
|
||||
UserID = "d3jxe1111111111jYGgZg==";
|
||||
|
||||
Response = OPI_Viber.SendLink(BotToken, "https://github.com/Bayselonarrend", UserID, False); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendLink --token %token% --url %url% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"billing_status": 1,
|
||||
"chat_hostname": "SN-CHAT-15_",
|
||||
"message_token": 5925752472607291800,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# SendLink
|
||||
Sends a URL with a preview to a chat or channel
|
||||
|
||||
|
||||
*Function SendLink(Val Token, Val URL, Val UserID, Val SendingToChannel) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| URL | --url | String | SentLink |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
BotToken = "523b5b25ed27e6ec-111111111111111-2222222222222222";
|
||||
UserID = "d3jxe1111111111jYGgZg==";
|
||||
|
||||
Response = OPI_Viber.SendLink(BotToken, "https://github.com/Bayselonarrend", UserID, False); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendLink --token %token% --url %url% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"billing_status": 1,
|
||||
"chat_hostname": "SN-CHAT-15_",
|
||||
"message_token": 5925752472607291800,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# SendLocation
|
||||
Sends geographic coordinates to a chat or channel
|
||||
|
||||
|
||||
*Function SendLocation(Val Token, Val Latitude, Val Longitude, Val UserID, Val SendingToChannel) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| Latitude | --lat | String, Number | Geographic latitude |
|
||||
| Longitude | --long | String, Number | Geographic longitude |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
BotToken = "523b5b25ed27e6ec-111111111111111-2222222222222222";
|
||||
UserID = "d3jxe1111111111jYGgZg==";
|
||||
|
||||
Response = OPI_Viber.SendLocation(BotToken, "55.75", "37.6167", UserID, False); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendLocation --token %token% --lat %lat% --long %long% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"billing_status": 1,
|
||||
"chat_hostname": "SN-CHAT-10_",
|
||||
"message_token": 5925751017338988046,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# SendLocation
|
||||
Sends geographic coordinates to a chat or channel
|
||||
|
||||
|
||||
*Function SendLocation(Val Token, Val Latitude, Val Longitude, Val UserID, Val SendingToChannel) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| Latitude | --lat | String, Number | Geographic latitude |
|
||||
| Longitude | --long | String, Number | Geographic longitude |
|
||||
| UserID | --user | String, Number | User ID. For channel > administrator, for bot > recipient |
|
||||
| SendingToChannel | --ischannel | Boolean | Sending to channel or bot chat |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
BotToken = "523b5b25ed27e6ec-111111111111111-2222222222222222";
|
||||
UserID = "d3jxe1111111111jYGgZg==";
|
||||
|
||||
Response = OPI_Viber.SendLocation(BotToken, "55.75", "37.6167", UserID, False); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendLocation --token %token% --lat %lat% --long %long% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"billing_status": 1,
|
||||
"chat_hostname": "SN-CHAT-10_",
|
||||
"message_token": 5925751017338988046,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
---
|
||||
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 | Destination |
|
||||
|-|-|-|-|
|
||||
| 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: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendTextMessage --token %token% --text %text% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel% --keyboard %keyboard%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"chat_hostname": "SN-CHAT-10_",
|
||||
"message_token": 5925400810709476620,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
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 | Destination |
|
||||
|-|-|-|-|
|
||||
| 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: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SendTextMessage --token %token% --text %text% --user "d3jxe1111111111jYGgZg" --ischannel %ischannel% --keyboard %keyboard%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"chat_hostname": "SN-CHAT-10_",
|
||||
"message_token": 5925400810709476620,
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "Message sending",
|
||||
"position": "3"
|
||||
}
|
||||
{
|
||||
"label": "Message sending",
|
||||
"position": "3"
|
||||
}
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Get channel information
|
||||
Here you can get the channel's user IDs. Bot IDs need to be obtained from the Webhook arrivals The user ID from channel information is not suitable for sending messages through the bot - they are different
|
||||
|
||||
|
||||
*Function GetChannelInformation(Val Token) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.GetChannelInformation(ChannelToken); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber GetChannelInformation --token %token%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"members": [
|
||||
{
|
||||
"role": "admin",
|
||||
"name": "John",
|
||||
"id": "d3jxe611111111kjYGgZg=="
|
||||
}
|
||||
],
|
||||
"subcategory": "Advertising Service",
|
||||
"category": "Local Businesses",
|
||||
"location": {
|
||||
"lon": -73.96878,
|
||||
"lat": 40.7691018
|
||||
},
|
||||
"icon": "https://media-direct.cdn.viber.com/pg_download?pgtp=icons&dlid=0-04-01-05bfe24da13dddf32cf52976b099dc6965c03300763e6a9316de26986e5dea05&fltp=jpg&imsz=0000",
|
||||
"subscribers_count": 0,
|
||||
"name": "1CTestBot",
|
||||
"chat_hostname": "SN-CHAT-01_",
|
||||
"id": "pa:5925429953186752236",
|
||||
"country": "US",
|
||||
"uri": "1ctestbot",
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Get channel information
|
||||
Here you can get the channel's user IDs. Bot IDs need to be obtained from the Webhook arrivals The user ID from channel information is not suitable for sending messages through the bot - they are different
|
||||
|
||||
|
||||
*Function GetChannelInformation(Val Token) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.GetChannelInformation(ChannelToken); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber GetChannelInformation --token %token%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"members": [
|
||||
{
|
||||
"role": "admin",
|
||||
"name": "John",
|
||||
"id": "d3jxe611111111kjYGgZg=="
|
||||
}
|
||||
],
|
||||
"subcategory": "Advertising Service",
|
||||
"category": "Local Businesses",
|
||||
"location": {
|
||||
"lon": -73.96878,
|
||||
"lat": 40.7691018
|
||||
},
|
||||
"icon": "https://media-direct.cdn.viber.com/pg_download?pgtp=icons&dlid=0-04-01-05bfe24da13dddf32cf52976b099dc6965c03300763e6a9316de26986e5dea05&fltp=jpg&imsz=0000",
|
||||
"subscribers_count": 0,
|
||||
"name": "1CTestBot",
|
||||
"chat_hostname": "SN-CHAT-01_",
|
||||
"id": "pa:5925429953186752236",
|
||||
"country": "US",
|
||||
"uri": "1ctestbot",
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# Get online users
|
||||
Gets the status of a user or several users by ID
|
||||
|
||||
|
||||
*Function GetOnlineUsers(Val Token, Val UserIDs) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Viber Token |
|
||||
| UserIDs | --users | String,Number,Array of String,Number | Viber User(s) ID |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.GetOnlineUsers(Token, UserID); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber GetOnlineUsers --token %token% --users %users%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"users": [
|
||||
{
|
||||
"last_online": 1704796869778,
|
||||
"online_status_message": "offline",
|
||||
"online_status": 1,
|
||||
"id": "d3jxe111111111YGgZg=="
|
||||
}
|
||||
],
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# Get online users
|
||||
Gets the status of a user or several users by ID
|
||||
|
||||
|
||||
*Function GetOnlineUsers(Val Token, Val UserIDs) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Viber Token |
|
||||
| UserIDs | --users | String,Number,Array of String,Number | Viber User(s) ID |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.GetOnlineUsers(Token, UserID); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber GetOnlineUsers --token %token% --users %users%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"users": [
|
||||
{
|
||||
"last_online": 1704796869778,
|
||||
"online_status_message": "offline",
|
||||
"online_status": 1,
|
||||
"id": "d3jxe111111111YGgZg=="
|
||||
}
|
||||
],
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Get user data
|
||||
Gets user information by ID
|
||||
|
||||
|
||||
*Function GetUserData(Val Token, Val UserID) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| UserID | --user | String, Number | Viber User ID |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.GetUserData(Token, UserID); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber GetUserData --token %token% --user %user%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"user": {
|
||||
"device_type": "iPhone8,4",
|
||||
"mnc": 1,
|
||||
"mcc": 257,
|
||||
"api_version": 10,
|
||||
"primary_device_os": "iOS 15.6.1",
|
||||
"viber_version": "21.6.0.18",
|
||||
"country": "FR",
|
||||
"language": "ru",
|
||||
"avatar": "http://dl-media.viber.com/1/share/2/long/bots/generic-avatar%402x.png",
|
||||
"name": "Subscriber",
|
||||
"id": "d3jxe6111111NkjYGgZg=="
|
||||
},
|
||||
"chat_hostname": "SN-CHAT-07_",
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Get user data
|
||||
Gets user information by ID
|
||||
|
||||
|
||||
*Function GetUserData(Val Token, Val UserID) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Token |
|
||||
| UserID | --user | String, Number | Viber User ID |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.GetUserData(Token, UserID); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber GetUserData --token %token% --user %user%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"user": {
|
||||
"device_type": "iPhone8,4",
|
||||
"mnc": 1,
|
||||
"mcc": 257,
|
||||
"api_version": 10,
|
||||
"primary_device_os": "iOS 15.6.1",
|
||||
"viber_version": "21.6.0.18",
|
||||
"country": "FR",
|
||||
"language": "ru",
|
||||
"avatar": "http://dl-media.viber.com/1/share/2/long/bots/generic-avatar%402x.png",
|
||||
"name": "Subscriber",
|
||||
"id": "d3jxe6111111NkjYGgZg=="
|
||||
},
|
||||
"chat_hostname": "SN-CHAT-07_",
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Set Webhook
|
||||
IMPORTANT: Setting up Webhook is mandatory according to Viber rules. You need to have a free URL for this., which will return 200 and a genuine SSL certificate. If there is a certificate and the database is published on the server - you can use an HTTP service. Information about new messages will also be sent there Viber periodically knocks on the Webhook address, so if it is inactive, everything will stop working
|
||||
|
||||
|
||||
*Function SetWebhook(Val Token, Val URL) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Viber Token |
|
||||
| URL | --url | String | URL for setting up Webhook |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.SetWebhook(Token, "https://api.athenaeum.digital/opi/hs/viber"); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SetWebhook --token %token% --url %url%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"event_types": [
|
||||
"subscribed",
|
||||
"unsubscribed",
|
||||
"webhook",
|
||||
"conversation_started",
|
||||
"client_status",
|
||||
"action",
|
||||
"delivered",
|
||||
"failed",
|
||||
"message",
|
||||
"seen"
|
||||
],
|
||||
"chat_hostname": "SN-CHAT-12_",
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Set Webhook
|
||||
IMPORTANT: Setting up Webhook is mandatory according to Viber rules. You need to have a free URL for this., which will return 200 and a genuine SSL certificate. If there is a certificate and the database is published on the server - you can use an HTTP service. Information about new messages will also be sent there Viber periodically knocks on the Webhook address, so if it is inactive, everything will stop working
|
||||
|
||||
|
||||
*Function SetWebhook(Val Token, Val URL) Export*
|
||||
|
||||
| Parameter | CLI option | Type | Destination |
|
||||
|-|-|-|-|
|
||||
| Token | --token | String | Viber Token |
|
||||
| URL | --url | String | URL for setting up Webhook |
|
||||
|
||||
|
||||
Returns: Key-Value Pair - serialized JSON response from Viber
|
||||
|
||||
```bsl title="Code example"
|
||||
|
||||
|
||||
Response = OPI_Viber.SetWebhook(Token, "https://api.athenaeum.digital/opi/hs/viber"); //Map
|
||||
Response = OPI_Tools.JSONString(Response); //JSON string
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
```sh title="CLI command example"
|
||||
|
||||
oint viber SetWebhook --token %token% --url %url%
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```json title="Result"
|
||||
|
||||
{
|
||||
"event_types": [
|
||||
"subscribed",
|
||||
"unsubscribed",
|
||||
"webhook",
|
||||
"conversation_started",
|
||||
"client_status",
|
||||
"action",
|
||||
"delivered",
|
||||
"failed",
|
||||
"message",
|
||||
"seen"
|
||||
],
|
||||
"chat_hostname": "SN-CHAT-12_",
|
||||
"status_message": "ok",
|
||||
"status": 0
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "Settings and information",
|
||||
"position": "2"
|
||||
}
|
||||
{
|
||||
"label": "Settings and information",
|
||||
"position": "2"
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
---
|
||||
id: Viber
|
||||
sidebar_class_name: Viber
|
||||
---
|
||||
|
||||
<img src={require('../../static/img/APIs/Viber.png').default} width='64px' />
|
||||
|
||||
# Viber
|
||||
|
||||
Этот раздел поwithinящен библиотеtoе for work with Viber API. Nа данной withтранице опиwithаны inwithе дейwithтinия, необходимые for полноценного of start work
|
||||
|
||||
## Getting started
|
||||
|
||||
:::note
|
||||
|
||||
Оwithобенноwithти work with Viber API
|
||||
|
||||
1. Notльзя иwithпользоinать бота и упраinлять toаtoлом через API, еwithли не уwithтаноinлен Webhook
|
||||
|
||||
In отличии от Telegram, toоторые позinоляют withамому забирать обноinления with withерinероin, а пиwithать и inоinwithе незаinиwithимо от thisго, Viber требует обязательного иwithпользоinания Webhook, т.е у inаwith должен be withерinер with inнешним IP и дейwithтinительный SSL withертифиtoат. If inерить доtoументации, Viber периодичеwithtoи will withтучать по адреwithу, уtoазанному toаto WH и еwithли он не получит отinет 200, то inwithе переwithтанет работать(**UPD:** Уже меwithяц нет http-withерinиwithа, но ничего не поломалоwithь). Requests от Viber могут обрабатыinатьwithя http-withерinиwithом or любым другим обработчиtoом for запроwithоin typeа POST, при уwithлоinии toличия SSL и доwithтупноwithти адреwithа frominне. If у inаwith еwithть таtoой адреwith, то уwithтаноinить Webhook можно при помощий фунtoции *SetWebhook()* данной libraries (withм. далее). Towithле уwithтаноintoи, у чат бота in приложении Viber пояinитwithя toнопtoа "Message" for of start диалога, а in toаtoл withтанет можно отпраinлять withообщения через REST Api.
|
||||
|
||||
2. У Viber отwithутwithтinуют механchangeы upload inнешних fileоin to их withерinера
|
||||
|
||||
Kартинtoи, fileы и доtoументы могут отпраinлятьwithя in Viber тольtoо in inиде URL. Т.е. for thisго тоже нужен withерinер or, toаto минимум, withторонний withерinиwith for публиtoации fileоin. Nо таto toаto withерinер уже in любом withлучае необходим for Webhook, отпраinляемые fileы можно inременно withохранять in папtoу inеб-withерinера. У IIS this папtoа wwwroot
|
||||
|
||||
:::
|
||||
|
||||
У Viber еwithть дinа REST API: один for work with toаtoлами, а inторой - for чат-ботоin. In обоих withлучаях mainоinными параметрами withлужат **Token** и **UserID**
|
||||
|
||||
- If inам необходимо упраinлять toаtoлом:
|
||||
1. Зайдите in приложение Viber и withоздайте ноinый toаtoл
|
||||
|
||||

|
||||
|
||||
2. Towithле withоздания, перейдите in towithтройtoи toаtoла -> "For разработчиtoоin", и withtoопируйте **Token**
|
||||
|
||||

|
||||
|
||||
3. Уwithтаноinите Webhook. See. Set Webhook
|
||||
4. **UserID** - inаш ID (админиwithтратора toаtoла). See. Get channel information
|
||||
|
||||
<br/>
|
||||
|
||||
- If inам необходим чат-бот:
|
||||
1. Перейдите по withwithылtoе [https://partners.viber.com/account/create-bot-account](https://partners.viber.com/account/create-bot-account) и аinторfromуйтеwithь with inашим номером телефоto, toоторый приinязан to Viber
|
||||
|
||||

|
||||
|
||||
2. Inыберите пунtoт withоздания ноinого бота
|
||||
|
||||

|
||||
|
||||
3. In меню withоздания бота заполните inwithе необходимые fields
|
||||
|
||||

|
||||
|
||||
4. Сtoопируйте **Token**
|
||||
|
||||

|
||||
|
||||
4. Nайти withinоего ноinого бота inы можете отwithtoанироinаin QR to withтранице withоздания or in towithтройtoах (пунtoт чат-боты) in приложении Viber.
|
||||
|
||||

|
||||
|
||||
5. Сейчаwith inы не можете toчать диалог with ботом, withof start необходимо уwithтаноinить Webhook. See. Set Webhook
|
||||
6. Towithле start **UserID** will ID toонtoретного челоinеtoа, inедущего диалог with ботом. Get можно from обworktoи incoming withообщения по Webhook
|
||||
|
||||
|
||||
**Inажно:** ID одного и того же пользоinателя у чата и toаtoла - this разные зtoчения. Notльзя иwithпользоinать ID, полученный from withообщения боту for inызоinа methodоin упраinления toаtoлом и toоборот.
|
||||
---
|
||||
id: Viber
|
||||
sidebar_class_name: Viber
|
||||
---
|
||||
|
||||
<img src={require('../../static/img/APIs/Viber.png').default} width='64px' />
|
||||
|
||||
# Viber
|
||||
|
||||
Этот раздел поwithinящен библиотеtoе for work with Viber API. Nа данной withтранице опиwithаны inwithе дейwithтinия, необходимые for полноценного of start work
|
||||
|
||||
## Getting started
|
||||
|
||||
:::note
|
||||
|
||||
Оwithобенноwithти work with Viber API
|
||||
|
||||
1. Notльзя иwithпользоinать бота и упраinлять toаtoлом через API, еwithли не уwithтаноinлен Webhook
|
||||
|
||||
In отличии от Telegram, toоторые позinоляют withамому забирать обноinления with withерinероin, а пиwithать и inоinwithе незаinиwithимо от thisго, Viber требует обязательного иwithпользоinания Webhook, т.е у inаwith должен be withерinер with inнешним IP и дейwithтinительный SSL withертифиtoат. If inерить доtoументации, Viber периодичеwithtoи will withтучать по адреwithу, уtoазанному toаto WH и еwithли он не получит отinет 200, то inwithе переwithтанет работать(**UPD:** Уже меwithяц нет http-withерinиwithа, но ничего не поломалоwithь). Requests от Viber могут обрабатыinатьwithя http-withерinиwithом or любым другим обработчиtoом for запроwithоin typeа POST, при уwithлоinии toличия SSL и доwithтупноwithти адреwithа frominне. If у inаwith еwithть таtoой адреwith, то уwithтаноinить Webhook можно при помощий фунtoции *SetWebhook()* данной libraries (withм. далее). Towithле уwithтаноintoи, у чат бота in приложении Viber пояinитwithя toнопtoа "Message" for of start диалога, а in toаtoл withтанет можно отпраinлять withообщения через REST Api.
|
||||
|
||||
2. У Viber отwithутwithтinуют механchangeы upload inнешних fileоin to их withерinера
|
||||
|
||||
Kартинtoи, fileы и доtoументы могут отпраinлятьwithя in Viber тольtoо in inиде URL. Т.е. for thisго тоже нужен withерinер or, toаto минимум, withторонний withерinиwith for публиtoации fileоin. Nо таto toаto withерinер уже in любом withлучае необходим for Webhook, отпраinляемые fileы можно inременно withохранять in папtoу inеб-withерinера. У IIS this папtoа wwwroot
|
||||
|
||||
:::
|
||||
|
||||
У Viber еwithть дinа REST API: один for work with toаtoлами, а inторой - for чат-ботоin. In обоих withлучаях mainоinными параметрами withлужат **Token** и **UserID**
|
||||
|
||||
- If inам необходимо упраinлять toаtoлом:
|
||||
1. Зайдите in приложение Viber и withоздайте ноinый toаtoл
|
||||
|
||||

|
||||
|
||||
2. Towithле withоздания, перейдите in towithтройtoи toаtoла -> "For разработчиtoоin", и withtoопируйте **Token**
|
||||
|
||||

|
||||
|
||||
3. Уwithтаноinите Webhook. See. Set Webhook
|
||||
4. **UserID** - inаш ID (админиwithтратора toаtoла). See. Get channel information
|
||||
|
||||
<br/>
|
||||
|
||||
- If inам необходим чат-бот:
|
||||
1. Перейдите по withwithылtoе [https://partners.viber.com/account/create-bot-account](https://partners.viber.com/account/create-bot-account) и аinторfromуйтеwithь with inашим номером телефоto, toоторый приinязан to Viber
|
||||
|
||||

|
||||
|
||||
2. Inыберите пунtoт withоздания ноinого бота
|
||||
|
||||

|
||||
|
||||
3. In меню withоздания бота заполните inwithе необходимые fields
|
||||
|
||||

|
||||
|
||||
4. Сtoопируйте **Token**
|
||||
|
||||

|
||||
|
||||
4. Nайти withinоего ноinого бота inы можете отwithtoанироinаin QR to withтранице withоздания or in towithтройtoах (пунtoт чат-боты) in приложении Viber.
|
||||
|
||||

|
||||
|
||||
5. Сейчаwith inы не можете toчать диалог with ботом, withof start необходимо уwithтаноinить Webhook. See. Set Webhook
|
||||
6. Towithле start **UserID** will ID toонtoретного челоinеtoа, inедущего диалог with ботом. Get можно from обworktoи incoming withообщения по Webhook
|
||||
|
||||
|
||||
**Inажно:** ID одного и того же пользоinателя у чата и toаtoла - this разные зtoчения. Notльзя иwithпользоinать ID, полученный from withообщения боту for inызоinа methodоin упраinления toаtoлом и toоборот.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"label": "Viber",
|
||||
"position": 3,
|
||||
"link": {
|
||||
"type": "doc",
|
||||
"id": "Viber"
|
||||
}
|
||||
}
|
||||
{
|
||||
"label": "Viber",
|
||||
"position": 3,
|
||||
"link": {
|
||||
"type": "doc",
|
||||
"id": "Viber"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user