Your API returned an error.
Did anything change in the body of the sending message? Json to HTML Example. The error indicates that traccar is returning html data and not json.
No, that's not what the error indicates.
I reverted that change and it worked again in Traccar 6.5
https://github.com/traccar/traccar/commit/c75db08c7991af8b3ccc1341a3a80b2f3a6e53cd
I appear to still get this error on 6.5 running 6.3 it works without the error. No changes to the traccar.xml
Not sure what you mean by "still". This topic is about version 6.5.
I am running 6.5 and sending an SMS still results in the error the OP mentioned.
Taking the same xml over to a 6.3 base code results in the SMS notification working.
If I am readin g Cristians post above there was a change reverted in 6.5
https://www.traccar.org/forums/topic/error-notifications-sms/#post-104121
Hopefully this clarifies that "still" means that the code revert does not appear to have resolved this issue..
I think you misread the comment. He said he took version 6.5 and reverted some changes.
OK, so to be clear, we can expect this to be resolved in a future release?
Yes, it will be resolved in the next release. Or you can simply update templates.
thanks Anton,
my xml contains only
<entry key='sms.http.template'>
{
"message": "{message}",
"phoneNumbers": ["{phone}"]
}
</entry>
is this the template you're referring to or somewhere esle?
I assumed i was unable to make the change as per Cristians note without needing to recompile ?
Hello everybody! I use SMS notifications to trigger other APIs like WhatsApp for example, in previous versions, 5.9 for example everything worked perfectly. After upgrading to version 6.5, I'm getting this error every time a notification is triggered:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>SyntaxError: Unexpected token <br> in JSON at position 51<br> at JSON.parse (<anonymous>)<br> at parse (/opt/1015/node_modules/body-parser/lib/types/json.js:92:19)<br> at /opt/1015/node_modules/body-parser/lib/read.js:128:18<br> at AsyncResource.runInAsyncScope (node:async_hooks:203:9)<br> at invokeCallback (/opt/1015/node_modules/raw-body/index.js:238:16)<br> at done (/opt/1015/node_modules/raw-body/index.js:227:7)<br> at IncomingMessage.onEnd (/opt/1015-/node_modules/raw-body/index.js:287:7)<br> at IncomingMessage.emit (node:events:517:28)<br> at endReadableNT (node:internal/streams/readable:1400:12)<br> at process.processTicksAndRejections (node:internal/process/task_queues:82:21)</pre> </body> </html> - MessageException (HttpSmsClient:99 < NotificatorSms:48 < Notificator:39 < NotificationResource:107 < ...)
My XML configuration looks like this:
<entry key='notificator.types'>web,sms</entry> <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry> <entry key='sms.http.url'>http://my-ip:1015/send-message</entry> <entry key='sms.http.template'>{"number": "{phone}","message": "{message}"}</entry>
Any tips on what might be happening? Remembering that this worked perfectly in previous versions.
Thanks