So I've been trying to automate sending sms for a company that I'm working for using the pushbullet API. When I send multiple messages I get this error on the browser console:
POST https://api.pushbullet.com/v2/texts 500
When i send few messages at a time it runs fine, but when i start sending many messages somtimes the error appears. Is this because I'm sendig too many messages at once or is there a way to solve this?
Here is the code that i use to send the message to the API `sendSms: async function ( iden , numero , smsBody ) { let authHeaders = new Headers(); var body = {"data":{}}
if ( (iden.length === 0 ) || ( numero.length === 0 ) || ( smsBody.length === 0 ) ) {
console.warn("SMS SEND NOT VALID " + iden + ' ' + numero + ' ' + smsBody)
return
}
authHeaders.append( 'Content-Type', 'application/json' );
authHeaders.append( 'Access-Token', APIkey );
body.data.target_device_iden = iden
body.data.addresses=[]
body.data.addresses.push(numero)
body.data.message = smsBody
console.log(JSON.stringify(body))
let response = await fetch ( 'https://api.pushbullet.com/v2/texts', {
method: 'POST',
headers: authHeaders,
body: JSON.stringify(body)
} )
return
}`