You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not a bug or feature request, but more of a how-to.
I wanted to be able to send push notifications without compiling my own apps and wasn't really interested in receiving email notifications (too many emails already!). I already use Join on Android and have used Pushover and Pushbullet in the past, so thought I could use these.
I did this by defining a local email address which will receive Traccar notifications and then use procmail and a custom script to send the notification. I use Debian, but I assume this should work on any system that supports procmail.
In Traccar, create a user with that local email address and share the devices and geofences with that user OR change the email address of an existing user to the local email address
Change the smtp server details in Traccer config or user attributes
# .procmailrc
# routes incoming mail to appropriate mailboxes
PATH=/usr/sbin:/usr/bin
MAILDIR=$HOME/mail
:0b:
* ^From:.*(traccar@localhost.localdomain)
| /opt/traccar/traccar_notifications.pl
The file traccar_notifications.pl will be the script that will push the notification. I know that Pushbullet (https://docs.pushbullet.com/) and Pushover (https://pushover.net/api) have simple API's that can be used. This example is for Join (on Android).
Create the /opt/traccar/traccar_notifications.pl file
#!/usr/bin/perl
use LWP;
my $line = "";
while (<>) {
$line = $line.$_;
}
my $join = LWP::UserAgent->new();
my %parameters =
(
"apikey" => "joinapikey",
"deviceNames" => "join.device",
"deviceId" => "join.deviceid",
"title" => "Traccar",
"icon" => "https://www.traccar.org/icon.png",
"text" => $line,
);
my $url = URI->new("https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush");
$url->query_form(%parameters);
$join->get($url);
chmod 755 /opt/traccar/traccar_notifications.pl
Test notifications by executing the following command. Assuming you get a notification on your phone, continue. Otherwise, check the traccar_notifications.pl script. echo Test Notification | /opt/traccar/traccar_notifications.pl
Change the Traccar templates so only simple text is sent.
This is not a bug or feature request, but more of a how-to.
I wanted to be able to send push notifications without compiling my own apps and wasn't really interested in receiving email notifications (too many emails already!). I already use Join on Android and have used Pushover and Pushbullet in the past, so thought I could use these.
I did this by defining a local email address which will receive Traccar notifications and then use procmail and a custom script to send the notification. I use Debian, but I assume this should work on any system that supports procmail.
Define a local email address (traccar@localhost.localdomain) using the guide here: https://gist.github.com/raelgc/6031274 up to step 4
In Traccar, create a user with that local email address and share the devices and geofences with that user OR change the email address of an existing user to the local email address
Change the smtp server details in Traccer config or user attributes
sudo apt-get install procmail mailutils
)echo "|/usr/bin/procmail" > $HOME/.forward
Create the /opt/traccar/traccar_notifications.pl file
chmod 755 /opt/traccar/traccar_notifications.pl
Test notifications by executing the following command. Assuming you get a notification on your phone, continue. Otherwise, check the traccar_notifications.pl script.
echo Test Notification | /opt/traccar/traccar_notifications.pl
Change the Traccar templates so only simple text is sent.
The text was updated successfully, but these errors were encountered: