



# Telegram
  
Connect your Telegram bot with Rocketbot  

*Read this in other languages: [English](Manual_Telegram.md), [Português](Manual_Telegram.pr.md), [Español](Manual_Telegram.es.md)*
  
![banner](imgs/Banner_Telegram.png)
## How to install this module
  
To install the module in Rocketbot Studio, it can be done in two ways:
1. Manual: __Download__ the .zip file and unzip it in the modules folder. The folder name must be the same as the module and inside it must have the following files and folders: \__init__.py, package.json, docs, example and libs. If you have the application open, refresh your browser to be able to use the new module.
2. Automatic: When entering Rocketbot Studio on the right margin you will find the **Addons** section, select **Install Mods**, search for the desired module and press install.  

## How to use this module

Before using this module, you need to create a Telegram bot and get the chat identifier where the bot will send messages.

1. Open Telegram and search for **BotFather**.
2. Start a conversation with BotFather and send the command **/newbot**.
3. Enter the bot name and then the bot username. The username must end in **bot**.
4. BotFather will return a token similar to: **1520225275:AAELRsagaahsrp0M_LtehaS4eheaadpUOfsLjhw**. Copy this value.
5. Add the bot to the chat, group, or channel where you want to send messages. If it is a group or channel, make sure the bot has permission to send messages.
6. To get the chat_id, send a message to the bot or to the group where the bot was added, then open this URL in a browser:
https://api.telegram.org/bot{token}/getUpdates
Replace **{token}** with the token generated by BotFather.
7. In the response, find the value **chat.id** and copy it. For public channels or groups, you can also use the username with **@**, for 
example **@my_channel**.
8. In Rocketbot, use the **Connect** command and enter the bot token in the **Token** field.
9. After connecting, use the **Send Message** command. Enter the text in **Message** and the destination in **chat_id**.
10. To send a file, select the file path in **File**. If the file is an image and you want to send it as a photo, check **Is Image?**. If not checked, the file will be sent as a document.

Note: The **Connect** command must be executed before **Send Message** in the same Rocketbot execution flow.

## Description of the commands

### Connect
  
Connect Telegram bot with Rocketbot
|Parameters|Description|example|
| --- | --- | --- |
|Token|Token of your telegram bot|1520225275:AAELRsagaahsrp0M_LtehaS4eheaadpUOfsLjhw|

### Send Message
  
Send a message to a chat
|Parameters|Description|example|
| --- | --- | --- |
|Mensaje|The message you want to send|El mensaje va aca...|
|chat_id|The chat_id of the chat to which you want to send the message|chat_id|
|File|Optional file path to send. If it is an image it will be sent as a photo, otherwise as a document.|C:\ruta\archivo.pdf|
|Is Image?|Check this box if the file to send is an image. If not checked, it will be sent as a document.||
