Sending message to Telegram group using Java

Daniyar
1 min readNov 3, 2018

1.Create bot in Telegram
1.1. Find “BotFather” in Telegram;
1.2. Type “/start”;
1.3. Type “/newbot”;
1.4. Type bot name e.g. “any_bot”;
1.5. Type bot username e.g. “any_bot”;
1.6. BotFather will create your bot and will send Token to access the HTTP API.

2. Get group “chatId”:
2.1. Forward any message to “RawDataBot”;
2.2. Find: "forward_from_chat": { "id": -210987654,…;
2.3. Delete “RawDataBot” from group.

3. Use following code to send data to Telegram group:

Option #1

Option #2

Modifying previous code:
Receive answer from server and set to any Textview:

Option #3

Modifying previous code:
Running code asynchronously:

4. And onClick on any Button execute the code:

5. Have Fun ;)

--

--

Daniyar

Ex- Google Certified Associate Android Developer