Make sure that it has SMS and/or Voice enabled for the purposes of this quickstart. Note that in many countries, numbers will only have either Voice or SMS capability; to test both features you will need both types in your number pool. US and Canadian numbers will have both capabilities.
You'll want at least two phone numbers in your Proxy pool.
Once you buy your preferred numbers, make a note of the Twilio string identifier (SID) of the number. You'll need it for this quickstart.
Account SID
- Used to authenticate REST API requests
Auth Token
- Used to authenticate REST API requests
For all of our code snippets and curl examples, you will need to authenticate with the Account SID and Auth Token.
Set up your development environment
The next steps will involve writing some code. We've provided examples in multiple languages, but you will need a working development environment in at least one of them. Here are some guides we've written to help you get your Twilio development environment up and running:
Take a note of the service SID (KSxxxx) that you get as a response.
Add a phone number to your service
We need to associate the number(s) we bought with our newly created service. The phone numbers you add will be added to the anonymous number pool for your proxied communications.
Add a Phone Number
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl
_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
Run it again with a second participant (a different phone number for another proxied user, and a different 'Friendly Name').
For each participant, you'll receive a response with the participant's assigned Proxy number, which will come from the pool of numbers you've added. Depending on the capabilities of the phone number, next either send a text message in the conversation or make a voice call.
Send a text message
If your number has text messaging capabilities, you're ready to roll! If you're looking at a voice proxy, skip to the next section.
Let's send a message from one of the assigned Proxy numbers to one of the participants. Execute the following for one of the participants (the participant you'd like to receive this initial message):
Send a Message to a Participant
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl
_13
// Download the helper library from https://www.twilio.com/docs/node/install
_13
// Find your Account SID and Auth Token at twilio.com/console
_13
// and set the environment variables. See http://twil.io/secure
And with that, the Proxy text conversation can continue!
Make a voice call
If your Twilio Phone Numbers are voice capable, you're now ready for a proxied voice conversation. Following the names from the previous steps, get Alice to make a call to her Proxy Identifier number. Twilio's Proxy service will then make a call from Bob's Proxy Number to his real number and connect the two calls.
Now you're talking anonymously!
(warning)
Warning
If voicemail is enabled for your real number, your outgoing voicemail message may reveal your real number to people who call your proxied number.
Review your outgoing voicemail message to ensure that it does not include your real number. Remember that many default voicemail messages begin by stating the number that the person has reached.
You now know how to create text and/or voice conversations between two masked participants. To learn more about how Proxy works check out the guide to Phone Number Management or dive into the REST API reference.