Skip to content

Telegram Bot Setup

Telegram integration is used to send two-factor authentication codes, receive notifications, and access the personal control panel when a technician enables the integration for their account.

Telegram Integration

Learn which features become available to technicians when the integration is enabled in the guide Remote Desktop Access via Telegram.

In this step-by-step guide, you will learn how to create a Telegram bot and connect it to the Main Server.

Create 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:

Configure Bot

Now you need to bind the domain name and configure webhooks for the bot.

Domain name

Follow the steps below:

  1. Send a chat command /mybots and select the bot you just created.
  2. Go to Bot Settings Domain Set Domain
  3. 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:

{"ok":true,"result":true,"description":"Webhook was set"}

Configure Main 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 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

Main Server Restart

For the configuration changes to take effect, restart the Main Server:

cd /opt/getscreen
docker-compose restart

Check

A link to your bot should appear on the integration page in your personal account: