How to create a voicemail inbox for your journalism

13 February 2021

BLOG

The New York Times recently produced an awesome article series called Primal Scream, where a published phone number allowed readers to call in and talk about their experience raising children during the pandemic.

Listening to your readers, however you can, is crucially important in evolving your delivery of digital journalism. Entire consultancies such as Hearken are built on involving communities in business, especially journalism. City Bureau in Chicago bring people together in workshops to discuss the problems they are facing, ultimately producing media that is more honest, more involving, and crucially more desired.

But how do you do that when you're a national newsroom at scale? Or even at the scale of a single city? How can we use technology to make it easier than ever for readers to get in touch with journalists and becoming involved in our storytelling.

Whilst years ago running a phone in line like this was something that only the largest newsrooms with the deepest pockets could accomplish, advances in digital technologies have made creating the Primal Scream phone line possible for even the smallest reporting outfits.

Recording hundreds of voicemails to a dedicated phone number could cost you as little as $20. It requires very little technical knowledge, and just a few short steps to get everything up and running.

We used the same technology when I worked for The Times for our NHS memories project. Hearing the voices of readers telling their own stories adds impact that a typical written interview wouldn't have. Primal Scream I think shows that impact in a whole new way.

So how do you do it?

Basically we have a company called Twilio to thank for this. Twilio bring all that complexity in call-centres and telecoms networks and make it accessible and programmable over simple control panels. Fortunately what we'll be asking it to do is very easy to follow, and you don't need to know any code to get started.

There are three main parts to this project. You're going to need to set up two things: a phone number, and a handler function for calls to that number. And you will need to record one piece of audio to upload that will act as your voicemail greeting.

Let's get going:

  1. Sign up to Twilio
  2. To start, let's get a phone number. From your control panel find 'Programmable Voice' from the overflow menu (pin it for easy use later), and then go to 'Numbers'
  3. You'll need to upgrade your account by adding a small amount of cash at some point around about here. If you aren't prompted, or can't find out how, there's a guide on how to do that here. Unless you enable the auto-recharge feature, should you run out of credit, Twilio will simply cease to operate service to you.
  4. Find 'Get a number' and search for a number you can use. Your number will need to support voice calls, so look for the 📞 phone icon.
  5. Once you've purchased your number, we need to set up your voicemail. Let's start with the recording. Use any audio recording program, such as Audacity or any online tool to get a file that you are happy with.
  6. Now go to Functions->Runtime in the menu (pin this also) and click Functions Classic. The new Services feature doesn't support what we need to do yet. Click the red plus and give this any name you want voicemail-recorder for example.
  7. To upload the file we're going to need to open the menu again and go to Runtime->Assets. Select Assets (Classic) in the sidebar, and upload your file. Make sure it's public. Once it's uploaded select the URL in the PATH field and save it somewhere, you'll need this in a moment.
  8. Now back to the Functions Classic menu, and open your function. Let's give it a PATH like /voicemail (this must start with a slash). Underneath in the configuration field make sure Access Control is disabled, select the Event to be Incoming Voice Calls, and then in the Code box enter the following. Make sure to put your saved asset URL in!
exports.handler = function (context, event, callback) {
  const twiml = new Twilio.twiml.VoiceResponse();
  twiml.play("YOUR FILE"); // Put your asset URL in this between the quote marks
  twiml.record({
    timeout: 10, // The number of seconds of silence to wait before hanging up
    transcribe: false, // Change this to true if you want Twilio to try to transcribe your recordings ($)
    maxLength: 300, // This is the maximum length that the audio recording can be.
    playBeep: true, // This tells the function to play a bleep after your message or not.
  });
  twiml.hangup();
  callback(null, twiml);
};
  1. Hit save! Hopefully there are no issues. Now we need to make it so when someone calls your number, this code is run. So go back to the programmable voice menu for your phone number.
  2. From here, scroll down to the Voice & Fax options. Select Accept Incoming and check it's set only to Voice Calls. Then where it reads A call comes in change the first option in the drop down menu to Function, and now in the Service menu that appears to the right, select default, and from the Function path menu, your path.
  3. Everything's set! Call your number and check that it's all working. You can find recordings in the Calls log->Incoming menu of your phone number.

If you have questions, or can't get it working, give me a tweet and I'll see if I can help you out.

Be aware!

It is possible for a hostile actor to attack you by repeatedly calling your number and leaving long messages. Though they will not be able to block legitimate contributors, they can cost you money, and they can cost you time in sifting through the results.

It is also possible for your fun experiment to turn into $1 a month forever unless you turn off your phone number at the end of the project. Make sure to remove any reference to the phone number from your reporting at this point, as otherwise it is possible for another actor to potentially take over the number.