I am trying to send sms to number using Twilio API's, but I am getting error like [RestException [Error]: The 'To' number 9977428080 is not a valid phone number.] {
status: 400,
message: "The 'To' number 9977428080 is not a valid phone number.",
code: 21211,
moreInfo: 'https://www.twilio.com/docs/errors/21211',
detail: undefined
}
before this I was getting the from number is not valid
then I switched my API's credentials testing to Live credentials, the I got this another issue.
These are the code below
const client = require('twilio')(config.SId, config.AccesToekn);
// SEND OTP TO USER ACCOUNT
router.post('/sendsms',(req, res, next)=>{
client.messages.create({
from:'+15204770942',
to:"9977428080",
body:'Please user this OPT to verify your number 74536',
}, function(error, data){
if(error){
console.log(error,'error')
console.log(data,"data")
}
})
})
and My credential are correct. What might be cause of occurring this issue, any your help would be highly appreciated
Thanks in Advance
[RestException [Error]: The number is unverified. Trial accounts cannot send messages to unverified numbers; verify at twilio.com/user/account/phone-numbers/verified, or purchase a Twilio number to send messages to unverified numbers.] {
– Kubiak