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.
Related
Using twilio calling a phone number is relatively trivial, one can use a number element in a twiml response. But using the client tag is a little more complex, because twilio has to know how to map that client id to a particular callee's device or browser. In my current web project I'm trying to figure out how to call a particular mobile app user without using a phone number. The mobile apps have no problem calling each other, but I'm trying to figure out how to call the mobile app from the website.
The mobile app is probably based on a twilio android kotlin example with a solution based on a twilio nodejs server example that provides the twiml to the twilio cloud. However, in my web app when I use the same client ids that the mobile app uses, I'm not getting a response in the mobile app.
So that leads me to wonder:
How does one register a client id to be called with the client tag?
Also additionally I was wondering is there a way to get a list of all the client ids registered with twilio?
The clients get their identity when they obtain their access token.
Access Token
As you stated you use the <Dial> verb with the <Client> noun to call the client based on the identity they obtained via their access token.
There it not a way to list all registered Twilio clients in an account.
You can use the <Dial> action URL to determine call disposition via the DialCallStatus return value.
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)?
I am working on an Opt-In /Opt-Out api that integrates with Twilio. The way our Opt-In/Opt-Out works is each company (our customer) signs up for one or more Twilio phone numbers and their customers can opt-in/opt-out into these numbers.
When Twilio receives these opt-in/opt-outs we want Twilio to call us into a webhook URL.
So my question is: how do we register these callback URLs? Do these have to be defined at the time when each company signs up for a phone number? If so whats the API end point for that?
These numbers can be added by different companies at any time. Please advise how to do that. We already have URLs defined for sending and receiving SMS messages with Twilio. In this case we first send the message to Twilio and we specify a callback url in that. Can the Opt-In/Opt-outs work with these already registered end points?
All the phone numbers these companies sing up for are created as a subaccount under us. So is that fine with Twilio and can Twilio call us back on the already registered end points (URLs).
If you have any documentation on how to set up an Opt-In/Opt-Out,please include that. I couldn't find one anywhere. The API method we use for creating subaccounts when companies sign up for a phone number is CreateSubAccount and there is no parameter to specify an call back endpoint URL. I tried contacting their support but they haven't gotten back to us yet.
Twilio developer evangelist here.
I'm not sure exactly what you mean when you say "When Twilio receives these opt-in/opt-outs" as the only thing you will get webhooks for is when a number receives an incoming SMS (or phone call, but we're talking SMS right now).
You can set a different SMS webhook URL per each phone number using the API when you buy the phone number. As part of the POST request to the Incoming Phone Numbers resource you can add the optional parameters SmsUrl and SmsMethod.
Once you have purchased the number, you can also update the webhook URLs for it, by POSTing or PUTing to the instance resource, using the same parameters.
Let me know if this helps at all.
I am trying to integrate twilio API to my java code. I have come across a scenario, I have clients A and B. I have send them SMS using twilio and receive the reply back. I am not sure how do I differentiate between the two replies that I would get from the user to my single twilio number.
Twilio developer evangelist here.
You can either work this out by recording which numbers client A has sent messages to and when you get responses from them assign them to client A and then the same for client B.
Or you could buy one more Twilio number and assign one to client A and the other to client B and split things out based on the incoming Twilio number.
I have been trying to find an API call that would allow me to get All call records that are made to one of the phone numbers attached to a subaccount. Each subaccount is for a department and each phone number attached to a subaccount is linked to a specific business case. We need to show analytics to users (heading the department) to show the phone numbers and their individual usage. Can this be done using Twilio API's? We need this functionality badly and any help from you would be greatly appreciated.
Twilio evangelist here.
To access the subaccount data you can either use the master account credentials or the subaccount credentials to authenticate with the Twilio REST API.
If you use the master account credentials you'll need to make a request to the Accounts resource to get an instance of the specific subaccount you want to access.
To get the list of calls to to a specific phone number of the subaccount, you can us a list filter, which in PHP means providing an array to the Calls resource:
https://twilio-php.readthedocs.org/en/latest/usage/rest/calls.html#listing-calls
There are a number of parameters that you can using to filter the results:
https://www.twilio.com/docs/api/rest/call#list-get-filters
Hope that helps.