Hello
First of all thank you for your summary, precisely in the indicated thread I put a comment requesting a clear guide like yours.
I have done all the steps indicated and it doesn't work for me.
If I manually assemble the url to send messages and paste it in firefox, the message is sent and appears in telegram.
If I put the same token and the same chat id in the user script and create the event script, nothing happens when executing it.
I have modified the user script with a log, in addition to the one present in the event script. This is the result.
This is the user script code
This is the event script
Thank you.
a greeting
First of all thank you for your summary, precisely in the indicated thread I put a comment requesting a clear guide like yours.
I have done all the steps indicated and it doesn't work for me.
If I manually assemble the url to send messages and paste it in firefox, the message is sent and appears in telegram.
If I put the same token and the same chat id in the user script and create the event script, nothing happens when executing it.
I have modified the user script with a log, in addition to the one present in the event script. This is the result.
This is the user script code
Code:
require('ssl.https')
local token = '110xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' -- your token
local chat_id = '-23xxxxxxxx' -- your chat id
function telegram(message)
local telegram_url = 'https://api.telegram.org/bot' .. token .. '/sendMessage?'
message=socket.url.escape(message)
local data_str = 'chat_id=' .. chat_id .. '&text=' .. message..''
local res, code, headers, status = ssl.https.request(telegram_url, data_str)
log(telegram_url, message, data_str, res, code, headers, status, ssl.https.request)
end
Code:
require("user.telegram")
message = 'test message'
res, err = telegram(message)
log(res, err)
a greeting