mycontroller-org / mycontroller-v1-legacy

The Open Source Controller
http://www.MyController.org
Apache License 2.0
148 stars 90 forks source link

[FeatureRequest] Telegram support to Operation #442

Closed soloam closed 6 years ago

soloam commented 6 years ago

Hi, it would be nice if MyController supported Telegram as notification, this allows to send all notifications to Telegram and having all information in one place.

Thank You for the great work

jkandasa commented 6 years ago

@soloam This feature is implemented in the SNAPSHOT version.

Add telegram bot token from your bot(BotFather) into MyController notifications settings. I followed this link to setup a bot in my telegram account. image

Valid token will be looking as follows after saved, image

Create Operation to send telegram bot message, Here Channel username is important. The custom message can be empty. image

jl277013 commented 6 years ago

I followed the example above. When I put in the Telegram token, the is bot, Firstname and Username automatically populated fine (FYI, this didn't work in Chrome but was ok in Edge). I put my Telegram username (is this the same as Channel username?) in the operation as the example above, I got the following error (I substituted my username with "telegram_username" below) from the MyController log:

2018-08-06 16:23:10,192 ERROR [mc-th-pool-6] [org.mycontroller.standalone.operation.TelegramBotUtils:59] Exception: Message(chatId=telegram_username, text=A message from MyController, parseMode=null, disableWebPagePreview=null, disableNotification=null, replyToMessageId=null) java.lang.RuntimeException: Response(ok=false, result=null, errorCode=400, description=Bad Request: chat not found)

Any idea what is the issue?

jkandasa commented 6 years ago

@jl277013 can you follow this video

And I do not see any problem with Chrome browser.

jl277013 commented 6 years ago

Thanks for the info! I enabled Allow Groups. I also enabled Group Privacy. I was mistakenly used the bot id from the rest api from the description above. After some digging, I found a page with the following excerpt:

"I dumped the error response and it was 403 "Forbidden: bot can't send messages to bots". The solution was to go to Telegram and search for the bot called "userinfobot" with the questionmark as an avatar. Click start and it gives you your userid. Use that, and you will start receiving messages from your bot :-)"

When I got the id for my Telegram user, it worked!
Also, I tried Chrome again today and it seemed to be fine. I am not sure what happened here. Thanks again!