SMS API via url

Henrique3 years ago

I'm not able to use my SMS API, in this case it is via url ex:

<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://[meusite]/sms/?number={phone}&mess={message}</entry>

can someone help?

Anton Tananaev3 years ago

Are you going to provide any details so people can help you?

Henrique3 years ago

@Anton Tananaev of course what detail is needed?

Anton Tananaev3 years ago

OK, I see your config now and it doesn't make sense to me. URL doesn't support placeholders. Where did you get this config from?

Henrique3 years ago

I don't understand this language, I based myself on the example, can you help me?

Henrique3 years ago

I based myself on this example

<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.twilio.com/2010-04-01/Accounts/[YOUR ACCOUNT SID]/Messages.json</entry>
<entry key='sms.http.user'>[YOUR ACCOUNT SID]</entry>
<entry key='sms.http.password'>[YOUR AUTH TOKEN]</entry>
<entry key='sms.http.template'>
    From=[YOUR PHONE NUMBER]&amp;To={phone}&amp;Body={message}
</entry>
Anton Tananaev3 years ago

There's no language. URL is a fixed URL. You probably also need to provide payload.

Henrique3 years ago

Following the example I tried like this, and also without success!

<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://[meu site]/sms/sms.php</entry>
<entry key='sms.http.template'>
    number={phone}&amp;mess={message}
</entry>
Anton Tananaev3 years ago

What is the error?

Henrique3 years ago

it just says it was sent, not the error message, neither on the platform, nor on the log

Anton Tananaev3 years ago

OK, and what about your SMS server?

Henrique3 years ago

It also has no error, and if I test through the link (http://[meu site]/sms/sms.php?number=phone&mess=message), it works normally.

Anton Tananaev3 years ago

Well, as we already established, it's not possible to use parameters via link. It's also not possible to send a GET request, like you do from your browser. It sends POST request with a payload. You need to check if your server supports is.

Henrique3 years ago

ahhh is it POST?

<entry key = 'sms.http.template'>
number={phone}&amp;mess={message}
</entry> 

or

<entry key = 'sms.http.template'>
    {
        "Telefonar}",
        "mensagem": "{mensagem}"
    }
</entry> 

????
oh perfect now I know what to do, thank you very much!

Henrique3 years ago

now it's gone! 100% thank you very much.