Zoneminder&Telegram (event instant messaging to your phone!)

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
PacoLM
Posts: 967
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Zoneminder&Telegram (event instant messaging to your phone!)

Post by PacoLM » Mon Mar 24, 2014 3:28 pm

Hi,

I was thinking in using my ZM server to be able to send instant messages to my phone with the pictures or videos. I found some information about how to send instant messaging with WhatsApp, but the company has changed the auth process, so I moved to Telegram (http://www.telegram.org).
You need to install expect (apt-get install expect).

Right now, I have Telegram CLI working in my ZM server (easy, just followed some instructions detailed here https://github.com/vysheng/tg), and wrote a simple bash script that allows me to send a message and a picture of the event.

This is the script, adapted from many different sources on the web:

Code: Select all

#!/usr/bin/expect
set user [lindex $argv 0]
set text [lindex $argv 1]
set image [lindex $argv 2]
set video [lindex $argv 3]
# this is the path where telegram CLI is installed and the public key for the server
spawn /usr/src/telegram/tg-master/telegram -k /usr/src/telegram/tg-master/tg.pub
expect "User"
send "msg $user $text\r"
send "send_photo $user $image\r"
send "send_video $user $video\r"
expect "Sent:"
send "safe_quit\r"
expect eof

It seems reasonable to add a new option in the filter settings, to allow users to send also a instant message instead of sending an email, ftp to a server, etc. If I have time, I will try to add the option in the filter window and also add the code in the zmfilter.pl. I have experience programming in C#, Tcl and VB, but I'm not 'fluent' in Python, Perl or PHP, so, if anyone wants to take the credits and add this feature...just go ahead!

Regards,

Paco

mini-ITX system (6 IPCams - Ubuntu14.04 - ZM1.31.1)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest