Integrate Telegram Bot using Java

Hi Guys,
A short and really useful blog on Telegram Bot.

Before writing ahead i want to say a big thank you to Telegram for providing such a rich API and flexibility to create our own bot.

Use Case

Official telegram site shows many use cases where bot is really useful.

Here i used telegram bot to test my services which is deployed in raspberry pi board and bot will work as adhoc between a raspberry pi and Mobile Device using which i am sending a different commands to device.

Code

The sample java code which is used to register a bot with telegram server and echo to mobile device whatever you have sent to bot.

pom.xml

Use below snippet to download required dependency.

App.java

You just need to execute main method, that it and Your bot will start reacting.
Live Telegram Boot Screen

You need to create your bot and need to get token by talking with BotFather, you can talk to BotFather via TeleGram App by searching @BotFather. Refer https://core.telegram.org/api for more.

Thanks Guys for reading.
Happy Learning.

Share current post by copy: https://goo.gl/wlb8Bw

Thanks,
Yogesh P