Has anyone used textlocal in the UK for sms notifications from traccar ver 4.2 http api

Anton Tananaev5 years ago

Just change URL to you own server or proxy and check what is sent.

Adrian Hodgson5 years ago

Obvious really, thank you.

Adrian

Adrian Hodgson5 years ago

I changed the sms.http.url to point to a server on 192.168.1.220

    <entry key='notificator.types'>web,mail,sms</entry>
    <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
    <entry key='sms.http.url'>http://192.168.1.220/send/</entry>
    <entry key='sms.http.template'>
        apikey=abcdefghijkLMOPQR1234567890&amp;message={message}&amp;sender=tracker&amp;numbers={phone}
    </entry> 
</properties>

Started traccer and triggered an event, I got email and in the incoming log of the server all I saw was:-

192.168.1.135 - - [16/Jan/2019:22:00:06 +0000] "POST /send/ HTTP/1.1" 404 499 "-" "Jersey/2.27 (HttpUrlConnection 1.8.0_191)"

So I read that as it sent POST/send/

Thought I would try something from within a browser URL line, so I entered

http://192.168.1.220/send/apikey=abcdefghijkLMOPQR1234567890&message={message}&sender=tracker&numbers={phone}

the response in the log was:-

"GET /send/apikey=abcdefghijkLMOPQR1234567890&message=%7Bmessage%7D&sender=tracker&numbers=%7Bphone%7D HTTP/1.1" 404 606 etc

So it looks as though it is not passing the apikey line to the output, I have tried adding "" to the line and also {} without success, so wondering if I have missed some other config to traccar.xml.

I continue to try options.

Adrian

Anton Tananaev5 years ago

Template is passed as a request body, not as a part of URL. Which is the standard and expected HTTP POST behavior.

Adrian Hodgson5 years ago

Sorry Anton, not quite understanding, I was hoping to see what was sent from traccar on a notification, would I not see that in the access.log line?

Anton Tananaev5 years ago

It won't be there because log doesn't capture full request.

Adrian Hodgson5 years ago

OK As you can tell I am struggling to understand trying to learn all aspects of this.

I did some more reading of the textlocal examples I found I also needed a ? in the line.

If I enter the following in a url line of firefox and hit return (Changed apikey and telephone number for my sake) my phone got an sms message back from the textlocal service and I also got a screen up to say success.
https://api.txtlocal.com/send/?apikey=abcdefghijklmno1234567890&message=will it work&sender=tracker&numbers=01234567890

I have tried

   <entry key='sms.http.template'>
        ?apikey=abcdefghijkLMOPQR1234567890&amp;message={message}&amp;sender=tracker&amp;numbers={phone}
   </entry> 

With no joy, I also tried the ? as /send/? still no luck.

I will keep reading and try to figure a way to see what is sent to my local server from traccar,

When I use the URL method the response on sms is within seconds so would be good if I can solve my understanding and issues..

Thanks again for time.

Adrian

Anton Tananaev5 years ago

Does your provide support POST form? That's what your original Java example does.

By the way, you should not add ? at the beginning on the template. It makes it invalid form data.

Adrian Hodgson5 years ago

Sorry for delay I must decrease my mail checking time.

I see that messages can have GET and POST type messages, but forgive me as it is all above my understanding. There seems to be several examples on the website and I could probably fill several pages of post trying to list them.

What I can do as a short cut, is post this link:
http://api.txtlocal.com/docs/sendsms

I did some more digging and found mention of smpp in part of the site, but it is not available in the code examples, or in my textlocal control panel. So it may have been dropped all I can do is send them an email and ask if still supported and ask again for some documentation.

Anton, you have tried to help me on this for some time, I am sure your time can be better spent on something else, I will not be offended if we close the request off as I can really be of no help in solving my own issue.

Adrian

Adrian Hodgson5 years ago

I did get a response during the day from them about smpp

Hi Adrian,
SMPP is only offered for government sector or volumes in excess of 1 million messages, so I would not be able to share the documentation I'm afraid.
The API functions should be sufficient for most use cases.
Kind Regards,

So it closes it off for the time being until I learn more and gain a better understanding.

Adrian