BysMax
Back to course

How to configure WhatsApp Notifications in Traccar

Learn how to integrate WhatsApp alerts into your Traccar server using external gateways and webhooks to improve communication with your users.

Emmanuel Díaz Leal Hernández

May 25, 2024
Intermediate

WhatsApp is one of the most requested communication channels for tracking platforms. Although Traccar does not include it natively like Telegram, integration is simple using the platform's SMS or Web notification system.

WhatsApp Integration in Traccar

To send WhatsApp notifications, we need a "bridge" or Gateway that converts Traccar messages into WhatsApp messages.

1. Using an SMS-to-WhatsApp Gateway

Many providers (such as Waboxapp, Twilio, or local gateways) allow sending WhatsApp messages using a simple HTTP API. In Traccar, we configure this in the SMS section of the traccar.xml file.

<entry key='notificator.types'>sms,web,mail</entry>
<entry key='sms.http.url'>https://api.your-provider.com/send-whatsapp</entry>
<entry key='sms.http.authorization'>YOUR_TOKEN_HERE</entry>
<entry key='sms.http.template'>
    {
        "to": "{phone}",
        "message": "{message}"
    }
</entry>

Note: Make sure the JSON format in sms.http.template matches what your provider requires.

2. Using the Web Notificator (Webhook)

If your provider requires a more complex structure or you are using a self-hosted solution like Evolution API or WPPConnect, you can use the web notificator:

<entry key='notificator.web.url'>https://your-webhook.com/whatsapp</entry>
<entry key='notificator.web.header'>Authorization: Bearer YOUR_TOKEN</entry>

Phone Configuration

For notifications to arrive, users must have their phone number configured in their Traccar profile using the international format (example: +1234567890).

Advantages of using WhatsApp

  • High open rate: Users read WhatsApp almost instantly.
  • Low cost (depending on the gateway): If you use your own gateways, the cost is minimal compared to traditional SMS.
  • Interactivity: You can send links to the live location of the vehicle.

Best Practices

  1. Avoid Spam: Do not configure all events for WhatsApp. Use it only for critical alerts like "Alarm" or "Power Cut".
  2. Message Queueing: If you have many devices, make sure your gateway can handle the message volume to avoid being blocked by WhatsApp.

With this configuration, your Traccar platform will offer a much more professional experience for your customers.

Comentarios (0)