This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Telegram bot API
#10
(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!
Reply


Messages In This Thread
Telegram bot API - by Domoticatorino - 18.10.2016, 11:49
RE: Telegram bot API - by Erwin van der Zwart - 18.10.2016, 15:35
RE: Telegram bot API - by Domoticatorino - 18.10.2016, 21:23
RE: Telegram bot API - by Erwin van der Zwart - 19.10.2016, 08:36
RE: Telegram bot API - by Domoticatorino - 19.10.2016, 09:22
RE: Telegram bot API - by Erwin van der Zwart - 19.10.2016, 09:33
RE: Telegram bot API - by Domoticatorino - 27.10.2016, 12:05
RE: Telegram bot API - by admin - 27.10.2016, 13:05
RE: Telegram bot API - by Domoticatorino - 27.10.2016, 21:23
RE: Telegram bot API - by Domoticatorino - 15.11.2016, 12:20
RE: Telegram bot API - by DGrandes - 05.09.2018, 16:19
RE: Telegram bot API - by baggins - 09.02.2020, 22:52
RE: Telegram bot API - by admin - 10.02.2020, 06:40
RE: Telegram bot API - by baggins - 10.02.2020, 07:53
RE: Telegram bot API - by admin - 10.02.2020, 08:22
RE: Telegram bot API - by baggins - 10.02.2020, 09:08
RE: Telegram bot API - by Dario - 19.03.2020, 18:43
RE: Telegram bot API - by admin - 19.03.2020, 18:48
RE: Telegram bot API - by Dario - 20.03.2020, 09:48
RE: Telegram bot API - by JRP - 12.05.2020, 18:06

Forum Jump: