Saravanan Manoharan

Feb 13, 2021

3 min read

Fake call using Twilio API

Stuck in the middle of a boring conversation? Want to fake a call to escape the situation? Here’s Twilio to rescue!

You can do this in just 10 steps!

  1. First things first, you need to signup for Twilio.
  2. Make sure you verify your phone number. With the free tier, you can message or call only your verified phone number. For other phone numbers, you need to upgrade your account.
  3. Then you need to get your free Twilio phone number.
  4. After getting your Twilio phone number, your console will look similar to this:

Before moving to the next steps, here’s how Twilio works:

When someone sends a text message to your Twilio number, Twilio can call a webhook that you create using Python from which you can send a reply back using TwiML.

5. So, we need to create a webhook right now. This is fairly simple. I have used Python flask library to create my webhook and AWS to host it (you can use any medium to host it).

Here is my code. You can find the same in my repository too.

In order to host this on AWS, do check out my article here: https://medium.com/dev-genius/host-your-python-flask-on-aws-ec2-91735aa7127a

6. You can push this code onto the EC2 instance and can run it from there.

7. After running your code on EC2, your webhook will be on your EC2 Public IPv4 DNS port 5000.
Eg: http://ec2-3-87-112-121.compute-1.amazonaws.com:5000/sms

Note: Your IPv4 will be different. /sms is the flask end point.

8. So, now back to the Twilio account. Add this webhook link to your Twilio Phone number.

9. Go to https://www.twilio.com/console/phone-numbers/incoming and click on your number. Change the default Webhook under Messaging from https://demo.twilio.com/welcome/sms/ to python webhook your created (point 7).

10. Once, this is done. Text to your Twilio phone number with the words “Fake call” and see the magic ;)

“Woah! Someone is calling. I got to take this. Catch you later” :P