Adding Existing Numbers to Twilio Connect SID - twilio

We're currently building a Twilio Connect App and testing with our Twilio Projects.
Our main SID is e.g. AC336 and when flow through Twilio Connect, we get a new SID e.g. AC294
We can successfully authenticate with this SID and contact the REST API.
The issue is, this new SID (AC294) has no numbers associated with it, hence we can't send any messages. However, with our App, we want existing Twilio customers to authorise our App and use their existing numbers. We do not wish to or need to, offer to buy them numbers as they likely already have them on their account.
When we currently call the following using the 'new' SID, we get no data:
$incomingPhoneNumbers = $this->twilio->incomingPhoneNumbers
->read(array(), 20);
But if we authenticate with our parent SID e.g. AC336 then we get our phone numbers, as expected.
Is it possible, via Twilio Connect, to make the numbers available in the 'parent' SID (AC336 in our case) available to the authorised App SID (AC294 in this example)?

Related

Twilio Voice calls using sub account

I have more than 10 subaccounts in twilio. On average a subaccount has 2 phone numbers. Now I'm trying to add voice call function. According to the documentation, I have to create Twiml applications and Mobile Push Credentials (to receive calls) and configure each phone number with server urls (https://github.com/twilio/voice-quickstart-android/blob/d7d4f0658e145eb94ab8f5e34f6fd17314e7ab17/README.md)
My questions are,
Should I create one twiml application per subaccount ?
Should I create one Mobile Push Credentials per subaccount?
Twilio developer evangelist here.
You will indeed need a TwiML application per subaccount. That way you can validate the requests made to each endpoint using the auth token from that subaccount. Also, it would allow you to handle individual subaccount call flows independently.
You will also need to create the mobile push credentials per subaccount. Subaccounts can't use cross subaccount resources.
If you do want all your numbers to share resources like TwiML applications and push credentials then you should move all of the numbers from subaccounts to the main account.

Twilio: Send SMS from connected account

Here's what I'm trying:
curl -X POST -d "Body=Hi there, this is a test message from cURL" -d 'From=+1aaabbbcccc' -d "To=+1zzzxxxyyyy" "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_CONNECTED_SUBACCOUNT_SID/Messages" -u "$TWILIO_CONNECTED_MAIN_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"
Where $TWILIO_CONNECTED_SUBACCOUNT_SID is a account SID with the phone number I want to send from. $TWILIO_CONNECTED_MAIN_ACCOUNT_SID is the account SID that the connect button sent back to me (has a name like "Subaccount for ConnectApp: ..."). $TWILIO_AUTH_TOKEN is my (not the connected account's) auth token.
I've tried various permutations of the 3 account SIDs but can't get any of them to work. How do I send an SMS on behalf of a connected account?
I got it to work if I purchase a new number for the $TWILIO_CONNECTED_MAIN_ACCOUNT_SID account via cURL. But I don't want to build a UI for purchasing numbers in my app, I want to let users just pick a number they already own on Twilio, from their main account. Is that possible?
Twilio developer evangelist here.
According to the docs, under permissions:
Charge account for usage
This allows your Connect App to perform actions that charge your user’s Twilio account such as make and receive phone calls, send and receive SMS messages, and buy phone numbers. Your Connect App will not have access to resources in the user’s parent account, like phone numbers. Instead, your Connect App must buy phone numbers on behalf of the user, using the Account SID passed to your Authorize URL.
Emphasis mine.
So, you cannot use a connect account to send messages from existing resources. You will need to buy a new number to send.
An alternative to using Connect here, that would give you access to the account's resources would be to have the user submit their Account SID and an API Key/Secret pair. While it's never ideal to share credentials, an API Key/Secret pair can be easily deactivated without affecting the rest of the account.

Twilio Connect problems

I'm trying to implement Twilio Connect to allow users to use their phone numbers with my app.
In the Twilio console, I see ACd8e3e060b587765318760d5bcd05e3b0 as my Account Sid. However, when I connected a Twilio Connect app to my account, it redirects me to an authorization page with a totally different Account Sid: ACbab18d9990e7af4a42feb51c96cc136f. The problem is that this Account Sid does not have any Incoming Phone Numbers. I provided all the required permissions, how do I use it?
According to the documentation:
When a user revokes permission to your Connect App, Twilio will make an HTTP request to the DeauthorizeCallbackURL. You should update your user database to reflect this.
Where can I revoke permission? Is there some list of Connect Apps which I allowed to use with my account?

Can Twilio Connect Apps access the connected account's incoming phone numbers?

No matter what I try existing phone numbers in a connected account don't show up. Does this mean the connect application must provision all new phone numbers but can't use existing numbers in the user's account?
A Twilio Connect account (which is actually a subaccount of the authorizer's account) cannot access the main account phone numbers. So it works as you suspect, in order to send SMS messages from Twilio Connect subaccount you would need to purchase another Twilio phone number.
If you need additional info, I'd suggest reaching out to support via this form.

verifiy twilio caller ID

I have twilio account and it is upgraded.I have IOS application where from customers number the call will be send to many number so it mandiate to verify the number of the user? and if Yes could any one please let me know if there is any automatic verification process to verify that number without disturbing the customer to verify manually?
Twilio developer evangelist here.
You can verify caller ids via the REST API using the Outgoing Caller IDs resource.
Essentially you make a POST request to that endpoint with the number you want to verify. Twilio will respond with a code that you need to show the user. Twilio will also initiate a call to that phone number asking for the user to enter the code. Once they have done so correctly, the number will be verified.

Resources