Telegram Plug-in to send text, images and video notifications

Use double * for bold. \n for new line.

Be sure to url encode everything.

Could you post an example (text = “Some bold text here”) using the exact markup/encoding? I’m sure others would also appreciate it

My memory is failing. By default, Telegram API accepts HTML. I’ve since added a new option to the latest build, to default to Markdown but still be able to specify HTML if you want. Examples here:

dbochicchio/vera-Telegram: Notifications via Telegram bot for Vera/openLuup (github.com)

luup.call_action("urn:bochicchio-com:serviceId:VeraTelegram1", 
  "Send",
  {
     Text="This is <b>bold</b>\nHTML message!",
     Format = "HTML",
     DisableNotification = false
  }, 515)

or

luup.call_action("urn:bochicchio-com:serviceId:VeraTelegram1", 
  "Send",
  {
     Text="This is *bold*\nMarkdown message!",
     Format = "MarkdownV2",
     DisableNotification = false
  }, 515)

EDIT: Update from the store if necessary:

http://vera-ip:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=9320&Version=40580
1 Like

Thanks for the examples / new features!

1 Like

After a bit of testing, I had to revert back to version 0.1. Seems that 0.2 does not properly support the following construction (using this code within Reactor sensor):

local temp = luup.variable_get( )
local msg = “:warning:Temperature low: " … temp … " C”
luup.call_action(“urn:bochicchio-com:serviceId:VeraTelegram1”,
“Send”,
{
Text=msg
}, )

MarkdownV2 wants some charactes (_ * [ ] ( ) ~ > # + - = | { } . !) to be escaped. Just use “Markdown” instead (or HTML). IE:

local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 167) or "N/A"
local msg = "⚠ Temperature low: " .. temp .. " C"

luup.call_action("urn:bochicchio-com:serviceId:VeraTelegram1",
"Send",
{
Text=msg,
Format="Markdown" -- or "HTML"
},
515
)

I’ll try to take care of the special chars in the next updates later this week. Thanks for noticing!

2 Likes

The variables in the form:

are different from those indicated in the configuration notes:

BotToken is like ABC:DEF ?

Thanks. :+1:

EDIT: Yes, the BotToken is BotID:BotKey. My error was in the DeviceID. Now everything works.

1 Like

You’re correct. This is the new configuration and I’ll update the docs very soon to reflect the change.

Option DisableNotification don’t work for me. Always send message with notification.

Telegram will deliver a silent notification, but you’ll find it in your list anyway. I’ve tried this moment ago and it’s working as expected.

I’m sorry. I’ve tried whith the sample:

luup.call_action("urn:bochicchio-com:serviceId:VeraTelegram1", 
  "Send",
  {
     Text="Hello from Vera (Silent)",
     DisableNotification = true
  }, 140)

with my deviceID=140 and Telegram sound for all group members.
Now I use silent mode in the app.

Thanks for the plug-in and I am struggling trying to get it to work, no doubt I am doing something wrong.

I installed the plug in on Vera set up an account on telegram and set up a bot father, have no idea how they would communicate I think that is what I am missing. I set up a bot used the token and ID as noted but nothing. I am definitely missing something. Do you have a guide for dummies? I.e step by step easy and more easy?

Go here, create the bot, get the token and your ID (telegram.org)

  • Get your token and be sure the edit the BotToken variable for your device (under advanced, variables).

Then use in code and/or in Reactor, as suggested on GitHub. There’s nothing more to add, really.

OK, I have the following completed;

  1. Plug-in installed with the token from the telegram/botfather and have identified the by correct ChatID by using the https://api.telegram.org/bot-token number/getUpdates
  2. used the following code to send the message
    luup.call_action(“urn:bochicchio-com:serviceId:VeraTelegram1”,
    “Send”,
    {
    Text=“Hello from Vera”,
    ChatID = taken from the above
    }, device# on vera created by the plugin)
  3. nothing happened, should I add code at the bot level?

Not sure what set I am missing but I am missing something.

Any guidance is greatly apprecaited.

I believe the code I am missing in the code for the botfather would anyone have an example of what I need to use to send Alexa a notification?

Major breakthrough, I have tried it on my Vera Plus and it sends the message to Telegram but it will not announce on Alexa. It will not work on my vera 3 for some reason.

One step closer all I need is it to announce on Alexa. I think I am missing the botfather code.

How are you supposed to announce that on alexa? This plugin is intended to send a message to telegram and I’m struggling to add alexa to the mix.

Thanks I appreciate the plug-in and your time, do you currently have a way to have Alexa announce the notifications? If so can you point me in the right direction?

There is the VeraAlexa plugin https://github.com/dbochicchio/VeraAlexa also available on the mios app store.

1 Like

Thank you, appreciate it and have installed. Only thing is the cookies.txt file I use edge and chrome and it is a little harder to find it.