Create topics from a posts to Telegram group

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:

<img src="//assets-meta-cdck-prod-meta.s3.dualstack.us-west-1.amazonaws.com/original/3X/5/0/504ab08bb4d4045c0a69b837a741873d72658523.png" width="690" height="32">

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.