Skip to main content

Send file by URL

Sends a file from web to the selected chat room

Function SendFileByURL(Val AccessParameters, Val ChatID, Val FileURL, Val FileName, Val Description = "", Val TypingTime = 0, Val TypingType = "file") Export

ParameterCLI optionTypeRequiredDescription
AccessParameters--accessStructure Of KeyAndValueAccess parameters. See FormAccessParameters
ChatID--chatStringChat identifier
FileURL--urlStringFile URL
FileName--filenameStringName of the file with the extension
Description--captionStringMessage text below the file
TypingTime--typingNumberTime to show typing indicator before sending (in ms.)
TypingType--ttypeStringTyping type: text, recording, video, image, file
Returns

Map Of KeyAndValue - serialized JSON response from Green API

tip

Method at API documentation: SendFileByUrl


1C:Enterprise/OneScript code example
ApiUrl = "https://3100.api.green-api.com/v3";
MediaUrl = "https://3100.api.green-api.com/v3";
IdInstance = "31003...";
ApiTokenInstance = "17915d8e0b4b4975a183478da...";

File = "https://hut.openintegrations.dev/test_data/picture.jpg";
FileName = "photo.jpg";
ChatID = 12345678;
Description = "File description";

AccessParameters = OPI_GreenMax.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Result = OPI_GreenMax.SendFileByURL(AccessParameters, ChatID, File, FileName);
# JSON data can also be passed as a path to a .json file

oint greenmax SendFileByURL \
--access "{'apiUrl':'***','mediaUrl':'https://3100.api.green-api.com/v3','idInstance':'3100309139','apiTokenInstance':'***'}" \
--chat "***" \
--url "https://hut.openintegrations.dev/test_data/video.mp4" \
--filename "vid.mp4" \
--caption "File description" \
--typing 1000
Result
{
"idMessage": "1779806063541"
}