It works only on Telegram.
Native request component also works like a Request, but these components are set up differently.
Unlike in Request, in Native request, the user selects Method and fill in Request body — for methods that send POST, for GET — an empty {} object must be written in the field for the request body.
The remaining settings will be added by default, they will not be visible in the component.
When the Request method is selected in the component, an active link appears in the settings leading to Telegram API documentation of the selected method.
Telegram provides a large number of methods with which you can interact with bot users. Many of them are already implemented in the builder in the form of components, but you can also do some specific things using API requests.
For example, we will send three images in one message using Native request. Method: sendMediaGroup.
Using this method, you can send several files of the same type: images, documents, video or audio.
In the bot, the sent images will look like this:
Required parameters for Request body:
Let's write Request body with these parameters:
{ "chat_id": "{{this_user.platform_id}}", "media":[{ "type": "photo", "media": "https://drive.google.com/file/d/1Y09-df77xdYlpsze2rpqWGCbkms4HNpl/view?usp=sharing"}, {"type": "photo", "media": "https://drive.google.com/file/d/1GXpNm0bqtKB6MuRfMzwxO5Dj3iKQzJgY/view?usp=sharing"}, {"type": "photo", "media": "https://drive.google.com/file/d/1bsjPW2M75yCgeokn3j6_PixQY_hsMUUc/view?usp=sharing"}] }
And add it to the component settings:
Don't forget to save.
Now, when the component is activated, the bot will send three images at once.
Due to Telegram limitations, images can be cropped in a horizontal format.
Let’s forward the message in its original form from the channel/group using forwardMessage method in Native request.
This method can be used if you need to send an image and text in one block.
There can be only one image in the forwarded message. If there are more images, only the first one will come to the bot.
1. Add a bot to the group /channel from where the request will be sent, by an administrator with all rights.
2. Add the request body:
{ "chat_id": {{this_user.platform_id}}, "from_chat_id": "@channel_name", "message_id": "23" }
Where:
You can find out the message ID by right-clicking on the forwarded message in the channel/group and selecting Copy link to the message.
You will get a link of the form https://t.me/channel_name/23.
23 is the message ID. Let's add this ID to the request body, you don’t need the rest of the link.
3. Let's make Native request in the builder.
4. Make a save and test the bot. The message from the group/channel to the bot will come in this form:
If you want the message to come without the channel name, you can use the copyMessage method.
The Request body for this method will be the same as in the previous example, only the Request method changes.
Now a message will come to the bot without reference to the channel or group from where the message was forwarded.