Telegram message processor

Jump to: navigation, search

This plugin provides a message processor for Telegram, allowing sites to configure a Telegram bot that their users can configure to forward Moodle notifications and messages to their Telegram account.

Configuring the plugin settings

At the Telegram main settings page (Plugins / Message outputs / Telegram), you will need to configure a bot token to be used by the site. To get this token, you will need to create a new Telegram bot using the Telegram bot "Botfather".

After you have installed the plugin, at the settings screen, you will see this:

Settingscreen.png

The only thing you really need to enter here is the "bot token for the site". The other two fields will be automatically filled in once you save the token. To get the token, you need to open the Botfather in Telegram, which you can do by clicking the provided link below the instructions. When you click it, you will see something like this:

opentelegram.png

Open the link in the Telegram app (you need that), or alternatively in the Telegram Web (if your browser allows it). In Telegram, you should see this:

telegramstartscreen.png

Click the "Start" button at the bottom to begin the conversation with Botfather. Once you have, you will see:

botfatherstart.png

Enter the command "/newbot" in the conversation, and Botfather will ask you for all of the information you need. You will need to enter both a name and a unique username for your Bot. The Telegram settings screen provided some suggestions, but you can choose what you want. Since it should be unique, it is recommended you use your organization or sitename as part of these.

newbot.png

Once you have given Botfather everything it needs, you will gave the bot token displayed in the conversation:

bottoken.png

Transfer the bot token information to the settings screen and hit "Save changes":

savechanges.png

The name and username you chose will be filled in for you. Telegram is now ready for your users to configure their message preferences.

finalsettings.png

NOTE: The "Setup Telegram webhook" option is still a work in progress.

Configuring user preferences

Once you have a Telegram bot configured, users can connect their Telegram accounts to receive notifications and messages. This is done in the user preferences screen under the notification preferences. As a user, navigate to the "Notification preferences" screen. One the columns will be Telegram, and it will show that it is not configured. Click on the configuration link/icon and the Telegrams settings dialogue will open up:

telegrampreferences1.png

At this point, the user needs to initiate a conversation with the Telegram bot that was created for the site. The dialogue offers a link to start this. Click on the "Connect my account to Telegram", and another browser window/tab will open:

telegramopenrequest.png

Use the "Open Telegram app" to launch the Telegram app and initiate the conversation with the Telegram bot. You will see the conversation with a "Start" button at the bottom:

moodlebotstart.png

Click "Start". A conversation will start like below:

moodlebotstarted.png

At this point, return to your Moodle browser window/tab:

savechanges.png

Click "Save changes", and your Telegram connection should be configured. If it isn't (there could be a delay), wait a bit and open the settings dialogue again, and click "Save changes". Note, that if you do not click the save changes before logging off, you will need to start the connect process again. In any case, once you have saved, and the connection is made, you will see that the alert icon is gone, and when you look at your settings, it will give you a link to disconnect your account. Don't use that unless you don't want Telegram integrated with your Moodle account any more:

You can now select what notifications and messages you want received through Telegram.