Member-only story
Twilio Proxy for masked phone numbers in Node.js
3 min readJul 14, 2021

Twilio offers a service called Proxy to allow masked phone numbers. What that means? You know when you call an Uber and the number shown to you is not the phone number of your driver?! Exactly that means masked phone number.
The Proxy API connects two parties together, allowing them to communicate and keep personal information private.

How to make a call in Node.js
Let’s get to the point. I’ve made a twilio-service.js
import Twilio from 'twilio'
const TWILIO_SERVICE_ID = 'YOUR_SERVICE_ID' // create a service here: https://console.twilio.com/us1/develop/proxy/services
const TWILIO_ACCOUNT_SID= 'YOUR_ACCOUNT_ID'
const TWILIO_AUTH_TOKEN = 'YOUR_AUTH_TOKEN'
const twilioService = function () {
let client
if (!client) {
client = new Twilio(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, {
logLevel: 'debug'
})
delete client.constructor
}
return {
_client: client,
/**
* Creates new session to prepare a call
* docs: https://www.twilio.com/docs/proxy/api/session
* @returns
*/
createSession: async function () {
return…