Post messages from a Telegram group to a discourse category


(Nukeador) #1

With the new IFTTT Telegram channel I’ve managed to set up an applet so everyone in a Telegram group can create new topics in a discourse category just by texting on the Telegram group.

###Why?

Because real time communications are noisy and most of the times you forget about the interesting stuff you share there. We wanted a way to “store” the relevant messages so we can elaborate or discuss asynchronously later.

###What would you need?

  • An IFTTT account.
  • A Telegram account and group (obviously)
  • A discourse category with incoming email and create topics by email enabled.
  • A Gmail account linked to your IFTTT and to a discourse user.

###How?

  1. Create a new IFTTT applet,
  2. Choose this and then Telegram
  3. Then “New message with key phrase in a group” (recommended) and then “Connect new groups”. You will be redirected to Telegram to add the bot to your group.
  4. For key phrase select something like #discourse For the reply use something like: “Done! Your topic will be created in the next 5 minutes https://yoursite/c/yourcategory (please just one message per user and minute)” and click Create a trigger
  5. Choose that and select Gmail and then “Send an email” (make sure you have an user on discourse using this gmail address)
  6. The destination email should be the category incoming email.
  7. Fill the subject and body.

This is what I use:

Subject: [Telegram] {{AuthorName}} - {{TriggeredAt}}

Body:

<p>{{AuthorName}} (@{{AuthorUsername}}) wrote:</p>
{{Text}}
<p>_Message sent from Telegram_</p>

That’s all, everyone in your group will be able now to create new topics with a message by doing:

/ifttt #discourse This is the message I want to send to discourse

Your category will start populating the incoming messages each 5 minutes (depending on your pop polling setting) and will look like this:

Tips:

  • Create a new category just for these messages to avoid noise on the rest.
  • Maybe create a new user just for this (I create one called Telegram-bot).
  • You can set this category permissions so only the user you are using is able to create topics (I use a bots group)
  • You can have a few mods in charge of monitoring this category, renaming titles and moving topics to other categories if needed.

How to link your community to the discourse app?
#2

Hi! it´s a nice way to improve the conversation on a forum. But a have random problems with the messages. Sometimes works and others not:

We’re sorry, but your email message to [“xxxxxxxxxxx@gmail.com”] (titled [Telegram] xxxxxxx - December 19, 2016 at 08:44PM) didn’t work.

Reason:

title is in use


(Joshua Rosenfeld) #3

Seems like a pretty clear reason to me…you tried to use the same title as an existing topic. Either chose a different title or enable allow duplicate topic titles in site settings.


#4

I will try that, but the tittle is the same for each message (subject is the same on applet).

Thanks!


#5

I´m looking trough administration panel and get this:

Error
RateLimiter::LimitExceeded

any idea?


#6

Solved! the problem was the bot don´t have enough privileges.Set level 3 and make a group for it, works licke a charm.


(Nukeador) #7

The implementation of the topic title I used just have the username + date, so you won’t be able to have the same (telegram) username posting at the same minute (a limitation in order to have unique titles)


#8

Can bypass that with specific permissions. A private group for example.