Configura l'integrazione di Telegram usando il plugin discourse-chat-integration

Questo howto descrive come configurare il provider Telegram incluso in discourse-chat-integration.

Abilitare il plugin

Il plugin discourse-chat-integration è fornito con Discourse. Se non l’hai già fatto, segui le istruzioni principali del plugin per abilitarlo.

Configurare Telegram

  1. Parla con il "Botfather" di Telegram :robot: e configura un nuovo bot. Istruzioni dettagliate qui
  2. Assicurati di copiare il token che ti fornisce il BotFather. Sarà simile a questo:
    110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
    

Configurare Discourse

  1. Nelle impostazioni del tuo sito, incolla il token che hai ottenuto in precedenza nell’impostazione chat integration telegram access token e salvalo

  2. Abilita l’impostazione chat_integration_telegram_enabled e salvala

  3. Vai alla scheda Plugins, quindi Chat Integrations

  4. Vai alla scheda Telegram

    • Nota: se la scheda Telegram non è visibile, significa che qualcosa è andato storto durante la connessione alla loro API. Dovresti controllare i log del tuo sito, quindi riprova riabilitando l’impostazione chat_integration_telegram_enabled

Aggiungere un canale

  1. Aggiungi il tuo bot a una chat di gruppo su Telegram (o inizia semplicemente una chat privata con esso)

  2. Invia un messaggio qualsiasi al bot (o nella chat di gruppo in cui è stato aggiunto il bot). Dovresti ricevere un messaggio con la Chat ID. Puoi anche inviare un messaggio che inizia con /getchatid.

  3. Copia la Chat ID. Se c’è un segno meno prima, assicurati di includerlo: è molto importante!

  4. Vai al pannello di amministrazione di Discourse, Plugins, Chat Integrations, Telegram

  5. Clicca su Add Channel

  6. Inserisci un nome per il canale (questo viene visualizzato solo nel pannello di amministrazione di Discourse, può essere qualsiasi cosa)

  7. Incolla la Chat ID precedente nella casella, quindi clicca su Save Channel

  8. Usa il pulsante Test sul canale che hai appena creato per verificare che tutto funzioni. Dovresti vedere qualcosa di simile a questo:

  9. Imposta alcune "Regole" per il tuo canale, secondo le istruzioni di discourse-chat-integration.

  10. Goditi tutte le notifiche :allthethings:

Utilizzo in un canale di trasmissione

Per inviare notifiche a un canale di trasmissione Telegram, aggiungi il bot come amministratore del canale, quindi invia il messaggio

/getchatid

per ottenere la chat ID. Segui quindi le istruzioni sopra per configurare su Discourse. Per i canali pubblici, puoi anche usare il formato @nomecanale (es. @mioforumchannel) invece della chat ID numerica.

In un canale di trasmissione non puoi usare i comandi slash per gestire le regole.

Comandi Slash

Puoi usare i "comandi slash" per controllare le regole da Telegram. Verifica che l’impostazione del sito chat integration telegram enable slash commands sia abilitata. Nota che questo dà a chiunque possa pubblicare nella chat di gruppo il permesso di modificare le regole.

Per imparare come usarli, invia semplicemente /help (o /help@mio-forum-bot se in una chat di gruppo) e il bot ti invierà un messaggio di aiuto.

Configurazione dell’auto-completamento dei comandi (non necessario, ma lo rende molto più facile da usare)

  1. Parla con il BotFather di Telegram :robot:
  2. Seleziona il tuo bot, clicca su edit bot, quindi su edit commands
  3. Copia e incolla questo elenco di comandi
    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. Dovresti ricevere un messaggio di successo :slight_smile:

Altre personalizzazioni del bot

Parla con il BotFather di Telegram :robot: per personalizzare il nome, la descrizione e l’icona del tuo bot. Dovresti lasciare abilitata la "Group Privacy", altrimenti il bot tenterà di rispondere a ogni singolo messaggio in una chat di gruppo.

27 Mi Piace

Isn’t possible to allow users to subscribe to any public category? Without asking an admin to add their id to the whitelist?

1 Mi Piace

Not currently. It is possibly something that could be added (this is how Slack works), but given there is no concept of “organisations” on telegram, we would need to be careful that only public-facing categories are visible.

For per-user stuff you could try the telegram-notifications-plugin

1 Mi Piace

But that means two different bots :sweat_smile:
Anyway, thanks for such good plugins :+1:

1 Mi Piace

I’ve set it up, and it works with bot itself. However, when I set it up for public channel and try to test, an error “422 No Reason Phrase” occurs.
Could someone help me out?

Where does this error occur? In telegram, or in the “test” dialog in the Discourse admin panel?

Hi! I don’t see any submenu in the admin panel to manage Telegram settings

But i got my chat ID through the bot.

Hello,
Can you tell me what different Telegram notifications using the discourse-chat-integration plugin and Telegram Notifications Plugin (discourse-telegram-notifications)

Check the very top of this topic: Telegram Notifications Plugin (discourse-telegram-notifications) (the part with the :warning: next to it)

2 Mi Piace

Whenever users reply to the Telegram bot message, it keeps informing them of the current chat ID, telling them to configure something different on the admin panel.

I have the actual message in Portuguese:

Este chat está configurado WTTD Fórum. Configure-o no painel de administração. (ID do bate-papo:-1001093143218)

Google translated:

This chat is configured for WTTD Forum. Configure it in the administration panel. (Chat ID: -1001093143218)

It’s quite annoying.

Also, I’ve disabled chat integration telegram enable slash commands, but it still replies with the command list.

Is there a way to make the bot ignore any reply?

where can we Add the channel in discourse? we don’t find nothing… caht bot is active and we get also the Chat-ID, thanks in advance

1 Mi Piace

After enabling the telegram site settings, head to your admin panel, click “plugins” at the top, then “chat integration” on the left.

3 Mi Piace

Hello, i don’t know is it ok right now, but after setting up bot in admin and adding bot to channel nothing happened.

Did you try using the “test channel” button. Did you get any errors?

1 Mi Piace

test channel button works, but i expect ‘welcome’ message like in guide.

I’m not sure which guide you are talking about. The chat-integration plugin doesn’t send a welcome message.

Once you have configured the channel, you need to add some “rules”. Then, topics/posts you make on your discourse forum will appear in Telegram.

1 Mi Piace

Sto parlando di questa istruzione.

1 Mi Piace

Ah, I see. Try sending a message in the group, including the bot’s username (like @myforumbot). Then it should respond with that message.

3 Mi Piace

I’ve configured everything successfully, except that whenever a new member leaves/adds into the telegram group which has the ‘chat integration bot’ as one of this groups member, I receive this msg in the telegram group:

New rule: /[watch|follow|mute] [category] [tag:name]
(you must specify a rule type and at least one category or tag)

  • watch – notify this channel for new topics and new replies
  • follow – notify this channel for new topics
  • mute – block notifications to this channel

Remove rule: /remove [rule number]
([rule number] can be found by running /status)

List rules: /status

Help: /help

This msg has started irritating every time a member is added or removed into/from the telegram group.
And if I create a telegram broadcast/channel and add the chat integration bot into that, this problem doesn’t arise therein.