0

I am trying to send message through twiliousing

const accountSid = process.env.accountSid;
const authToken = process.env.authToken;

const client = require('twilio')(accountSid, authToken);

client.messages.create({
    to:'+61XXXXXXXXX',
    from:'+1XXXXXXXXX',
    body:'ahoy hoy! Testing Twilio and node.js'
}, function(error, message) {
    if (!error) {
        console.log('Success! The SID for this SMS message is:');
        console.log(message.sid);

        console.log('Message sent on:');
        console.log(message.dateCreated);
    } else {
        console.log(error, 'Oops! There was an error.');
    }
}

Console returning

Success! The SID for this SMS message is:
XXXXXXXXXXXXXXXXX
Message sent on:
2022-02-24T05:29:25.000Z

But postman giving 500 status and giving following error

Converting circular structure to JSON
--> starting at object with constructor 'Twilio'
|     property '_accounts' -> object with constructor 'Accounts'
--- property 'twilio' closes the circle

And not receiving msg on the specified number.

philnash
  • 70,667
  • 10
  • 60
  • 88
vivek modi
  • 13
  • 2
  • How have you set up the request in Postman? – philnash Feb 25 '22 at 00:06
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 04 '22 at 03:31

1 Answers1

0

It's hard to say why you get that error message when you sent a request via Postman. Can you share some more details about the way you used Postman?

I'd recommend using the Twilio Postman Collection as instructed here.

IObert
  • 2,118
  • 1
  • 10
  • 17