Building a Rejection Hotline with Twilio for Peach PRC

Stop Calling Me, Josh

Lee Martin
4 min readMar 14, 2021
Peach PRC, ready to reject your call

Peach PRC has a new single out titled “JOSH” in which she explains to Josh that she isn’t interested and he should stop calling her.

“Fuck off, stop calling me, Josh.”

Turning someone down can be tough, so as a service to her fans, Peach PRC has launched a Rejection Hotline. The hotline comes in the form of a number +136133 3227 (+61480032387 in AU) which users can pass to their own Josh in substitution of their own number. When someone dials this number, they will hear a random voicemail recorded by Peach PRC, rejecting them. Then, the caller will receive an SMS linking them back to the companion web app which includes a ticker of all rejections and a link to listen to the track and watch the music video.

This experience is powered by Twilio which has been a favorite platform of mine for many years and many projects. I’ve said it all before but a little Twilio telephony magic goes a long way in creating an intimate marketing campaign. Try the number to reject yourself and read on to learn how this came together.

Playing Back Voicemails

Playing back a random voicemail using Twilio simply requires returning the appropriate TwiML. You can do this using whatever technology you’re comfortable with or write a function directly in Twilio.

I setup a simple Serverless stack for this project since I knew I would be using DynamoDB and S3 for the call counter. So, using a bit of Node.js and the official Twilio node package, we can return the TwiML required to playback a Math.random() voicemail using the <Play> verb.

const VoiceResponse = require('twilio').twiml.VoiceResponsemodule.exports.rejection = async (event) => {
const twiml = new VoiceResponse()
let i = Math.floor(Math.random() * 4 + 1)) // random 1-4 twiml.play({}, `recording-${i}.wav`) return {
statusCode: 200,
headers: {
'Content-Type': 'application/xml'
},
body: twiml.toString()
}
}

Even though I could have dropped our audio files on the stack’s S3, I chose to instead host them on the client’s Twilio account using Twilio assets. I love all of these genius Twilio vertical integrations.

Sending SMS

In the same function as our TwiML response, we can call another function which will send an SMS to the caller. Using the same node library we used to create a VoiceResponse, we can authenticate our Twilio account and create a new SMS messages. Let’s create a Promise function to handle that.

const sendSMS = (caller, twilioNumber) => {
const client = require('twilio')(ACCOUNT_SID, AUTH_TOKEN)
return new Promise((resolve, revoke) => {
client.messages.create({
body: 'Thank you for using the hotline. 💖',
from: twilioNumber,
to: caller
})
.then(resolve)
.catch(error => {
console.log(error)
resolve()
})
})
}

Note: I am resolving the function even if an error is thrown. This was my hasty solution to make sure the rejection call TwiML was returned even if the SMS message sending failed. Twilio has since told me about the Lookup API which should help debug potential issues before sending.

Anyway, back on the original Lambda function, we should parse the Lambda event to get the number which was called (our Twilio number) and the number of the caller for use with our new SMS function.

module.exports.rejection = async (event) => {
let { queryStringParameters: {
Called: called,
Caller: caller
} } = event
await sendSMS(caller, called)
}

Counting Calls

Rejections Counter

To count the calls, I’m using a simplified version of the technique I used on the Guns N Roses YouTube plays counter. I’ve setup a DynamoDB with a single record I can increment each time a call comes in.

const params = {
TableName: 'peach-rejections',
Key: {
numberId: 'dev'
},
UpdateExpression: "SET rejections = rejections + :val",
ExpressionAttributeValues: {
":val": 1
},
ReturnValues: "ALL_NEW"
}
await dynamoDb.update(params).promise()

Then, similar to the GNR campaign, I’ve chosen to occasionally write the current count to a file on S3. This file is read from the web app every 30 seconds and the counter is updated accordingly. Check out the GNR case study for more info, including how the counter is animated using anime.js.

Rollout

“JOSH” Music Video

Planning an awesome rollout for the campaigns I build is typically a luxury since I’m personally developing and designing them until the last minute. The bulk of that work falls on the digital marketing team or manager who hired me to begin with. (I’m not crazy about it nor do I think it is very professional but it is often the reality.) However, I’ve been lucky to be paired up with some of the best digital marketers in the business and Sarah Gaupel and her team at Republic Records did an incredible job with this one.

First, she and her team commissioned an infomercial to be created. This informercial was screened on loop for several minutes ahead of the YouTube video premiere for “JOSH.” In addition, they added the phone number to the official music video, further expanding the reach and possibilities of our campaign. Pair this with all the technical work that had to be done to get our numbers setup and you’ve got one hell of an effort.

Thanks

Thanks to Sarah Gaupel and Republic Records for bringing me in on this one. It all came together very quickly thanks to an awesome group effort. Thanks to Megan Speir at Twilio for helping iron out a few issues we were facing. And thanks to Peach PRC for being so onboard with the concept, providing voicemails and integrating the number into her music video. I quite liked seeing her own reaction to the campaign in the YouTube video premiere chat.

“omg does it show how many people called??? hahahaha i love this”

Stream “JOSH” today and check out the new music video.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Written by Lee Martin

Netmaker. Playing the Internet in your favorite band for two decades. Previously Silva Artist Management, SoundCloud, and Songkick.

No responses yet

Write a response