[go: up one dir, main page]

Skip to content

How to send a file?#

The GREEN-API service allows you to send files in several ways.

How to send a file from an external server? - SendFileByUrl#

Important: If you encounter errors sending messages with files, it is recommended to use the uploadFile method in combination with the SendFileByUrl method.

  1. Send a file to an external server - see How to send a file using the sendFileByUrl method using external storage?
  2. Call the SendFileByUrl method via Postman, for this use Postman Collection - "Send video, audio, image, document by URL".

How to send a file from a personal computer? - sendFileByUpload#

Sending using this method eliminates possible problems associated with the availability of external storage for the GREEN-API service. The result of the successful operation of the sendFileByUpload method is idMessage - the message identifier of the sent file and urlFile - a link to a file from the GREEN-API repository:

{
    "idMessage": "BAE540B3B4D86B2A",
    "urlFile": "https://sw-media-out.storage.yandexcloud.net/1101123456/95917013-579d-429f-9145-469865c4a6e8.jpg"
}

How to send a file from a personal computer during mass mailings? - uploadFile + SendFileByUrl#

For mailings, as well as in cases of receiving errors when sending files, GREEN-API recommends using the uploadFile and SendFileByUrl methods in conjunction. The file is uploaded to the storage once using the uploadFile method, the result is urlFile - link to file from GREEN-API:

{
    "urlFile": "https://sw-media-out.storage.yandexcloud.net/1101123456/95917013-579d-429f-9145-469865c4a6e8.jpg"
}
Important: the uploadFile method only uploads the file to the cloud storage so that the link to the file can be reused in the SendFileByUrl method.

Next, use the received link to the uploaded file when sending the file using the SendFileByUrl method. Successful method execution is the message id:

{
    "idMessage": "BAE5842D549D814B"
}