
Building a server-less Telegram bot over a weekend - mosessoh
https://medium.com/@moses.soh/how-to-build-a-server-less-telegram-bot-227f842f4706
======
snaky
This is especially confusing to use 'server-less' buzzword (meaning 'on the
bunch of servers in The Cloud') wrt messengers and p2p things where things
could be _actually_ serverless.

~~~
fenwick67
The word "server" is totally meaningless in 2017... it can mean "program that
interfaces with other programs" (like X server), it can mean "computer on a
rack", "dedicated VPS", "program listening on an external TCP port"... we
really need better terminology.

~~~
snaky
It's not that total actually. Of course we cannot always clearly and formally
distinguish bare metal server from virtual server, and both of them from just
a server program coexisting on workstation or laptop with other programs.

But when I say 'a bunch of server racks', you know what I mean, don't you?

BTW AFAIK a server in X Window System is called 'server' because it does
'listen', so formally it is, and so it wasn't a question back then.

------
patrickdavey
Fantastic write up. I'm really looking forward to part 2 now!

I recently used the telegram bot API for a raspberry pi motion detection
setup. If I'm away from the house and there's movement, I get a photo uploaded
into the chatroom. Super simple to get started with the API :)

~~~
mosessoh
that's a very cool use case. i like thinking about these cases where an app
might be over-featured :)

you're welcome, I'm glad you found it useful!

------
sixhobbits
Nice post! Especially adding ngrok for speeding up development.

I've written a couple of similar tutorials about Telegram bots, so shameless
self plug:

Building a Telegram Bot with Python [0] is a beginner-focused basic ToDo bot
in a few parts

Building a Serverless Chatbot with AWS, Zappa, Telegram, and api.ai [1] is a
slightly more advanced one that shows how to integrate an off-the-shelf "AI"
into the bot.

Some of the code snippets looked pretty similar. Would love to hear if you saw
my posts before writing this one.

In response to people being confused by "serverless" \-- I think GCE + AWS
have successfully established the term to mean "running code in the cloud
without having to worry about maintaining updates etc". I've never heard this
term used in regards to a P2P system of bots.

[0] [https://www.codementor.io/garethdwyer/building-a-telegram-
bo...](https://www.codementor.io/garethdwyer/building-a-telegram-bot-using-
python-part-1-goi5fncay)

[1] [http://www.developintelligence.com/blog/2017/08/building-
ser...](http://www.developintelligence.com/blog/2017/08/building-serverless-
chatbot-aws-zappa-telegram-api-ai/)

~~~
mosessoh
I hadn’t! These are exactly what I had in mind - ngrok really sped up
development, but the production stack and tools were the same as yours.

------
banku_brougham
A question about ngrok: If ngrok is exposing a local server to the internet,
does it also open an attack surface to vulnerabilities on my machine?

~~~
mosessoh
I definitely wouldn't start sharing the URL around. But this isn't the end
goal. The end goal is to host your server code on AWS Lambda and use the
endpoint that provides.

ngrok's exposing of a local server just makes it easier for you to develop
more quickly. Otherwise, you'd have to deploy any changes to Lambda, hit your
bot's endpoint, and then check the cloud logs for any bugs. I was doing this
for awhile - it really slows down development. I'm writing another post on AWS
Lambda and Zappa next - hope that's useful!

