Handling your business calls and texts like a… boss!

Marcos Placona
Mar 28, 2019 · 3 min read
Image for post
Image for post

I dread the idea of having ever to change my phone number. Be it because I’m getting spammed, or because someone thinks it’s a good idea to call me during the night every night for the…rest…of…my…life. I’d much rather throw away all my business cards with a disposable phone number than to dispose of my real phone number which I had for 15 years now.

To make sure we never have to dispose of our real number, today we are going to look at how to provision new phone numbers that you can give out to people or put on your business cards without leaving the Twilio Console.

Our tools

  • (optional) A picture frame — because you’re going to want to put your picture up looking like a boss when you finish this.

Handling text messages

The beauty of these numbers is that we can release them just as easily as we can get one, which ties well with the idea of never having to “release” the beloved phone numbers we’ve held for years.

I chose a UK mobile number and then headed to the setup page. In that page and under “Messaging”, select “TwiML” and press the “+” button.

On the modal window that the “+” button just opened, enter a name for your TwiML bin. I called mine “Business Card”. Add the following code to handle incoming SMS messages.

Replace the value YOUR_PHONE_NUMBER with your actual mobile number so any incoming messages to your Twilio phone number get redirected to you and then hit save. You're done with this setup and ready to handle phone calls.

Handling text messages

Head to Runtime and create a new Twilio Function. On the Management page click the “+”, choose “Blank” and click “Create”. Give that a name — I called mine “Personal Voicemail” — and set the path to be “/personal-voicemail”.

We want to do a couple of things with this function:

  • Be able to answer calls to our Twilio number on our own number
  • Block certain numbers

Choose “Incoming Voice Calls” under “Event” and add the following code:

The code above check that the number calling your Twilio number is not in the blacklist and in that case will forward the call to your real telephone number.

Make sure you replace the YOUR_PHONE_NUMBER value with your actual mobile number. If you have any numbers you want to add to the blacklist, add them comma-delimited like so:

const reject = [  "+123456789","+15555555","+44123456789"  ];

Go back to the phone numbers page. Under “Voice & Fax” choose “Function” for “When a Call Comes in” and then select your new function and hit save.

When someone calls or texts your Twilio phone number, they should get redirected to your real phone number. You will then have the option to answer it or send straight to voicemail as you would normally.

Boss mode: Unlocked!

Furthermore, we can have several numbers using the same code so we can give them away at different occasions.

I would love to hear about smart ways in which you use Twilio to make your life easier. Hit me up on @marcos_placona or leave a comment below.

Originally published at www.twilio.com.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store