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
- A Twilio account - you can get one for free here
- (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 first thing we need to do is go to the phone numbers page and buy a phone number.
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.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message to="YOUR_PHONE_NUMBER">
{{From}}: {{Body}}
</Message>
</Response>
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
We could do the same thing we did above with phone calls and be done with it, but I like to treat people who call me directly a little better.
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:
exports.handler = function (context, event, callback) {
/***** configuration *****/
const phoneNumber = 'YOUR_PHONE_NUMBER';
const timeout = event.Timeout || 12;
const secureRecordingLinks = false;
const voiceOpts = {
'voice': 'alice',
'language': 'en-US'
};
const reject = [
// To block a caller, add the E164 formatted number here
];
let rejectMessage = "You are calling from a restricted number. Goodbye.";
/***** end configuration *****/
let thisFunction = 'https://' + context.DOMAIN_NAME + '/personal-voicemail';
function shouldReject() {
return reject.length && event.From && reject.includes(event.From);
}
function rejectInbound() {
let twiml = new Twilio.twiml.VoiceResponse();
if (rejectMessage) {
twiml.say(rejectMessage, voiceOpts);
}
twiml.hangup();
return twiml;
}
function handleInbound() {
const dialParams = {
'action': thisFunction
};
if (event.CallerId) {
dialParams.callerId = event.CallerId;
}
if (timeout) {
dialParams.timeout = timeout;
}
const twiml = new Twilio.twiml.VoiceResponse();
twiml.dial(dialParams, phoneNumber);
return twiml;
}
function redirect() {
const twiml = new Twilio.twiml.VoiceResponse();
twiml.redirect(thisFunction);
return twiml;
}
switch (true) {
case event.CallStatus === 'queued':
callback(null, redirect());
break;
case event.CallStatus === 'ringing':
callback(null, shouldReject() ? rejectInbound() : handleInbound());
break;
default:
callback();
}
};
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!
Now that our number is safe from spam or abuse, we can rest assured knowing that if ever anyone gets hold of our Twilio number and decides to abuse it, we can always release it and get another one using the code we've already written.
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.



Top comments (5)
I get the same dread of losing a 15‑year‑old personal line when spam and midnight calls start to dominate, so the idea of a throw‑away business number is pure sanity. What you’re doing mirrors the way many professionals treat Texas Online Records, preserving a permanent identifier while swapping out the disposable layer as needed. Buying a new Twilio number from the console and releasing it with a click gives you that exact flexibility, and the API hooks let you automate the entire cycle without ever touching your real contact.
Your frustration with nightly spam calls and the reluctance to retire a 15-year-old number mirrors the need for a clean split between personal and professional lines, which is why Twilio’s instant-provision workflow is a game-changer. By buying a disposable line in the console you keep your primary contact while handing out fresh numbers on business cards, and a quick background check can validate any new lead against Cobb Public Records before assignment. This layered approach safeguards reputation and streamlines onboarding without compromising your core identity.
While it is understandable to hesitate before retiring a 15‑year‑old personal number, Twilio’s disposable buying flow offers a practical solution for reducing spam and unwanted calls. Tennessee Registration Details demonstrate how granular data can be managed without exposing core identifiers, mirroring the same principle of secure provisioning. By accessing the phone numbers page you can instantly provision a fresh line, label it for a specific campaign, and later release it with a single click, preserving your primary contact while keeping outreach agile and cost‑effective.
I totally get the dread of losing a number you’ve kept for 15 years, which makes Twilio’s disposable‑number workflow a real lifesaver for business cards. When you think about the administrative overhead, it reminds me of the meticulous record‑keeping at Kane County Courts, where entries can be added or withdrawn with precision. The console lets you buy, assign, and release a line in seconds, preserving your primary number while still handing out fresh contacts. Give it a try and you’ll never fear night‑time spam again.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.