The robotnik_telegram package, telegram server to send messages through ROS
This package dependes on the following packages:
git clone https://github.com/RobotnikAutomation/robotnik_msgsgit clone https://github.com/RobotnikAutomation/rcomponentInstall the package:
git clone https://github.com/RobotnikAutomation/robotnik_telegram.gitInstall other ros dependencies:
rosdep install --from-path src --ignore-src -y -rBuild the package:
catkin build
source devel/setup.bashTo send messages via telegram you need to create a bot to get the token. To do this, a link is left here where the steps to follow to create it are explained.
On the other hand, you also need to get the user id. To do this, follow the steps that appear in the following link.
In this way, the necessary parameters are obtained to send messages by telegram. The last step would be to open the Talagram application and start a conversation with the created bot and write /start. The messages will then arrive in this chat.
This package needs the user ID and the Bot token to be able to send messages. So that, edit the following file:
config/msg_config.yamlFill the fields with your Bot configuration like in this example:
telegram:
token: "678863201:BAFyeeSDj6fKWC2FJ1BStNAVCPADTXagqBA"
default_recipients:
- "1234567890"
- "0987654321"
Launch the package:
roslaunch robotnik_telegram msg_manager.launchSend a message to the default recipients:
rosservice call /robotnik_telegram/send_telegram "recipients: []
status: {id: 0, description: '', type: '', message: ''}
uuid: ''
datetime: ''
files_to_upload: []"Send a message to specific recipients:
rosservice call /robotnik_telegram/send_telegram "recipients: ['recipient1_id', 'recipient2_id']
status: {id: 0, description: '', type: '', message: ''}
uuid: ''
datetime: ''
files_to_upload: []"Send a message to specific recipients including some file attachments:
rosservice call /robotnik_telegram/send_telegram "recipients: ['recipient1_id', 'recipient2_id']
status: {id: 0, description: '', type: '', message: ''}
uuid: ''
datetime: ''
files_to_upload: ['image1.png', 'video1.mkv']"It sends messages using the Telegram Bot API
- telegram/token (string, default: 1234567891:AAHqLv9VZTA-8dYdGcxLPYVPWTs_eJeOyS4): Token for sending messages via the Telegram Bot API
- telegram/default_recipients (List[string], default: ['1234567891']): List of default recipients to which the message will be sent
- /msg_manager/state (robotnik_msgs/State): Node health
- /robotnik_telegram/send_telegram (robotnik_alarms_msgs/SendAlarms) Service to send alarm emails