2024-06-05 12:19:46 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 2
|
|
|
|
---
|
|
|
|
|
|
|
|
# Send image
|
|
|
|
Sends an image to a chat or channel
|
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
`Function SendImage(Val Token, Val URL, Val UserID, Val SendingToChannel, Val Description = "") Export`
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
| 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 |
|
|
|
|
|
|
|
|
|
2024-06-06 14:33:52 +02:00
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Viber
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-07-10 13:05:58 +02:00
|
|
|
<br/>
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
```bsl title="Code example"
|
2024-07-10 13:11:17 +02:00
|
|
|
ChannelToken = "523b58ba82afffaa-111111111111111-2222222222222222";
|
2024-06-05 12:19:46 +02:00
|
|
|
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
|
|
|
|
```
|
2024-07-10 10:59:55 +02:00
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
|
|
|
|
|
|
|
oint viber SendImage --token %token% --picture %picture% --user "tMNGh111111111D+bT4g" --ischannel %ischannel% --description %description%
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-07-10 13:11:17 +02:00
|
|
|
{
|
2024-06-05 12:19:46 +02:00
|
|
|
"chat_hostname": "SN-CHAT-12_",
|
|
|
|
"message_token": 5925484936191962157,
|
|
|
|
"status_message": "ok",
|
|
|
|
"status": 0
|
|
|
|
}
|
|
|
|
```
|