Whatsapp and sms Notifications

shyy5 years ago

Hello ,
Twillo have API to WhatsApp I used the SMS option to configure notifications to WhatsApp
And it is working fine.
But this mean the I need the pass on the SMS notifications, I tried to duplicate the SMS in the config file to get SMS and WhatsApp notifications but it is only sending WhatsApp and not SMS
Can you please advise what need to do the get Both?
Here are my SMS and WhatsApp SETTINGS

<!-- WhatsApp  SETTINGS -->
<entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
<entry key='sms.http.url'>'https://api.twilio.com/2010-04-01/Accounts/[YOUR TOKEN ID] /Messages.json' -X POST</entry>
<entry key='sms.http.user'> [YOUR TOKEN ID] </entry>
<entry key='sms.http.password'> [YOUR TOKEN SECRET] </entry>
<entry key='sms.http.template'>From=whatsapp[YOUR POHNE NUMBER] &amp;To=whatsapp%3A{phone}&amp;Body={message}</entry>

<!-- SMS SETTINGS -->
    <entry key='sms.smpp.enable'>true</entry>
    <entry key='sms.enable'>true</entry>   
    <entry key='sms.smpp.host'>[sms ip address]</entry>
    <entry key='sms.smpp.port'>9500</entry>
    <entry key='sms.smpp.username'>[user name]</entry>
    <entry key='sms.smpp.password'password]</entry>
Ernesto Vallejo5 years ago

Check this link. Will help you implement a custom Notificator.
https://www.traccar.org/documentation/notificators/

Anton Tananaev5 years ago

You can't have both without modifying the source code.

shyy5 years ago

Thanks Anton,
what are the chance to add this on the next traccar version?

Anton Tananaev5 years ago

Very unlikely, unless someone sponsors this work.

oM5 years ago

Hi guys,

I am enabling the sending of notifications through WhatsApp through Twilio, I have made the modifications in the file traccar.xml according to the mentioned by shyy and I get the following error:

The string "'https" for the URI component SCHEME contains an invalid character,' '', at index 0. - IllegalArgumentException (... <HttpSmsClient: 80 <*: 86 <NotificatorSms: 55 <NotificationResource: 63 <... )

My settings in the traccar.xml are:

    <! - WhatsApp SETTINGS ->
   <entry key = 'notificator.sms.manager.class'> org.traccar.sms.HttpSmsClient </ entry>
   <entry key = 'sms.http.url'> 'https://api.twilio.com/2010-04-01/Accounts/XXXXX/Messages.json' -X POST </ entry>
   <entry key = 'sms.http.user'> XXXXX </ entry>
   <entry key = 'sms.http.password'> YYYYY </ entry>
   <entry key = 'sms.http.template'> From = whatsapp% 3A + 11111111111 & To = whatsapp% 3A {phone} & Body = {message} </ entry>

thanks for your help

Regards,
oM

Anton Tananaev5 years ago

It's clearly incorrect settings. URL must be a valid URL and not what you have.

Gustavo Sousa5 years ago

How to configure?

oM5 years ago

Hello Anton,

Actually I corrected the URL and it works but with a problem I replaced the variable {phone} with my phone number, that is:

 To=whatsapp%3A%2Bmy_phone_number
At this time I only put the To part in the URL

How do I pass the variable {phone} and read the file traccar.xml, since I understand that this variable {phone} corresponds to the phone number you enter when you register a new device and serves to differentiate notifications for each account and by device.

I look forward to your prompt response

Regards,
oM

Anton Tananaev5 years ago

Phone number is your user phone number, obviously, not device.

oM5 years ago

Anton, thank you for your prompt response

You're absolutely right, but for example, I have two users on the platform, each one with its phone number and devices. How I do so that each user will receive notifications of their devices.

Since at the moment my own number is receiving notifications from all users

Anton Tananaev5 years ago

You use {phone} variable. I'm not sure what's not clear about it.

pinheiro5 years ago

boa tarde a todos que
eu sou novo aqui e gostaria de saber como fazer notificações traccar no
Whatsapp

obrigado!

Sydney Retamales4 years ago

Does anyone know where I can get complete information to implement whatsapp to traccar? my email is [REMOVED]

Anton Tananaev4 years ago

Please don't share personal contact details on the forum.