SMS API using SMS.to

cnecrea5 years ago

Hello,

Can someone help me to setup SMS.to API? I think I am doing something wrong, isn't working.

    <!-- SMS Settings -->
    <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://api.sms.to/sms/send</entry>
    <entry key='sms.http.authorization'>TOKEN_KEY</entry>
    <entry key='sms.http.template'>
    {
        "to": "{phone}",
        "body": "{message}"
    }
    </entry>

I am stuck and not able to configure this API...

cnecrea5 years ago

Problem solved. Many thanks anyway.

Thomas5 years ago

Mind to share the solution??

Thomas5 years ago

Solution:

<entry key='sms.http.authorization'>Bearer [TOKEN_KEY]</entry>
 "body": "{message}" ->  "message": "{message}"
cnecrea5 years ago

For sure. The SMS config is the:


    <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://api.sms.to/sms/send</entry>
    <entry key='sms.http.authorization'>Bearer [API_KEY_HERE]</entry>
    <entry key='sms.http.template'>
   {
        "sender_id": "[INSET_SENDER_NAME. EX: FROM_TRACCAR]",
        "to": "{phone}",
        "message": "{message}"
    }
    </entry>
Daniel5 years ago

Hello,

<entry key='sms.http.authorization'>Bearer [API_KEY_HERE]</entry>

Please example use

Ketil5 years ago

I attempted to configure traccar like this on our windows server 2019 with the latest jre/jdk(june 18)

<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://api.sms.to/sms/send</entry>
    <entry key='sms.http.authorization'>Bearer ZIUzO******************c6tGi</entry>
    <entry key='sms.http.template'>
   {
        "sender_id": "Warning!",
        "to": "{phone}",
        "message": "{message}"
    }
    </entry>

Attempting to send a test notification from the account menu, I end up with the following error.

Received fatal alert: handshake_failure - SSLHandshakeException (... < HttpSmsClient:89 < NotificatorSms:57 < NotificationResource:63 < ...)

searched the forum and found a post about including the 1.2 TLS version in the service string, which i then did like this

sc config traccar binPath= "C:\Program Files\Traccar\jre\bin\java.exe -Dhttps.protocols=\"TLSv1.2\" -Duser.dir=\"C:\Program Files\Traccar\" -jar \"C:\Program Files\Traccar\tracker-server.jar\" --service \".\conf\traccar.xml\""

I verified the change.

C:\Program Files\Traccar\conf>sc qc traccar
[SC] QueryServiceConfig SUCCESS
SERVICE_NAME: traccar
  ...
      BINARY_PATH_NAME   : C:\Program Files\Traccar\jre\bin\java.exe -Dhttps.protocols="TLSv1.2" -Duser.dir="C:\Program Files\Traccar" -jar "C:\Program Files\Traccar\tracker-server.jar" --service ".\conf\traccar.xml"
.....

and restarted the service, logged in, and attempted to send the message but is still getting the same error.
Iv checked the tracker-server.log but I can't find anything that seems relevant, i also tried verifying the SMS service with curl and that part works as expected. would anyone by any chance have an idea what it is I'm doing wrong?

Anton Tananaev5 years ago

Try using different Java version.

Ketil5 years ago

jdk or jre ?

Would you recommend a speciifc version ? (231 or ealier ?)

Anton Tananaev5 years ago

JRE. I guess latest version would be the best.

Ketil5 years ago

that's the odd thing, it is the latest version of jre 251 (installed on the 3 days ago)

Anton Tananaev5 years ago

Have you configured Traccar to use it? From your post above it looks like you are still using the embedded version that comes with Traccar.

Ketil5 years ago

snap! hang on

Aakansha3 years ago
<entry key='sms.http.authorization'>Bearer [API_KEY_HERE]</entry>

What is Bearer here!

Aakansha3 years ago
        "to": "{phone}",
        "message": "{message}"

Curly Braces has to be removed of Phone , Message??