1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-06-08 23:56:33 +02:00

82 lines
3.0 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 3
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Write a message
Write a message to a user in the community's dialog
`Function WriteMessage(Val Text, Val UserID, Val Communitytoken, Val Keyboard = "", Val Parameters = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Text | --text | String | ✔ | Message text |
| UserID | --user | String | ✔ | Recipient user ID |
| Communitytoken | --ct | String | ✔ | Community chat bot token, which can be obtained in the settings |
| Keyboard | --keyboard | String | ✖ | JSON keyboard. See FormKeyboard |
| Parameters | --auth | Structure Of String | ✖ | Authorization JSON or path to .json |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from VK
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
Parameters = GetVKParameters();
Text = "Message from autotest";
UserID = "657846756";
Communitytoken = "vk1.a.IzbBGUkYUvrNfMt_sknCcC66hyYifL0U1Bb8CVYCNFBUVfpsJtzZ_K5LwCzURr2_uCzEaP_AK1QmInp9sGp7fu_CtEDSipFWFXJo0y8I...";
ButtonArray = New Array;
ButtonArray.Add("Button 1");
ButtonArray.Add("Button 2");
Keyboard = OPI_VK.FormKeyboard(ButtonArray);
Result = OPI_VK.WriteMessage(Text, UserID, Communitytoken, Keyboard, Parameters);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2024-10-22 08:59:24 +03:00
# JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint vk WriteMessage \
2024-10-22 08:59:24 +03:00
--text "Message from autotest" \
--user "657846756" \
--ct "vk1.a.IzbBGUkYUvrNfMt_sknCcC66hyYifL0U1Bb8CVYCNFBUVfpsJtzZ_K5LwCzURr2_uCzEaP_AK1QmInp9sGp7fu_CtEDSipFWFXJo0y8IFYAtSiw1s0xmjMMNN_mAKhsWQinOkAs5pw08YtWITbuKBgIboTFqvyTQyPtkpCbckftGHR6xabK0tA-Y98vsPZDUUZ2RVd9wO-P-8WzDyE86vg" \
--keyboard "{'buttons':[[{'action':{'type':'text','label':'Button 1'}},{'action':{'type':'text','label':'Button 2'}}]],'one_time':false}" \
--auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2024-10-22 08:59:24 +03:00
:: JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint vk WriteMessage ^
2024-10-22 08:59:24 +03:00
--text "Message from autotest" ^
--user "657846756" ^
--ct "vk1.a.IzbBGUkYUvrNfMt_sknCcC66hyYifL0U1Bb8CVYCNFBUVfpsJtzZ_K5LwCzURr2_uCzEaP_AK1QmInp9sGp7fu_CtEDSipFWFXJo0y8IFYAtSiw1s0xmjMMNN_mAKhsWQinOkAs5pw08YtWITbuKBgIboTFqvyTQyPtkpCbckftGHR6xabK0tA-Y98vsPZDUUZ2RVd9wO-P-8WzDyE86vg" ^
--keyboard "{'buttons':[[{'action':{'type':'text','label':'Button 1'}},{'action':{'type':'text','label':'Button 2'}}]],'one_time':false}" ^
--auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"response": 563
}
```