Build the future of communications.
Start Building for Free

Python posts

  • By Nicolas Vautier
    Build an SMS Proxy that Redacts PII from Conversation Threads Using Twilio SMS, Pangea Redact Service, and Python Build an SMS Proxy that Redacts PII from Conversations Using Twilio SMS, Pangea Redact Service, and Python

    It is better to give than to receive — the seemingly universal proverb does not apply to your personal data. In the information era of the internet, fueled by how much information companies can acquire about their customers, giving them the ability to regulate unintentional data leaks in digital communications can be a gift that both delights your customers and gains their trust. In this post, you will learn how to redact sensitive or personal information unintentionally sent through Twilio-powered SMS conversations using Pangea’s Redact service.

    By the end of the tutorial you’ll have:

    • Set up a free Pangea account and Access Token for interacting with the Redact Service
    • Set up a Django and Python application that utilizes the Twilio SMS and Pangea SDKs to redact sensitive information
    • Run the application locally on your workstation
    • Configured Twilio webhooks to invoke your app using ngrok

    If you’d like to try …

    Read More
  • By Miguel Grinberg
    Access a Presto Database with Python and SQLAlchemy Access a Presto Database with Python and SQLAlchemy

    At Twilio, I maintain a blog dashboard that allows my colleagues and I to perform analysis on traffic, conversions, and other metrics for articles published on this blog. I have written in the past about some of the database benchmarking techniques I’ve implemented for this project, and this generated interesting discussions on Hacker News. Today I will be discussing a topic that is a lot less controversial.

    The charts and reports generated by this dashboard combine data from several sources that include web traffic, blog article metadata, and user information. The latter comes from a large internal company database hosted in a Presto cluster.

    Presto is an open-source distributed query engine for big data created by Facebook. It allows users to query many different data sources, such as Hadoop, Kafka, MySQL, MongoDB, and many more using its own SQL implementation. This effectively abstracts the developer from query language differences among …

    Read More
  • By Aina Rakotoson
    How I Built a Way for My Mum to Talk to Her Children Using Twilio Voice Conference How I Built a Way for My Mum to Talk to Her Children Using Twilio Voice Conference

    It is crucial for my mum to talk to her children every day. She loves talking with us, even if it’s just to listen to our voices.

    Now that we are grown up, and we don’t live in the same house anymore, she continues her ritual. She takes time every evening to call us one by one with her phone. Sometimes it’s not easy for her, but she never misses a single day without doing it.

    One day I asked her why she didn’t call us in a group like on Facebook or Zoom. She answered that it would take time for her to configure the internet, login into her account, etc. Then I started to imagine a way for her to reach all of her children with a single phone call.

    If you face the same problem as my mum, or you just want to call multiple people with …

    Read More
  • By Nick Piegari
    How to Build ADHD Lifehack Tools with Python, Google Sheets, and Twilio SMS How to Build ADHD Lifehack Tools with Python, Google Sheets, and Twilio SMS

    I can say from experience that ADHD adds several layers of complexity to life on an already chaotic and distracting planet, and while we need all the help we can get, it’s often difficult to find tools that you stay in the habit of using and that actually help.

    By building your own, not only will you be able to have a tool built custom for your brain, but the satisfaction of building something may encourage you to keep using and optimizing it!

    In this tutorial, we'll be building three helpful tools:

    • An SMS task-inbox-and-notetaking app
    • A die roll app for moments of indecision
    • A timer that texts you when time is up

    The theme of the project examples in this post are all about getting things out of your head, and getting yourself out of your own head, two very common challenges for ADHD brains.

    How will these apps …

    Read More
  • By Miguel Grinberg
    Send Emails with Embedded GIFs and Images with SendGrid and Python Send Emails with Embedded GIFs and Images with SendGrid and Python

    A common use case when sending emails is to add images to them. You may want to include your company logo as a heading, or maybe make a point in a way that can only be done with a GIF meme. But if you search how to do this you will find that there isn’t clear and concise information out there. In this article I’m going to show you what your options are if you want to include images or GIFs in your emails when using SendGrid with Python.

    Requirements

    To work on this tutorial you will need the following items:

    • Python 3.6 or newer. If your operating system does not provide a Python interpreter, you can go to python.org to download an installer.
    • A SendGrid account. If you are new to SendGrid, click here to create a free account. A free SendGrid account allows you to send up …
    Read More
  • By Dotun Jolaoso
    How to Trigger a GitHub Actions Workflow Using Twilio SMS How to Trigger a GitHub Actions Workflow Using Twilio SMS

    GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate building, testing, and deploying your software projects. In this tutorial, we’ll be looking at how to conditionally trigger a GitHub Action workflow using Twilio’s Programmable SMS.

    This is useful for situations where you want to trigger a build or deployment pipeline manually. In this case, all you need to do is send an SMS to your Twilio phone number.

    Technical requirements

    To follow along, you’ll need the following:

    • A free Twilio account
    • Python Development Environment
    • Ngrok. This will make the development version of our application accessible over the Internet.
    • A GitHub account

    Creating a Python environment

    Let’s create a directory where our project will reside. From the terminal, run the following command:

    $ mkdir twilio_github_actions
    

    Next, cd into the project directory and run the following command to create a virtual environment.

    $ python …
    Read More
  • By Aina Rakotoson
    How to Control Home Assistant on Your Raspberry Pi with Twilio SMS How to Control Home Assistant on Your Raspberry Pi with Twilio SMS

    The tutorial How to Control Your Raspberry Pi with Twilio SMS shows that it is possible to remotely control your Raspberry Pi with SMS.

    This is done by using an SMS message as a set of commands defined by a protocol.

    Everything we want to control on the Raspberry Pi is a controlled object, and it is associated with a GPIO pin.

    What if we can do better?

    What if we can control more than a simple device connected to a GPIO?

    What if we can control a home automation system with SMS?

    In this tutorial, you will learn how you can control your Home Assistant on your Raspberry Pi with Twilio Programmable SMS. But first, let’s explore what Home Assistant is.

    What is Home Assistant?

    Home Assistant is an open-source home automation tool that allows you to control many electronic devices with a single web interface.

    It was created …

    Read More
  • By Ezzeddin Abdullah
    How to Build an Inventory Chatbot on WhatsApp with FastAPI How to Build an Inventory Chatbot on WhatsApp with FastAPI

    Owning an inventory is a big deal only if you're able to manage it efficiently.

    You can manage it on your own but you'll lose a lot of your time keeping track of products there. Or you can hire someone else to work but they might not be honest enough.

    Today, you're going to learn how to manage your products in the inventory with a WhatsApp chatbot. With this chatbot, you'll retain your time and get a reliable result. This chatbot will help you engage with clients ordering your products and will tell them exactly about the status of the product — if it's there in the inventory or not.

    In this tutorial, you will build this service using FastAPI, Twilio's WhatsApp messaging API, Pyngrok, and SQLAlchemy.

    You'll use Twilio's API to access the WhatsApp messaging product to let the clients send messages via WhatsApp and start …

    Read More
  • By Aina Rakotoson
    How to Control Your Raspberry Pi with Twilio SMS How to Control Your Raspberry Pi with Twilio SMS

    Did you know that you can remotely control your Raspberry Pi with an SMS?

    Yes, you read it right: “you can remotely control your Raspberry Pi with SMS”.

    It has always been entertaining to control a device with SMS. Not only is it really cool, but it can be very useful in many situations.

    By using Twilio Programmable SMS coupled with a Python program, you can achieve this goal.

    In this tutorial, you will discover how it is possible to control your Raspberry Pi with SMS, how to design such a system, and finally, with a practical example, you can learn how to control light by SMS.

    How is it possible?

    When you receive an SMS on your phone, you get a notification: a popup message, a sound, etc. This notification is driven by the event “received SMS”. In the programming world, the notification is a callback for a specific …

    Read More
  • By Neil Ruaro
    How to Create a CLI App for Sending Text Messages Using Twilio SMS and Python How to Create a CLI App for Sending Text Messages Using Twilio SMS and Python

    Texting is one of the most common forms of communication in our modern age. Twilio provides a simple and easy-to-use interface for sending SMS text messages through their SMS API.

    In this tutorial, you'll be using the Twilio SMS API to create your very own CLI texting application using Python and the Typer framework.

    If you're unfamiliar, Typer is a Python library for creating CLI applications. Typer is easy to use, and intuitive to write. It borrows these features from its sister, the FastAPI framework, written by the same author.

    Prerequisites

    In order to complete this tutorial, you will need the following:

    Install Twilio CLI, and setup …

    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.