Using Twilio, can I create numbers on my account for a client using API? - twilio

If I am trying to offer a service for people to call the seller on my site, without using their number, but can I use Twilio API to let the buyer be get a number on my account. And I can set a limit on how many messages they can sent, and have complete control over the number that is created.

Yes, you can manage numbers with API calls.
https://support.twilio.com/hc/en-us/articles/223182728-Using-the-API-to-search-for-and-buy-Twilio-phone-numbers
For example:
You can search for available numbers
https://www.twilio.com/docs/api/rest/available-phone-numbers
You can add a new phone number to your account
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#local-incomingphonenumber-factory-resource

Related

Is it possible to send an Twilio SMS with a custom "from" or "reply-to" number?

I was tasked with writing a web app which would allow customers to type and send a message on their browser (mobile or desktop) to a business. I was able to achieve this using Twilio, however the business requested that they received the messages from the customer themselves and NOT the Twilio number.
Basically, they want to establish a connection between the customer and the client via SMS
This is the way I forwarded the message:
Customer Browser -> Twilio -> Business Phone
The SMS body would include customer message, name and phone number.
The problem with this approach is that the business employees want to be able to simply press "reply" on their phone messaging app and connect directly with the customer instead of receiving the text message from a Twilio number, and starting a new message to send to the customer (apparently this doesn't integrate properly with their database).
Is there a way to send an SMS from a Twilio number but appear as if it was sent from a customer number? Hence, change the "from" / "reply-to" number.
Thank you.
Edit: I think its possible that I request and authorize customer numbers to my Twilio account. However this would mean storing customer phone numbers and I'm not sure if I have the permission to do this.
This is how you send a message (NodeJS):
client.messages.create({
body: 'Hello from Node',
to: '+12345678901', // Text this number
from: '+12345678901' // From a valid Twilio number
})
The from attribute MUST be a valid (authorized) Twilio number. Hence why customers would need to give away their number in order to become valid.
In my opinion, this is not possible and that is very good so. Think about the implications if you could just send a message from a number that you don't own. Furthermore, it is not optimal if you would request access to your customer's phone numbers. However, you could use the Twilio proxy service in order to set up the conversation between the client and the customer. For more information please visit the proxy docs. It is still in Beta but works reliably IMO.
You cannot.
Even with the authorized numbers feature, it requires an opt-in via a phone call or SMS response which your customer would have to field.
Perhaps allow a customer to include their number in the message body, which with modern phone's is as simple as clicking the number to bring up the ability to message that number
For more info see here twilio docs

Determining billing based on which API Key was used?

My organization is using the Twilio SDK in C# to sms and mms messages with a single long code. We have several teams in several different departments using it for various purposes and are looking to track how much of the bill belongs to each team. Each team has an API Key that they are using to authenticate their calls to send a message: TwilioClient.Init(apiKey,apiSecret,accountSid);
Is there anyway to see in the sms logs a breakdown of which API Key was used to send messages?
There is not. You can however use sub-accounts which are logical containers of resources, and then the usage API to determine usage by subaccount.

Twilio Opt-In/Opt-Out API

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.

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.

Twilio: How to get Call record for this month on a specific phone number in a subaccount

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.

Resources