3. Once in BotFather type /newbot and follow instructions. As a result you will get your token and your own bot link like t.me/yourname_bot Click on the link and type any message there
4. Open browser (preferably Firefox as it converts JSON automatically) and go here https://api.telegram.org/bot<token>/getUpdates. Replace <token> with your token. As a result you should have something like that. Save your chat ID
5. Create a user library called telegram. paste this code and replace your token and chat ID
Code:
12345678910
require('ssl.https')
localtoken = 'token'-- your tokenlocalchat_id = '1234567'-- your chat idfunctiontelegram(message)
localurl = 'https://api.telegram.org/bot' .. token .. '/sendMessage'localdata = 'chat_id=' .. chat_id .. '&text=' .. socket.url.escape(message)
returnssl.https.request(url, data)
end
6. Create an event based script and use this code to send message to Telegram app:
Older firmware uses SSLv3 for HTTPS requests by default. SSLv3 is disabled on most servers for security reasons so TLSv1.2 or newer must be used instead. HTTPS library in the new FW will use TLSv1.2 by default. The updated code that Daniel posted is perfectly fine and will work on all firmware versions.
(04.06.2020, 04:36)admin Wrote: Older firmware uses SSLv3 for HTTPS requests by default. SSLv3 is disabled on most servers for security reasons so TLSv1.2 or newer must be used instead. HTTPS library in the new FW will use TLSv1.2 by default. The updated code that Daniel posted is perfectly fine and will work on all firmware versions.
I tried this code on firmware 20160714 and it fails:
3. Once in BotFather type /newbot and follow instructions. As a result you will get your token and your own bot link like t.me/yourname_bot Click on the link and type any message there
4. Open browser (preferably Firefox as it converts JSON automatically) and go here https://api.telegram.org/bot<token>/getUpdates. Replace <token> with your token. As a result you should have something like that. Save your chat ID
5. Create a user library called telegram. paste this code and replace your token and chat ID
Code:
1234567891011
require('ssl.https')
localtoken = 'token'-- your tokenlocalchat_id = '1234567'-- your chat idfunctiontelegram(message)
localtelegram_url = 'https://api.telegram.org/bot' .. token .. '/sendMessage?'message=socket.url.escape(message)
localdata_str = 'chat_id=' .. chat_id .. '&text=' .. message..''localres, code, headers, status = ssl.https.request(telegram_url, data_str)
end
6. Create an event based script and use this code to send message to Telegram app:
04.08.2020, 09:03 (This post was last modified: 04.08.2020, 09:04 by phongvucba.)
Hi everybody ! I have shortened the following code to send a message! But it didn't work, I used LM5 RIO2E version 20170620, it still started at first, it doesn't work anymore.
I have tried the telegram bot on the web browser and it still works.
Is there any wrong code in my code?
Please everyone help. !
----------------------------
http= require('ssl.https')
socket.http.timeout = 10
noidung = 'Báo%20động%20có%20người%20đột%20nhập%20qua%20cửa%20sổ!'
local ip=http.request('https://api.telegram.org/bot.../sendmessage?chat_id=-731524114&text='..noidung..'')
log('dfdgdfgdfgdfg=' .. ip)
----------------------
3. Once in BotFather type /newbot and follow instructions. As a result you will get your token and your own bot link like t.me/yourname_bot Click on the link and type any message there
4. Open browser (preferably Firefox as it converts JSON automatically) and go here https://api.telegram.org/bot<token>/getUpdates. Replace <token> with your token. As a result you should have something like that. Save your chat ID
5. Create a user library called telegram. paste this code and replace your token and chat ID
hello
I use SL V2.6.0
I follow the steps but I got this error:
User library telegram:6: attempt to index global 'socket' (a nil value)
stack traceback:
User library telegram:6: in function 'telegram'
User script:5: in main chunk