Set up Telegram integration using the discourse-chat-integration plugin

Discourse
Fri, 21 Jul 2017 16:26:57 +0000
Integrations

This howto describes how to setup the Telegram provider included in discourse-chat-integration.

Your site must have force_https enabled before you can connect to Telegram

Enable the plugin

The discourse-chat-integration plugin is bundled with Discourse. If you haven’t already, follow the main plugin instructions to enable it.

Setup Telegram

1. Talk to the Telegram “Botfather” and setup a new bot. detailed instructions here

2. Make sure to copy the token that the BotFather gives you. It will look something like this:
110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw

Setup Discourse

1. In your site settings, paste the token you got earlier into the chat integration telegram access token setting, and save it

2. Enable the chat_integration_telegram_enabled setting, and save it

3. Go to the Plugins tab, then Chat Integrations

4. Go to the Telegram tab

Note: if the Telegram tab is not visible, it means something went wrong when connecting to their API. You should check your site logs, then try again by re-enabling the chat_integration_telegram_enabled setting

Adding a channel

1. Add your bot to a group chat on telegram (or just start a private chat with it)

2. Send any message to the bot (or in the group chat where the bot was added). You should receive a message with the Chat ID. You can also send a message starting with /getchatid.

3. Copy the Chat ID. If there’s a minus sign before it, make sure to include it - it’s very important!

4. Go to your discourse admin panel, Plugins , Chat Integrations , Telegram

5. Click Add Channel

6. Enter a name for the channel (this is only displayed in the discourse admin panel, it can be anything)

7. Paste the Chat ID from earlier into the box, then click Save Channel

8. Use the Test button on the channel you just created to check that everything’s working. You should see something like this:

9. Setup some “Rules” for your channel, according to the discourse-chat-integration instructions.

10. Enjoy all the notifications

Using in a broadcast channel

To send notifications to a telegram broadcast channel, add the bot as a channel administrator, and then send the message

/getchatid

to obtain the chat ID. Then follow the instructions above to set up on Discourse. For public channels, you can also use the @channelname format (e.g. @myforumchannel) instead of the numeric chat ID.

In a broadcast channel you cannot use slash commands to manage rules.

Slash commands

You can use “slash commands” to control rules from Telegram. Check that the chat integration telegram enable slash commands site setting is enabled. Note that this gives anyone who can post in the group chat permission to edit the rules.

To learn how to use them, just send /help (or /help@my-forum-bot if in a group chat) and the bot will send you a help message.

Setting up command auto-complete (not necessary, but makes it much easier to use)

1. Talk to the Telegram BotFather

2. Select your bot, click edit bot, then edit commands

3. Copy and paste this list of commands in
watch - [category] [tag:name] | notify this channel for new topics and new replies matching rule
follow - [category] [tag:name] | notify this channel for new topics matching rule
mute - [category] [tag:name] | block notifications to this channel for posts matching rule
remove - [rule number] | remove a rule (see /status for numbers)
status - list all rules for this channel
help - display a help message

4. You should get a success message

Other bot customisations

Talk to the Telegram BotFather to customise the name, description and icon for your bot. You should leave “Group Privacy” enabled, otherwise the bot will try and respond to every single message in a group chat.

Last edited by @JammyDodger Sunday, May 26, 2024 7:10 AM UTC
Check document (clicca per ulteriori dettagli)

93 messaggi - 40 partecipanti