First of all you need a BOT TOKEN that can be obtained following the instructions found here : How to get Telegram bot API token
Then, using the following snippets, it will be possible to get and send messages to telegram.
Using WGET$ (or even better WGETASYNC) it is possible to check regularly if new messages have been received and execute the corresponding actions.
cicciocb
Code: [Local Link Removed for Guests]
'Telegram example how to interface with Annex32
'simple commands using the BOT
'requires the BOT TOKEN and the CHAT ID
BOT_TOKEN$ = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
CHAT_ID$ = "1234567890"
'CHECK IF THE BOT TOKEN IS CORRECT (just use once to confirm that it is working)
a$ = "https://api.telegram.org/bot" + BOT_TOKEN$ + "/getMe"
wlog wget$(a$)
'CHECK MESSAGES
a$ = "https://api.telegram.org/bot" + BOT_TOKEN$ + "/getUpdates"
b$ = wget$(a$)
wlog b$
wlog "Message : "; json$(b$, "message.text")
id$ = json$(b$, "update_id")
wlog "update_id :"; id$
wlog "Chat_id :"; json$(b$, "chat.id")
' defines the id for the next message
next_id$ = trim$(str$(val(id$) + 1, "%11.0f"))
'CHECK MESSAGES WITH OFFSET
a$ = "https://api.telegram.org/bot" + BOT_TOKEN$ + "/getUpdates?offset=" + next_id$
b$ = wget$(a$)
wlog b$
wlog "Message : "; json$(b$, "message.text")
'SEND WITH GET
msg$ = "This is my Telegram message"
a$ = "https://api.telegram.org/bot" + BOT_TOKEN$ + "/sendMessage?chat_id=" + CHAT_ID$ + "&text=" + msg$
wlog wget$(a$)