Connecting a Telegram bot¶
Connecting the bot to your server opens up the following possibilities for system users:
- Receiving codes for two-factor authentication
- Receiving notification when client is ready to connect by invitation
- Creating invitations in Quick Support
- Connecting to devices from Permanent access
- Getting list
- Connecting
- File exchange
Integration with Telegram
For more details about the features that are available after integrating with Telegram , see related article.
Connecting¶
Creating a bot¶
The first thing you need to do is create your own bot in Telegram. To do this, go to bot builder @BotFather and click Start
.
Next, run the command /newbot
. Chat will ask you for a name and ID for your bot. Use your company name and postfix Getscreen.me
.
After creating the chat will give you identifier and token for integration with the bot:
Bot configuration¶
Now you need to bind the domain name and configure webhooks for the bot.
Domain name¶
Follow the steps below:
- Send a chat command
/mybots
and select the bot you just created. - Go to
Bot Settings
Domain
Set Domain
- Specify the domain name of your server
Webhooks¶
To set the webhook you need to go in your browser (you can CURL or WGET) to the following link:
https://api.telegram.org/bot<bot-id>:<bot-token>/setWebhook?url=https://<your-domain>/webhook/telegram/<bot-id>:<bot-token>
Where:
<bot-id>
is the ID of your bot<bot-token>
- your bot's token<your-domain>
- domain of your server
If done correctly, you will get this answer:
Configuring the server¶
Now you need to specify the parameters of the bot in the configuration of the main server.
In the /opt/getscreen/server/config.json
file, add the following section:
"integrate": {
"telegram": {
"name": "<bot-name>",
"id": <bot-id>,
"token": "<bot-id>:<bot-token>"
}
}
where:
<bot-name>
is the name of your bot<bot-id>
- identifier<bot-token>
- token<your-domain>
- domain of your server
Server restart¶
For the configuration changes to take effect, restart the server:
Done! 👍
Check¶
A link to your bot should appear on the integration page in your personal account:
Last update: November 27th, 2024