06.01.2024, 17:51
(03.06.2020, 18:40)Daniel Wrote: It will work in new FW 2.5.0 which should be available in a month time.
For older fw it will work like this
Code:function request(url)
local resp = {}
local stat, code, hdrs = require('ssl.https').request({
method = 'GET',
url = url,
protocol = 'tlsv12',
sink = ltn12.sink.table(resp),
})
if stat then
stat = table.concat(resp)
end
return stat, code, hdrs
end
local chat_id = '12345'
local token = 'wwwwwwwwwwwwwwwwwwwwwwwwww'
local telegram_url = 'https://api.telegram.org/bot' .. token .. '/sendMessage?'
message = "test"
message=require('socket.url').escape(message)
data_str = 'chat_id=' .. chat_id .. '&text=' .. message..''
stat, code, hdrs = request(telegram_url .. data_str)
Hello, Daniel!
I have LM2 upgraded to 20181002 version.
I used your code for older fw.
Unfortunately, I have reply:
------------
TGtest 06.01.2024 18:30:00
* arg: 1
* nil
* arg: 2
* string: Try again
* arg: 3
* nil
TGtest 06.01.2024 18:30:04
* arg: 1
* nil
* arg: 2
* string: Try again
* arg: 3
* nil
--------------
Could you advice me the right way :-)
Thank you in advance,
KR, Oleg