How To Send A Prank Text Message with Node.js and Twilio API

Have you ever wondered how to send a prank text message to your friends, family, or even yourself?  It’s easier than you think! It only requires rudimentary programming skills and a quick Twilio account registration to get started.

In this tutorial, I will show you how to leverage the Twilio API and Node.js to send SMS and MMS messages to yourself, and maybe some of your fun-loving friends!

READ THIS BEFORE YOU BEGIN!!!

Disclaimer #1: This tutorial will teach you how to send a SMS or MMS message from a phone number registered with Twilio to any U.S.-based phone number capable of receiving these messages. You should send these messages to a mobile phone that you own, preferably one with an unlimited data plan.  Twilio has a trial account that will grant you limited access and abilities.  If you decide to get crazy and run up your phone bill, that is solely your responsibility.  If you decide to upgrade your Twilio plan to a paid account, you are solely responsible for the costs that will be incurred on your account. Twilio’s SMS and MMS messaging services are inexpensive, but each message does cost money.

Disclaimer #2: The phone number that Twilio provides to you is traceable, and every message that you send through the Twilio API is archived.  I do not condone, advocate, or support harassment of any person, company,  or entity that you wish to target.  If you decide to send SMS or MMS messages to anyone other than yourself, you may incur the wrath of your country’s legal system.  Do not send any messages or media that may be offensive or illegal.  You have been warned.

tl;dr – Don’t be evil.

NOTE: I have included links at the bottom of this tutorial to help victims of SMS/MMS harassment stop the abuse.  Please take the above warnings seriously, or suffer the consequences…

On a lighter note…

Hopefully, the amount of technical competence and the Twilio account setup will deter those who wish to use this knowledge and software for evil.  There is a lot of good that can come from studying the techniques that you will learn in this tutorial.  Learning how to use the Twilio API can also be a great bullet point (Expert Twilio API development ) for a software developer’s resume.

Feel free to browse the code repository hosted on Bitbucket for educational purposes.  Twilio also provides some excellent documentation, tutorials, and quickstart guides to help you build a variety of software applications.  This tutorial is only the tip of the iceberg of what the Twilio API is capable of achieving, and I highly encourage that you explore the API.  I will be posting more advanced Twilio API tutorials to this site, stay tuned!

Getting Started

Node.js

Make sure that you have the latest Node.js software installed on your computer.  Visit their site to download and install the proper version for your operating system.  In this tutorial, I will be using Mac OS X on my Mac Book Pro.  Installation on Windows and Linux is also fairly straightforward, seek guidance on the Node.js website.

Git

Download and install Git if you don’t already have it installed on your computer.  This should already be installed on your system if you are a serious software developer.  You will use Git to download the source code we will need to launch our app.

Twilio

Also make sure that you have signed up for a Twilio account.  Trial accounts are free, although the real fun begins when you upgrade your membership and fill your account with some cash.  $20 is enough to experiment with all of the cool features of Twilio.  You will need to purchase an SMS-capable phone number (FYI this cost me $1.00).

Once your account is upgraded, you will also need to find your Account SID and Account Token located in your Twilio Console.  Make sure to save these to a text file, we will be using these once we have the source code.

Sample App on BitBucket

For your convenience, I have created a very simple sample app that I have hosted on a public BitBucket repository.  Open a command line terminal, navigate to a place where you normally store your code projects, and issue the following command:

git clone https://bitbucket.org/ssenkus/nodejs-twilio-send-prank-sms.git

Change directories into our newly downloaded repository:

cd nodejs-twilio-send-prank-sms

Next, install the project dependencies listed in the package.json file using npm:

npm install

Let’s edit the config file to enter our Twilio API credentials and phone number for our account, located in config/config.json:

Sending the prank text message

Now that we have all of the code we need to run the project and our personal account information entered, let’s fire it up by running this command:

node app.js

The Node.js program will prompt for the target’s phone number, the body of the SMS text message that you want to send.

An optional image URL prompt will follow.  If you do not wish to send an image along with the text message, hit ENTER to skip this:


However, if you have an image or media file that you would like to send to your target mobile phone, type or paste in the full URL and hit ENTER.  This media file should be publicly accessible on the Internet:


Once all of this information has been entered, you will be greeted with confirmation message that your SMS or MMS has been sent.

Bask in your success, you’ve just sent your first prank text message!

 

Conclusion

Thanks for following along with this tutorial on how to send a prank text.  I hope you have learned something and had some fun messing with your mobile phone.  In the future, I will post some more articles dealing with advanced concepts of the Twilio API.

References/Further reading: