YandexDisk, Google Drive and other public cloud storage limit downloading of files from their resources, which can cause interruptions in sending by URL. To ensure the transfer of files to your clients, use S3 storage or hosting.
Public links
Public links are direct download links for a file. If you click on such a link, the file will start downloading or you will be taken to a page with no visual interface, only the file.
To understand what a direct link is, go to “Images” in your browser or to any site with pictures, right-click on the image and click “Open image in new tab.” A page will open with nothing but an image, and in the address bar there will be a direct link to a file with an extension, for example, “.png”.
Connecting S3 storage
Let's look at connecting and using S3 storage using YandexCloud as an example.
1. Go to the YandexCloud main page;
2. In the upper right corner, click “Get started”;
3. In the window that opens, check the boxes and click log in;
4. From the list of services, select “Object Storage” and click on it;
5. Click on “Create bucket”;
6. Enter your details and click “Create bucket”;
7. Fill in your payment details;
8. Click on your created storage;
9. Upload files;
10. Click on the uploaded file;
11. In the upper right corner, click "Get Link". Copy it.
Ready! You’ve received a direct link to the file. You can insert it into the file sending via URL in the bot builder and not worry about limits.
In addition to YandexCloud, there are other S3 storages. For example:
- MailRu;
- Amazon;
- Битрикс24 Box.
Use hosting to send files
Hosting is a space where your website and its files are located. In this article, we will not discuss how to buy or set up hosting, connect a domain, and so on. We will only upload a file to hosting and get a link to send it via URL.
In the example, we use a regular hosting and a file manager – “FileZilla”.
1. Open the file system of your website or hosting;
2. Upload the file to the root folder of your resource;
3. Right-click on the file and select "Copy address to clipboard";
From the copied link, we only need the domain (or IP address, as in the example) and the file name. For example, if the link turned out to be:
- sftp://root@111.11.11.111/var/www/html/2022-03-15_10-09-37_1x.png
you need to remove everything from it except the IP address and name to get it:
- http://111.11.11.111/2022-03-15_10-09-37_1x.png — это будет прямой ссылкой на ваш файл.
Ready! You can paste this link into the “Submit link” and not worry about the number of download requests.
You can send files using the “Send message” block. How to do this — read the article.