Twilio Test Credentials phone number not verified - twilio

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

Related

The verification could not be sent to NeverBounce

I am new at Zapier and trying to make an email verification using NeverBounce from Zapier and complete the following setup.
I create an app in NeverBounce.
I complete Trigger in steps in Zapier.
Completed the Action and logged in NeverBounce by IP key.
And finally, during testing, I get this error!
The verification could not be sent to NeverBounce.
The app returned `{"message":"We were unable to complete your request. Check our system status at https://twitter.com/neverbounceapi as their may be an issue with our system. The following information was supplied: Insufficient credit balance.
Here is an screen shoot of the error I am facing
Thanks for your help😊.
The error message says you don't have enough credits, you may want to check your account. Or this may be just a glitch with the test procedure and you may want to just proceed with the Zap and see if the actual run is successful.
As an alternative, you may want to switch to Verifalia instead, which not only includes daily credits even with its free plan but also allows to verify lists of email addresses through Zapier (in addition to single email verification).
Verifalia integrations: https://verifalia.com/integrations
Verifalia Zapier integration: https://zapier.com/apps/verifalia/integrations
Disclaimer: I work for Verifalia and have developed its Zapier integration.

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.

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.

Possible to use more than one Twilio studio flow with the same phone number?

I am trying to understand the relationship between phone numbers and studio flows.
Is it one flow per number, so I'd have to pay for a number for each of the flows?
Thanks
Edit: clarification.
Using a pay-as-you-go plan with a deposit and one $1/m phone number.
I need to answer this because the information provided by Twilio support, and my experience, contradict the answer I accepted earlier. Thank you to everyone who attempted to answer this.
My confusion was around the possibility to trigger multiple flows from the same number. This is possible, but the SMS replies to the flow messages drop off unless the flow is initiated from the phone number associated with this specific flow in the console.
So, if I have number-1 and flow-1, I need to associate number-1 with the flow-1 in the number settings. ONLY then will SMS responses to the flow actually go to the flow.
So, the answer to my question is:
Each flow needs its unique phone number, and the number needs to be associated with the flow in the number settings.
This requirement ensures that flows "know" the channel they're on, and will not change as the Twilio Studio moves out of beta.
Indeed in the console, you can only configure one flow for a number. When A MESSAGE COMES IN will trigger the configured flow.
If you have other flows that are not configured with a number, you can pass your Twilio number as from parameter when you trigger the flow via API call. If you don't pass the from number you'll get an error.
Sample Node.js code to trigger the flow via the REST API:
+19993335555 is your Twilio number
const accountSid = 'ACc0966dd96e4d55d26ae72df4d6dc3494';
const authToken = 'your_auth_token';
const TwilioClient = require('twilio')(accountSid, authToken);
TwilioClient.studio
.flows("FW9d816f0b90d2a10b913868462e339d29")
.engagements.create({
to: "+13335557777",
from: "+19993335555"
})
.then(function(engagement) {
console.log(engagement.sid);
});
Docs:
(https://www.twilio.com/docs/studio/user-guide#rest-api)

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

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.

Resources