Send messages from Vera to Telegram

Hi, here there’s a way to send text messages from Vera to Telegram.

[ol][li]Download and install Telegram from your store[/li]
[li]Open the app and search BotFather bot, start a chat with it and type /newbot[/li]
[li]Follow the instructions and create a bot choosing name and username, BotFather will answer you with a token, keep it.[/li]
[li]Now search the bot you just created typing its username[/li]
[li]Start a chat typing some text message[/li]
[li]Visit “https://api.telegram.org/bot/getUpdates” where is your token[/li]
[li]The webpage will give you a messagge like this: “{“ok”:true,“result”:[{“update_id”:501403863,
“message”:{“message_id”:3,“from”:{“id”:166545828,“first_name”? ? ?”, keep the chat_id (this is an example)[/li]
[li]Create a scene in your Vera and in “Also, execute the following Luup code” enter the following LUA code:
[/li][/ol]

luup.inet.wget('https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat_id>&text=<text>',5);

[ul]replace token and chat_id. Type your message in [/ul]

Now when the scene starts you will receive a text message in Telegram.

1 Like

That is cool.
Anything like this possible with whatsapp?

Cor

maybe…but whatsapp doesn’t have API

Thank you for posting this. I’ve been looking at ways to have my vera send me notifications via iMessage command line, but ran into the problem that the applescript interface doesn’t allow me to send messages to myself (though I do it all the time when getting stuff off my iphone).

In looking at the API, it looks like it’s also capable of doing quite a bit via the API. I’m primarily interested in sending photos on events. It looks like it’ll take a little bit of lua backend work to do the encoding of a photo/video, but it could be worth it.

Found this for Whatsapp messages, haven’t tested, I will test in a few weekends.

cool , I am curious if it will work

Cor

Ref: luup.inet.wget(‘https://api.telegram.org/bot/sendMessage?chat_id=<chat_id>&text=’,5);

Is there a possibility to use a variable as input.

[quote=“icare, post:7, topic:190820”]Ref: luup.inet.wget(‘https://api.telegram.org/bot/sendMessage?chat_id=<chat_id>&text=’,5);

Is there a possibility to use a variable as input.[/quote]
Yes, use … to concatenate.local myText = "<this is my text>" luup.inet.wget('https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat_id>&text=' .. myText,5);

See https://www.lua.org/pil/3.4.html

@jswim788, Thanks a lot, works perfect now!

Hi, very soon the instructions to integrate CallMeBot with Vera will be available.
CallMeBot will allow you to make Telegram Phone Calls (not text messages) from Vera’s scenes.
It has been announced today on their Twitter: https://twitter.com/CallMeBot_com

The bot will ring your phone and say the message that you want.
Very nice and free.

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy