Twilio Error : The From phone number +1******** is not a valid, SMS-capable inbound phone number or short code for your account - ruby-on-rails

I am getting this error sometimes even if I received the sms .I have checked sidekiq logs and it shows "error_class"=>"Twilio::REST::RequestError"
.I have also checked phone number sms-capablility over twilio account and its status shows it is currently active.

I was getting the same error in my Rails project. My problem was a mismatch between the Twilio account SID and auth token and my twilio phone number (I think I was using test credentials with a real Twilio phone number). Once I got these set up correctly in my project, the problem resolved.

Related

Check status after verification - Twilio Verify

I have a web app with following 3-step flow using Twilio Verify for email verification:
Creating verification code with Verify
Checking verification code with Verify
Create user account in my web api
After a successful Twilio Verify verification code check (step 2), I need to be able to do another Twilio Verfy call to ensure that the email was verified before a user account is actually created in my web api (step 3). But since the SID is deleted after successful email verification, I get following answer for a GET request to:
https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications/{Sid}
{
"code": 20404,
"message": "The requested resource /Services/VAxxx/Verifications/VExxx was not found",
"more_info": "https://www.twilio.com/docs/errors/20404",
"status": 404
}
Now, for the Frontend, it's easy: I move to the final account creation step only if the email was verified successfully.
But, for a true stateless Backend, after accepting the Frontend request I first need to double-check with Twilio if the email was actually already verified.
True stateless in the sense that I do not want to store in a DB if an email was already verified or not. (This is already done by Twilio)
How can I do that? I didn't find the right API in the Twilio documetaion.
Twilio developer evangelist here.
I understand that you would like to get the information that appears available in the logs, however that is not available through the API. Once a verification has succeeded (or timed out after 10 minutes, or reached the maximum number of incorrect attempts) it is deleted and you can no longer access it through the API. I assume this is to prevent replay attacks, but I’m not on that team, so don’t know all the reasons behind it.
The result of this is that you cannot call on the verification check more than once from your code.
You will have to store the state within your own system because the API will not store that state for you. Much like during login with 2FA you would need to store the state that a password had been successfully entered.

Twilio Test Credentials phone number not verified

I am busy writing integration tests for Twilio outbound calls.
Code has been written and all works fine, but want to ensure code coverage with tests.
Using Test Credentials provided and phone number: +15005550006 for the from number,
I get the following error: "Unable to create record: The source phone number provided, +15005550006, is not yet verified for your account. You may only make calls from phone numbers that you've verified or purchased from Twilio."
I have verified that I am using the test credentials to make the API call.
I was no able to reproduce the issue. Are you using a non-trial account? If you are, my recommendation would be to open a ticket at help#twilio.com for further investigation of the issue, along with the full details to reproduce the issue.
How To Use Twilio Test Credentials with Magic Phone Numbers

How do I call a number with Twilio Studio flow REST API execution

The purpose is simply to call a number (my number) and have a message start playing.
I have created a Studio Flow like so:
And published that flow.
I've also bought a phone number and it is activated for voice & messaging. I can receive a test voice call with code and using TwiML).
In the settings of my phone number I have the following:
Accept: Voice Calls
Configure with: .. Studio ..
A call comes in: Studio Flow (and selected the correct flow)
I then proceed to use Postman to try and trigger my Flow using a POST request with the following parameters:
And the following body parameters where the To number is my number which is verified in my trial account, and the from is the number i purchased in twilio:
After clicking on Send in postman I receive a 200 OK message, but I am not receiving a call on my phone. What step am I missing?
Twilio developer evangelist here.
The variable you are using as the number to dial out from Studio is {{contact.channel.address}} but the contact variable refers to "data about the current contact engaging with your flow, such as their phone number".
Since you have triggered the flow with a REST API call there is not a contact that is currently engaging with the flow, so this won't give you the number you want.
You are, however, sending in some parameters from your HTTP request from Postman, notably a To parameter. Your data that you send to the flow endpoint like this will be available under the trigger context variable.
So, you should update your widget to use {{trigger.To}} instead (and you probably don't need From, as that is the number associated with the flow, or Body).
Let me know how you get on with that.

Twilio Application Failed Message

I have been trying to build a app that redirect a Twilio number to another phone number when a customer call Twilio number.
When callback URL does not return proper Twilml, it says "Application has failed" message on the call.
However, I do not want my customers hear that message even though there is a error.
Is there a way to turn that message off?
Thank you.
Twilio evangelist here.
There is no way to disable the error message, but you can set a Fallback URL on your phone number that Twilio will request in case the Voice Request URL fails.
You could set the Fallback URL to a simple static XML file hosted somewhere like Amazon or Dropbox, or use a service like twimlbin.com to host some backup TwiML for you.

Is there a way to see the response to Twilio's request to the SMS URL?

When I set my SMS Url for a given phone number and then send a text to that phone number, the request somehow fails. Is there a way for me to inspect the error response (404/500/403 etc) to see any exception details from my twilio dashboard?
Hi Twilio Customer Support here,
Have you viewed the app monitor?
https://www.twilio.com/user/account/developer-tools/app-monitor
It contains all of the errors that your account has recorded, you can drill down on each error to see the request body etc.

Resources