0

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
}`

1 Answers1

0

Error 500 means the problem is with the server instead of the client. The most likely case is that there is a limiter of the requests and that is why it works perfectly with few requests but not many requests.

Amodh
  • 367
  • 1
  • 3
  • 16