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

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

You can:

  • send text messages
  • send (still) images
  • send videos (gif or mp4)
  • send silent notifications

It’s all on the readme on github. 100% compatible with both Vera and openLuup.

6 Likes

Sorry, got a 404 on the link.

I visit your github site occasionally. (VeraAlexa) Looks like everything got moved.

The link isn’t working!

Sorry, I forgot to make it public. It is now.

image
I guess token = BotKey?

image
DefaultChatID is the number obtained with the command?

Where is BotID?

Tecnically speaking, botid is the part before the colon, botKey what’s after it.
I noticed that now BothFather just merge them

Use this token to access the HTTP API:
ABC:DEF

so, ABC is BotID, and DEF is BotKey. I’m probably submit a path to merge them anyway, and I’ll update the doc in the meantime.

DefaultChatID is the default ChatID you’ll want to send messages to (a Group ID or your own User ID). There should be instructions on the Telegram docs on how to get it.

It’s on the AppStore as well, if you prefer this.

1 Like

@therealdb, is it possible to send emojis (or other text formatting, bold, italic etc) with this plugin?

EDIT: I got emojis to work by simply copying the symbol, but other kind of text formatting is still a mystery…

Yep, it’s markdown. I have bold and italics in place.

Could you post an example lua code?

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.