Send Slack Notification

Matt Harding5 years ago

I just set up Traccar, and it's been extremely straightforward! Thanks for all your hard work!

My team uses Slack heavily, so I wanted to create a "Notificator" for Slack. It was very easy to do, using the HTTP SMS configuration options.

  1. Set up a Slack App Incoming Webhook and make a note of the URL.

  2. Add these lines to /opt/traccar/conf/traccar.xml:

    <entry key='notificator.types'>web,mail,sms</entry>
    <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
    <entry key='sms.http.url'>https://hooks.slack.com/services/*******/*******/****************</entry>
    <entry key='sms.http.template'>{"text":"*Notification from Traccar*:\n```{message}```"}</entry>
  1. Restart the server: sudo systemctl restart traccar.service

  2. Log into the web interface, click "Profile", then click the mail icon to "Send Test Notification". It should send the notification to Slack.

Luis Chavez4 years ago

Works fine! Thanks!