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 Phil Nash
    Build a WhatsApp chatbot with Ruby, Sinatra and Twilio Build a WhatsApp chatbot with Ruby, Sinatra and Twilio

    Chatbots are programs that communicate some way with humans. They can be very basic, responding to keywords or phrases, or use something like Twilio Autopilot to take advantage of natural language understanding (NLU) to provide a richer experience and build out more complicated conversations.

    In this tutorial we are going to see how easy it is to get started building chatbots for WhatsApp using the Twilio API for WhatsApp and the Ruby web framework Sinatra. Here's an example of the conversation we're going to build:

    Using the bot inside the WhatsApp application. First we ask for cats and get a cat picture and fact. Then we ask for dogs and get a dog picture and fact. Finally we ask the bot if it can do anything else and it says it only knows about dogs and cats.

    What you'll need

    To build your own WhatsApp bot along with this tutorial, you will need the following:

    Configure …

    Read More
  • By Haki Benita
    Building an Interactive Voice Response (IVR) System with Python, Django and Twilio Building an Interactive Voice Response (IVR) System with Python, Django and Twilio

    IVR stands for Interactive Voice Response system. It's a way for you to communicate with your users over the phone. IVR is operated by voice and by the DTMF tones that phones produce when pressing keys on the keypad.

    Just like your web site, mobile app or chatbot, IVR is another way for you to interact with your users. IVR holds a unique set of features that makes it ideal under some circumstances:

    • Visual impairments: Users that rely on screen readers to navigate websites and mobile apps are used to interact with voice based interfaces.
    • No Internet access: Users in remote areas or in places where an Internet connection is not constantly available or very expensive.
    • Technologically challenged: Users that have trouble dealing with websites and apps, like the elderly, often find IVR much easier to operate.
    • No access to smartphones or a computer: Users that …
    Read More
  • By Michael Jaroya
    Build a Currency Conversion SMS chatbot using Twilio Autopilot, Exchangerates API, and PHP Build a Currency Conversion SMS chatbot using Twilio Autopilot, Exchangerates API, and PHP

    The mobile penetration rate in the world is currently estimated at 4.68 billion mobile phone users and according to a report by Statista, the number is projected to increase even further in 2020. This increase coupled with other factors, such as the advancement of Artificial intelligence, particularly Machine learning, and the underlying technologies such as natural language processing, has made chatbots become very popular and necessary.

    What is a chatbot and why is it important?

    A chatbot is a software or program that is designed to simulate conversation or chat with human users through text messages, virtual platforms integrated into websites, applications, and instant messengers.

    Chatbots help to streamline and automate customer support by getting rid of tedious tasks, thereby enhancing customer experience. They also give companies room to implement new marketing ideas that can improve customer conversion rates.

    In this tutorial, we are going to learn first hand …

    Read More
  • By Chimezie Enyinnaya
    Add Media Uploads to a Laravel Vue.js Chat App Using Twilio Programmable Chat Add Media Uploads to a Laravel-Vue.js Chat App

    In my last tutorial, I showed you how to add chat to a Laravel app using Twilio Chat. In this tutorial, I’ll be showing you how to enhance the app by adding media support to it using Twilio Programmable Chat. That is, allowing users to send media files as message.


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

    Getting Twilio Credentials

    Login to your Twilio dashboard and copy both your ACCOUNT SID and AUTH TOKEN.

    Twilio Account Credentials

    Before you can start using the Twilio Programmable Chat, you need to first create a chat service:

    Twilio Programmable Chat Dashboard

    Take note of your SERVICE SID.

    Twilio Programmable Chat Configuration

    Lastly, you need to create an API key:

    Twilio New API Key

    Also, take note of both your API SECRET and API SID.

    Getting Started

    To make …

    Read More
  • By Michael Okoko
    Send PDF Invoices via WhatsApp using Laravel, PHP, Stripe, and the Twilio API for WhatsApp Generate and Send PDF Invoices via WhatsApp using Laravel, PHP, Stripe, and the Twilio API for WhatsApp

    Stripe is a payment gateway that provides developer APIs to help you receive payments from your application/website.

    The Twilio API for WhatsApp provides a platform that helps you send any type of business message via WhatsApp through a streamlined API.

    In this tutorial, we will be exploring how to send payment invoices and notifications to our users via WhatsApp when they make payments on our website.


    To follow along with this post, you will need the following:

    Getting Started

    To get started, create a new Laravel application and assign the folder name.

    $ laravel new twilio-commerce && cd twilio-commerce

    Next, install our application dependencies using composer. These dependencies include the Twilio SDK and the Stripe PHP library (to …

    Read More
  • By Phil Nash
    Speech to text in the browser with the Web Speech API Speech to text in the browser with the Web Speech API

    The Web Speech API has two functions, speech synthesis, otherwise known as text to speech, and speech recognition, or speech to text. We previously investigated text to speech so let's take a look at how browsers handle recognising and transcribing speech with the SpeechRecognition API.

    Being able to take voice commands from users means you can create more immersive interfaces and users like using their voice. In 2018, Google reported that 27% of the global online population is using voice search on mobile. With speech recognition in the browser you can enable users to speak to your site across everything from a voice search to creating an interactive bot as part of the application.

    Let's see how the API works and what we can build with it.

    What you'll need

    We're going to build an example app to experience the API, if you want to build along …

    Read More
  • By Dotun Jolaso
    Build a Laravel PHP Package that Seeds the Database with Fake Data How to Build a Laravel PHP Package that Seeds Fake Data

    Packages primarily provide a way to add functionality to your Laravel applications and can serve as a great way of decoupling your application. The great thing about building packages is that they can easily be reused. In this tutorial, we’ll be looking at how to get started with building a Laravel package. We’ll be building a package that allows you to generate random fake data specifically in the first names, last names and email fields for a user; a simpler version of the popular Faker PHP Library. Interestingly, down the line we will make use of the same Faker Library to generate seed data.

    Technical Requirements

    To follow along, you’ll need the following:

    • PHP Development Environment
    • Composer globally installed

    Setting up a New Package

    To get started setting up a new Laravel package, we’ll be using Composer. From the terminal, cd into your project’s directory and run the following …

    Read More
  • By Kyle Lawlor-Bagcal
    Running a Mailing List with Google Sheets, Twilio SendGrid and Python Running a Mailing List with Google Sheets, Twilio SendGrid and Python

    A mailing list is a great way to share information with a group of people. Google Forms provides the tools needed to handle subscriptions to a mailing list. In this tutorial we will build a Google Form that is backed by a Google Spreadsheet. The spreadsheet will be used as a storage mechanism for a list of subscribers. Then we will create a Python script that reads the spreadsheet and finally we will use the Twilio SendGrid Python client to send emails to all subscribers.

    Tutorial Requirements

    Working through this tutorial will require access to 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 Google account.
    • A Twilio SendGrid account. A free SendGrid account allows you to send up to 100 emails per day forever. Sign-up here.

    Create a Python …

    Read More
  • By Alex Baban
    Using the Twilio Node.js Helper Library with AWS Lambda Layers Using the Twilio Node.js Helper Library with AWS Lambda Layers

    AWS Lambda is a serverless computing platform that enables you to run programs in response to events without having to configure and administer servers. The code that runs on AWS Lambda in response to an event is called a Lambda function.

    With AWS Lambda Layers you can separate your function code from its dependencies so you won't have to upload them on every change of your code. A Lambda Layer is a ZIP archive that contains libraries, a custom runtime, or other dependencies. With Layers, you can use libraries without needing to include them in your deployment package. You can share layers across multiple Lambda functions, and moving runtime dependencies into layers can drastically reduce the size of your deployment package.

    The Twilio Node Helper Library lets you write Node.js code to make HTTP requests to the Twilio API. Including the Twilio Node Helper Library in the code you deploy …

    Read More
  • By Miguel Grinberg
    SMS Doorbell with MicroPython and Twilio SMS Doorbell with MicroPython and Twilio

    The Internet of Things (IoT) has the potential to touch not only every industry, but also most everyday aspects of our lives. As a software developer, I’m excited about how low the barrier of entry is considering the low cost of IoT hardware and the wide availability of development tools in the open-source ecosystem.

    In this article, I want to show you how to build an IoT doorbell that sends you an SMS instead of producing sound. This project should give you a good idea of the kinds of projects you can build on your own with cheap microcontroller hardware using MicroPython and the same Twilio APIs that many users know and love.

    The project that we are going to build is an SMS doorbell using an ESP8266 microcontroller, a push button, MicroPython, and Twilio’s Programmable SMS service.

    Building an SMS Doorbell

    This is the perfect project if you are …

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