Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free

Code, Tutorials and Hacks

  • By Joe Block
    How to Receive Alerts from Home Assistant with Twilio SMS header - How to Receive Alerts from Home Assistant with Twilio SMS


    Home Assistant is an open source home automation system that allows you to control Internet of Things devices like smart bulbs, smart switches and sensors. In this article, I’ll show you how to use Twilio SMS to have your Home Assistant (HA) alert you via SMS when it detects problems in your home.


    To follow along with this post, you’ll need:

    • A Twilio account - if you don’t already have one, sign up for a free Twilio trial account that you’ll use later to test the notification system we’ll be setting up.
    • A working Home Assistant installation, with some sensors connected to it. I used a Zigbee water sensor (an Aqara Water Leak Sensor, specifically) for this tutorial but any sensor that you have connected to your Home Assistant will also work - you could also use a garage door sensor and get alerted when the garage …
    Read More
  • By Valeriane Venance
    Coding a Rails lookup SMS app for my grandparents Coding a Rails lookup SMS app for my grandparents

    #GiftOfCode is almost over but it’s never too late to participate!

    You don’t have to create a heavy app with 2K handwritten lines of code to make someone happy and I’m gonna prove it to you now with a small SMS service for my grandparents.

    My grandparents often have phone calls from numbers they don’t know and they often call back in the case one of the family members would have changed their phone number and not told them. But sometimes they end up paying extra fees for that.

    My SMS service will use lookup functionality from Twilio with the Ekata Reverse Phone add-on to tell them if calling back a specific number may endup in extra billing.

    Warning before we go: you can follow this tutorial from anywhere in the world but the Ekata Reverse Phone functionality will work as expected only in the U.S.


    To …

    Read More
  • By Tammy Ben-David
    Integrate a Wix Answers Knowledge Base into Flex wix-answers-kb.png

    Knowledge bases are what drive collaboration and connection in an organization. Enabling your agents to access information efficiently should be a key goal for any company. This series of blog posts aims to help you set up a knowledge base with search and automatic agent assistance within Flex by integrating Wix Answers.

    We'll set up a Wix Answers integration in three steps:

    1. First, in this post we will set up a manual knowledge base search of your Wix Answers knowledgebase within the Flex single page UI.
    2. After that, we will use media streams to fork the audio stream in real time to Google’s Speech to Text API, this will provide us with a real time transcription of the call.
    3. Finally, we will put both these things together to pick out keywords from the conversation and search for them in our integrated knowledge base.


    Before we begin you’ll need:

    • A …
    Read More
  • By Sam Agnew
    Creating a GPT-3 Twitch Chatbot with Node.js Copy of Generic Blog Header 4(4).png

    A mainstay of many popular channels that stream on Twitch.tv is having a bot to engage with viewers in chat to automate things such as tasks for moderators or sharing contextual information with newcomers. OpenAI's API for their new GPT-3 model provides a very versatile, general-purpose “text in, text out” interface, making it applicable to virtually any language task.

    Naturally, this seems like a match made in heaven. So let's walk through how to unleash the powers of GPT-3 with Twitch chat bots on your own channel using Node.js.

    Taking care of dependencies

    Before writing any code, you will need an up to date version of Node.js and npm installed.

    Navigate to the directory where you want this code to live and run the following command in your terminal to create a package for this project:

    npm init --yes

    The --yes argument runs through all of the prompts that you …

    Read More
  • By Liz Moy
    Building a Netflix Recommendation SMS Bot with Python and Twilio Autopilot for #GiftofCode Build a Netflix Bot with Python and Autopilot

    Photo from freestocks.org used under Creative Commons Zero

    For #GiftofCode this year I wanted to build something useful for my family. One fun conversation topic that’s kept us close is what we are watching on Netflix and other streaming platforms.

    While the in-app experiences of most major streaming apps give recommendations aplenty, making a recommendation bot that someone could text sounded like a fun thing to try.

    I had a few requirements in mind for this one:

    • Power the bot using Twilio Autopilot
    • Ask the texter for the type of media they want to watch and which genre
    • Use the Netflix “Viewing Activity” data to determine shows and movies my family has already watched
    • Use a publicly available API in case other folks want to build their own

    There are some useful streaming metadata APIs available. A robust paid option that I tried out was Reelgood. I ended up …

    Read More
  • By Diane Phan
    No Hassle, No Stress, Go Serverless! Backend Development Explained for Beginners! header - No Hassle, No Stress, Go Serverless! Backend Development Explained for Beginners!

    So you're new to backend development. You set up the Twilio video and have a sweet web page to host the video on with cute overlays, but how can you start using this with friends and making this official?

    For some developers, the idea of building a backend server might seem daunting especially because there are so many tools to use and different methods of deployment. I get it - it seems a bit overwhelming.

    Fortunately, Twilio has a Serverless Toolkit to save the day! In this article, we'll walk you through the wonders of Twilio's Serverless Toolkit so that you can deploy your awesome JavaScript Twilio Video project with no hassle and no stress.

    Tutorial Requirements

    Read More
  • By Charlie Weems
    Send COVID-19 Vaccine Appointment Reminders with Salesforce Flow and Twilio 1.png

    With countries around the world beginning to approve COVID-19 vaccines for public use, we've seen a lot of interest in implementing vaccine notifications and appointment reminders. This tutorial will show you how to set up Twilio SMS notifications with Salesforce’s Automation Flow Builder so that you can remind people to sign up to get both parts 1 and 2 of the vaccine.

    Let’s look at a user journey that we might want to support as a local public health authority. We’ll have patients sign up via a web-to-lead form to be put into our contact database. We might also receive data from health providers.

    Vaccine solution diagram

    For this tutorial, we’re going to focus on the second half of the workflow above: sending SMS reminders. If you’re interested in sending one-off SMS broadcasts, check out our documentation on using the Twilio for Salesforce Campaign Component.

    Once we’re ready to begin vaccine distribution, we’ll …

    Read More
  • By Nicolas Grenié
    Offer a Unique Gift for Christmas with Typeform, Glitch, JavaScript, and Twilio SMS API header - Offer a Unique Gift for Christmas with Typeform, Glitch, JavaScript, and Twilio SMS API

    Now is the time of year where everything around us turns into red and green sparkles meaning the Holiday Season has officially started! This also means that you only have a few remaining days to figure out what to give to your loved ones. If you are like me, this is usually a stressful last-minute rush fueled by adrenaline. Perhap this year, technology can give you a hand to make things a bit more fun and original.

    Using Javascript, Typeform, Glitch, and Twilio Programmable SMS API, you will be able to build a unique gifting experience! No need to get in line at the store; it’s (almost) all digital!

    Tutorial Requirements

    Read More
  • By David Worley
    Twilio Flex: Personalize with Plugins and Integrations Flex Plugins & Integrations

    Why conform to the norm when you can build? That question applies to so many aspects of life – even in the contact center industry.

    We have all seen or experienced the packaged contact center solution. The one that has all the bells and whistles that are seldomly used forcing you to “live with” the existing technology that does not adapt to your business rules, preferred channels, and ability to control your engagement experience. 

    How can businesses not only keep up, but leverage new technologies, channels, and ways of working? The answer is Programmability. This is where Twilio shines. In this blog post, we will talk about how to leverage Twilio Flex plugins and integrations to 3rd party solutions. I’ll show you how to program your contact center around your unique business flows and rules without waiting on a vendor to release the next version.

    Flex Plugins

    What do …

    Read More
  • By Miguel Grinberg
    Server Push in 5 Easy Steps with Flask, React and Twilio Sync Server Push in 5 Easy Steps with Flask, React and Twilio Sync

    When considering a server push solution for your web application, you will likely evaluate WebSocket, HTTP long-polling, Server-Sent Events and maybe even Socket.IO. In this tutorial I want to introduce you to yet another option that you may not know: Twilio Sync. Sync is a cloud synchronization service that works across browsers and mobile devices and that it is incredibly easy to integrate with your application.

    To learn how Twilio Sync works, we are going to add server push capability to a small web application that has a React front end and a Python and Flask back end. We’ll get the job done in just five easy steps!

    server push demo

    Note that “server push” in this context refers to technologies that allow web servers to initiate an exchange with clients and “push” events, notifications or data to them. Do not confuse this with “HTTP/2 Server Push”, which is …

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