Connecting telegram bot to discourse


(SMHassanAlavi) #1

I have written a telegram bot : @padporsbot
In our country telegram messenger is using the most. We have a discourse website.So we created a bot with following features:

  • You can sign up in website without even opening website

  • even if you aren’t our website user, your content will send to website and you will receive your likes for your content as score

  • after signing up in website. all of your content created before signing up will be yours. you won’t lose any previous content.

  • creating team in bot and play as a team against other teams for getting scores(likes)

following features will be added to bot in updates:

  • with webhook. It will notify you if one of your content replied by another user and you can come to website and answer his reply.

this bot is focusing on reducing air pollution.
this is my php bot


Telegram Notifications Plugin (discourse-telegram-notifications)
Telegram Bots Anyone?
Discourse and chatbot integrations?
(Tobias Eigen) #2

This is a fabulous idea - I’d like to try it out but unfortunately can’t read and work in Arabic. Can you upload your code to github so I can try it out?

My site is also geared towards communities that I think would benefit from being connected with apps like telegram. I think alot of communities would value it in parts of the world where access to computers is more scarce and people mostly use mobile.

Do you have competition from WhatsApp? In East Africa, where we are actively recruiting members, many people use WhatsApp for daily communication and they prefer it because it handles the sharing of images, video and audio recordings really well. Certainly much better than discourse which is of course a browser app.


(SMHassanAlavi) #3

Topic Updated,
yes, using messengers are good but some Messengers like WhatsApp don’t give api to other developer. and either WhatsApp don’t have bot in his messenger.
Good news:
facebook has a complete api. You can connect your site to facebook and facebook messenger. Facebook even has bots and you can use them.(Facebook api is better than telegram api but it is not the most used in my country).
at the first step you start the bot you can select your language so you don’t need to read non-english languages. I didn’t get what you mean about language.
NOTE: This is PERSIAN, not arabic and these two languages are completely deffrent from each other


(Tobias Eigen) #4

Thanks for sharing the code on github - I’ll take a look and see what I can do with it. :sunny:

Oops - many, many apologies for getting the language wrong. I do know Persian is very different from Arabic.


(Алексей Копаев) #5

It’s very interesting. Is it possible to implement the sending of records from the telegram on discourse?


(Pad Pors) #6

It’s what this bot is about, it uses the mail function and sends the inputs to an email, and then using the incoming email functionality these inputs are recorded in the forum.


(Алексей Копаев) #7

Do you plan to adapt the robot for all sites on the discourse?


(Pad Pors) #8

yes, we’re testing & developing the bot, and as soon as we come to a stable functionality which fits with telegram user behavior, we’ll add the discoursibilities :wink: .

this can be done by addition of some kind of bot manager, and the space to set options like the email, the questions, … .

Suggestions which can help us to develop a better discourse-telegram bot are welcome.

Also feel free if you want to collaborate in its development.


(Алексей Копаев) #9

I’m willing to beta-test. The only thing you need to bot was a simple way to adapt for the Russian users.


(SMHassanAlavi) #10

Yes it is possible but you should know what do you want from bot.
our bot asks some questions from users and put them on the site with their own name.
many other actions can be added to bot (For example asking random question from sites topics or …)


(Алексей Копаев) #11

Here are some thoughts:

  1. the Bot allows the user to register on discourse
  2. the Bot will allow the user to leave the entry on the discourse
  3. In the case of receiving a response to the entry in discourse, the bot will send a notification to telegram repliable
  4. In the bot you can see popular posts
  5. show popular users on discourse
  6. option in voting.

And I would like that the bot was available in the telegram and Facebook


(SMHassanAlavi) #12

The bot has this:

and these are very good Ideas for adding to bot[quote=“11145, post:11, topic:55962”]

but I don’t get these:

can you explain these?


(Алексей Копаев) #13

@Alavi1412 When it will be possible to test the bot?


(Arun Sathiya) #14

I am sorry, I quite did not get you. I am very curious to know what this does. Does this let me control my Discourse setup via Telegram? That will be a breakthrough feature!


(SMHassanAlavi) #15

Both telegram bots and discourse have a complete API, by using these two, you can Connect your telegram bot too your site.
You even can code a Bot to control your admin panel through Telegram.
But we didn’t use the Bot as an admin. We have a set of questions, and we make a good UI for our question at Bot and we introduced the bot to everyone.
At the beginning, the bot asked your email. After that, if you answer any question, the bot send a fake email to our site email and the sender of the email is you. If you have signed up in our site before. The answer will be shown in the site with author of youself(you are the author of the content and even you are able to get like.) and if you aren’t our site’s user, your content’s author is again you but you a stage user at site not a normal user.
Instead of sending email, we can use site’s API.
In our next update we may use that but the bot is working correctly Now.

The bot is ready now, But it is in Persian.
@Padporsbot


(Алексей Копаев) #16

And is there any way to start testing it on your website and on your bot?


(Arun Sathiya) #17

Waiting for the same.


(SMHassanAlavi) #18

After Norouz holiday(4 April) we will start adding English to our bot


(Arun Sathiya) #19

Will be looking forward to seeing that!