Android Question Telegram API

Dave61

Member
Licensed User
Longtime User
I have a B4A application acting as a BOT:

Public HttpJob1 As HttpJob
Public URL_Header As String = "https://api.telegram.org/bot987654321:token_information_goes_here/sendMessage?"
Public URL_Footer As String = "&parse_mode=Markdown"
Public Chat_ID As Int = 123456789
Dim TelegramDataToWrite as String = "This is the text to send. There are some limitations!"
HttpJob1.Initialize("HttpJob1", Me)
StringToSend = URL_Header & "chat_id=" & Chat_ID & "&text=" & TelegramDataToWrite.Replace(" ", "%20") & URL_Footer
Main.HttpJob1.Download(StringToSend)


Works fine. But actually it isn't what I want to do.

What I want is for the B4A app to act as another Telegram Android App where I can control the interface as I am using it for home automation and I just have some buttons to turn on lights and fans. I want the B4A app to send messages to a different Telegram BOT (and bots can communicate with bots) which is running on a server and has some sensors, 433MHz hub and IR transmitters connected. So I am still poking around on a better way to do it where the B4A App uses my Telegram Chat_ID instead of a BOT ID and can chat with BOTs.
 
Upvote 0

u2005k

Member
Licensed User
Longtime User
I have a B4A application acting as a BOT:

Public HttpJob1 As HttpJob
Public URL_Header As String = "https://api.telegram.org/bot987654321:token_information_goes_here/sendMessage?"
Public URL_Footer As String = "&parse_mode=Markdown"
Public Chat_ID As Int = 123456789
Dim TelegramDataToWrite as String = "This is the text to send. There are some limitations!"
HttpJob1.Initialize("HttpJob1", Me)
StringToSend = URL_Header & "chat_id=" & Chat_ID & "&text=" & TelegramDataToWrite.Replace(" ", "%20") & URL_Footer
Main.HttpJob1.Download(StringToSend)


Works fine. But actually it isn't what I want to do.

What I want is for the B4A app to act as another Telegram Android App where I can control the interface as I am using it for home automation and I just have some buttons to turn on lights and fans. I want the B4A app to send messages to a different Telegram BOT (and bots can communicate with bots) which is running on a server and has some sensors, 433MHz hub and IR transmitters connected. So I am still poking around on a better way to do it where the B4A App uses my Telegram Chat_ID instead of a BOT ID and can chat with BOTs.
--------------------------

Hi Dave,
Any further updates on Telegram API?

Thanks & regards...
Uday
 
Upvote 0
Top