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?
- Create a new IFTTT applet,
- Choose this and then Telegram
- 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.
- 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
- Choose that and select Gmail and then “Send an email” (make sure you have an user on discourse using this gmail address)
- The destination email should be the category incoming email.
- 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.