SMS API and using MessageMedia as the provider

visiondrive4 years ago

With the removal of SMPP (just updated Traccar) I had to move to the SMS API with my provider - below is some information from my experience.

For the config I needed the following to make it work - copied below.

api-key and api-secret are obtained from the MessageMedia portal under Configuration -> API Settings (note that the api-secret is ONLY provided when a new api-key is created - you only get to see this once in their portal and from that point on you only have visibility of the api-key so if you did not save the api-secret you need to delete the current api-key and create a new one to see both).

sender_mobile is not needed but if your provider requires a valid return number (and you have one registered with them) the format is

+countrycodethenmobilenumber

For example in Australia the mobile numbers are like this : 04ab cde fgh with country code +61

So the sender mobile here would be +614abcdefgh (we drop the leading 0) - if you do not define the source_number the sender used will be randomly allocated by MessageMedia meaning SMS notifications to a user will appear from different numbers.

<entry key='sms.enable'>true</entry>
<entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
<entry key='sms.http.url'>https://api.messagemedia.com/v1/messages</entry>
<entry key='sms.http.user'>api-key</entry>
<entry key='sms.http.password'>api-secret</entry>
<entry key='sms.http.template'>
     {
        "messages": [
          {
            "content": "{message}",
            "destination_number": "{phone}",
            "source_number": “sender_mobile”,
            "format": "SMS"
          }
                          ]
      } 
</entry>