I am trying to send SMS to a user phone number using twillo Communication APIs for SMS, Voice, Video & Authentication | Twilio, i have followed the Python/Django Docs but i keep getting this error whenever i call the function that will send the OTP to the mobile phone.
Error:
TwilioRestException at /accounts/login
e[31me[49mHTTP Error [0m [37m [49m] Your request was: [0m]
e[36me[49mPOST /Accounts/ACbf48722e94de551d3ad561f9eda0e707/Messages.jsone[0m
e[37me[49mTwilio returned the following information: [0m]
e[34me[49mUnable to create a record: Authenticatee[0m
e[37me[49mMore information may be available here: [0m]
e[34me[49mhttps://www.twilio.com/docs/errors/20003e[0m
This is the code to send the OTP when a user tries to login to their account.
if user is not None:
account_sid = "ACbf48722************07"
auth_token = settings.TWILIO_AUTH_TOKEN
verify_sid = settings.TWILIO_ACCOUNT_SID
verified_number = settings.VERIFIED_NUMBER
client = Client(account_sid, auth_token)
client.messages.create(
body='Login Otp is: 342085',
from_=settings.TRIAL_NUMBER,
to=settings.VERIFIED_NUMBER
)
What could be going wrong? I cannot seem to find any answers pointing to this error on the internet.
Update:
I have updated the API Keys with the test credentails: And now i got this error:
e[34me[49mUnable to create record: The From phone number +1 218 778 3273 is not a valid, SMS-capable inbound phone number or short code for your account.e[0m