15.11.2016, 12:20
(27.10.2016, 21:23)Domoticatorino Wrote: Thank you Erwin.
I did it.
Regards.
Hi there,
let me give you the instruction to use Telegram (https://telegram.org/) as instant message service. Follow these steps:
- install telegram in your phone
- searching on app the BotFather and this easy telegram program can allow you to create your own bot. Here you will find your bot "TOKEN number".
- Share your bot to your user and send a simple message to it.
- After that you can find your CHAT_ID which you can read with a URL request https://api.telegram.org/bot<token>/getUpdates.
Add user script as follow (user.telegram)
require 'ssl.https'
local telegram_url = 'https://api.telegram.org/bot<token_bot>/sendMessage?'
local chat_id = '<chat_id>'
function telegram(message)
local data_str = 'chat_id=' .. chat_id .. '&text=' .. message..''
local res, code, headers, status = ssl.https.request(telegram_url, data_str)
end
Add a event-script as follow example:
require("user.telegram")
message = ('<your own message>')
telegram (message)
end
Have fun!