telegram-middleman-bot
I'm the @MiddleMan bot! I sit in the middle between whatever you want to send yourself as a message and your Telegram.
I translate simple JSON HTTP requests into Telegram push messages that you will get on your Smartphone, PC or whatever Telegram client you have.
Why might this be useful?
This is especially useful for developers or sysadmins. Imagine you want some kind of reporting from your application or server, like a daily report including some statistics. You don't want to actively look it up on a website but you want to receive it in a passive fashion. Just like getting an e-mail. But come on, let's be honest. E-Mails are so 2010. And they require your little server-side script to include some SMTP library and connect to a mail server. That's too heavyweight just to get some short information. Personally, I have a Python script running on my server which gathers some statistics from log files and databases and regularly sends me a Telegram message.
If you develop those thoughts further, this could potentially replace any kind of e-mail notifications - be it the message that someone has answered to your forum post, your favorite game is now on sale at Steam, and so on. It's lightweight and easy, unlike e-mails that have way too much overhead.
How to run it?
You can either set up your own instance or use mine, which is running at http://middleman.ferdinand-muetsch.de. If you want to set this up on your own, do the following.
- Make sure u have the latest version of Go installed.
go get github.com/n1try/telegram-middleman-bot
cd <YOUR_GO_WORKSPACE_PATH>/src/github.com/n1try/telegram-middleman-bot
go get ./...
- Insert your
BOT_API_TOKEN
, which you got from the @BotFather when registering your bot, inmain.go
go build .
./telegram-middleman-bot
How to use it?
- You need to get a token from the bot. Send a message with
/start
to the @MiddleManBot therefore. - Now you can use that token to make HTTP POST requests to
http://localhost:8080/api/messages
(replace localhost by the hostname of your server running the bot or mine as shown above) with a body that looks like this.
{
"recipient_token": "3edf633a-eab0-45ea-9721-16c07bb8f245",
"text": "__Hello World!__ (yes, this is Markdown)",
"origin": "My lonely server script"
}
License
MIT @ Ferdinand Mütsch