I'm following the NodeJS Twilio SDK docs with the following:
const twilio = require('twilio')
exports.sendActivationCode = async (phone, activationCode) => {
const accountSID = '<REDACTED>'
const authToken = '<REDACTED>'
const client = twilio(accountSID, authToken)
return await client.messages.create({
body: `Your activation code is ${activationCode}`,
from: '+1<REDACTED>',
to: `+1${phone.toString().replace(/\D/g, '')}`
})
}
I've checked this numerous times to ensure I have a direct match with the docs. When I try to run the code I get Error: Headers User-Agent forbidden
. The request itself shows the header is going out: 'User-Agent': 'twilio-node/3.45.0 (node.js v10.15.3)'
and the stack output indicates that this is coming from jsdom
-> xhr-utils
.