Unxpected number in JSON at position 4
Closed this issue · 3 comments
Trying to get a simple voice-call example to run smoothly:
`globalThis.fetch = require('node-fetch').default; // uncomment in NodeJS environments
const Sms77Client = require('sms77-client'); // uncomment in NodeJS environments
// get balance
new Sms77Client("<<<>>>>")
.balance()
.then(balance => console.log(aktuelles Guthaben: ${balance}
))
.catch(console.error);
const VoiceParams = {
from: '+491771783130',
text: 'Test1. Testort: Stadt, Schlüssel: ABC1',
to: '+4915112345678',
xml: false
};
console.log('----> Sending Voice Message');
new Sms77Client("<<<>>>")
.voice(VoiceParams)
.then(VoiceResponse => {
console.log('--------> Response:');
console.log(VoiceResponse);
})
.catch(err => {
console.log('--------> ERROR:');
console.log(err);
})`
But i get the following error. The call itself is successfully made.
SyntaxError: Unexpected number in JSON at position 4 at JSON.parse (<anonymous>) at Sms77Client.<anonymous> (\node_modules\sms77-client\dist\Sms77Client.umd.js:213:45) at step (\node_modules\sms77-client\dist\Sms77Client.umd.js:47:23) at Object.next (\node_modules\sms77-client\dist\Sms77Client.umd.js:28:53) at fulfilled (\node_modules\sms77-client\dist\Sms77Client.umd.js:19:58) at processTicksAndRejections (internal/process/task_queues.js:97:5)
Was there a change somehow at the api?
Hi,
which version are you using?
Hi @BoxSo
thanks for reporting. I found the error and fixed it in v2.12.1 which just got published to NPM. Closing this now.
Perfect. Updated package to memtioned version and now it works! Thanks for your work!!!