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 Liz Moy
    Build a Book Recommendation SMS Bot Build a book recommendation bot with Programmable SMS

    On June 14, publisher Amistad Books launched an initiative to encourage people to purchase any two books by Black writers between June 13th – June 20th.

    In addition, artists such as Noname have launched book clubs and dialogue to support Black voices in written works from anti-racist texts, to poetry, to science fiction and fantasy.

    To help folks decide on something to read, I built a simple book recommendation bot using Programmable SMS with Python and Airtable to store the book data. The result is a guided conversation that allows the texter to choose a genre they want to read, and responds with a title of a book and a link to a Black-owned bookstore in the U.S. that has the book for sale, either in print,e-book, or audio book.

    Try it by sending a text to (409) 404-0403. You can also see the Python code below and …

    Read More
  • By Daizen Ikehara
    Twilio StudioフローとNode.jsを用いて外部にメッセージを発信する方法 Twilio Studio REST API Trigger

    Twilio Studioは電話着信や、SMSの受信に対する処理(フロー)を設定できるビジュアルデザインツールです。このツールを用いることでプログラミングの知識を必要とせずにフローの設定を行えます。

    多くの場合、電話着信・SMS受信に用いられますが、別のシステム(Webなど)で入力した予約の確認や、宅配便の再配達の案内など、決まったテンプレートをもとに外部に発信を行う場合にも利用することができます。今回はTwilio Studioで設定したフローを用いて宅配の再配達依頼の確認メッセージを発信する方法をご紹介します。

    前提条件

    また、今回作成するサンプルはあらかじめ下記の情報をユーザーが提供していることを想定しています。

    • 連絡可能(SMSが受信可能)な電話番号
    • 再配達の日時(yyyy/MM/dd hh:mm:ss)

    Twilio Studioフローのインポート

    TwilioコンソールからStudioダッシュボードを開きます。これまでにStudioフローを作成したことがない場合は下記のスクリーンショットに表示されている赤色の Create a flow ボタンをクリックし、新しいFlowの作成を開始します。

    Studio Dashboard

    フローをこれまでに作成している場合は、既存のフローの一覧画面に表示されている新規追加ボタン(赤丸に白十字が表記されているもの)をクリックします。

    Studio - Add New Flow

    Flowの名前は Confirmation Flow としました。
    Studio Flow - Name

    用意されているテンプレートか …

    Read More
  • By Michael Okoko
    Verify Phone Numbers with Bref PHP and Twilio Verify Verify Phone Numbers with Bref PHP and Twilio Verify.png

    Bref is a composer package that helps you deploy your PHP applications as AWS Lambda functions. It leverages the Serverless Framework to provision and deploy such applications, and provides support for common frameworks like Laravel, Symfony, and Slim PHP.

    In a previous article, we explored how we can use the Bref PHP framework to forward errors from our Twilio application to a Slack channel. In this article, we will revisit Bref by building a service that verifies users’ phone numbers using the Twilio Verify API.

    Prerequisites

    To complete this tutorial, you will need:

    Create a Twilio Verify Service

    To get started, head over to your Twilio Verify Console and create a new Verify Service. Take …

    Read More
  • By Alex Dunne
    How to Build an Automated SMS Survey Using Twilio Studio and IBM Watson Tone Analyzer Using Twilio Studio and IBM Watson Tone Analyzer

    Surveys are a great tool to receive feedback from your customers. Timely surveys to new and existing customers can provide enormous insight into how your product or service is performing, and highlight problems you may not know existed.

    In this tutorial, we’ll build an automated SMS survey application that reacts empathetically to customer responses using Twilio Studio, IBM Watson Tone Analyser, and a little bit of JavaScript.

    Upon completion, you will have learned about Twilio’s visual application builder, Twilio Studio, and how to utilize it to build an automated SMS survey workflow. You’ll also learn how to integrate external third-party APIs into the workflow to enhance the application’s functionality. By the end of this article, you will be on your way to building a fully-featured SMS survey that replies based on the customer’s feedback.

    In the following examples, we’re going to tailor the questions towards the hotel industry. …

    Read More
  • By Dotun Jolaoso
    Build a WhatsApp Bitcoin Currency Conversion Bot with Python and Twilio Build a WhatsApp Bitcoin Currency Conversion Bot with Python and Twilio

    In this tutorial, we’ll be looking at how to build a simple WhatsApp chatbot that handles the conversion of any given number of Bitcoin units to the equivalent in a preferred currency. The bot will be built using Twilio API for WhatsApp and the Flask Framework for Python.

    Technical requirements

    To follow along, you’ll need the following:

    • A free Twilio Account. If you use this link to register, you will receive $10 credit when you upgrade to a paid account.
    • Python 3.6 or newer
    • Ngrok. This will make the development version of our application accessible over the Internet.
    • A smartphone with an active number and WhatsApp installed.

    Creating a Python environment

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

    $ mkdir twilio_whatsapp_bot
    

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

    $ python …
    Read More
  • By David Pine
    Running a Video Chat App Built with ASP.NET Core 3.1 and Twilio Programmable Video on Microsoft Azure video-chat-dot-net-3-1-deploy.png

    With Twilio Programmable Video you can add robust video chat functionality to web applications built with Angular and ASP.NET Core. With Microsoft’s Azure App Service you can host your video-enabled apps on a fully managed, enterprise-grade cloud platform. Deployment and configuration are easy and take just minutes.

    The post Building a Video Chat App with ASP.NET Core 3.1, Angular 9, and Twilio  demonstrated how to integrate the Twilio JavaScript SDK and the Twilio .NET SDK with ASP.NET Core and Angular. The next step in implementing a video chat application is learning to deploy it to the cloud with Microsoft Azure.

    In this post you’ll learn how to publish a video chat application to the Azure App Service and securely configure it to use the Twilio Video Chat API. You’ll be able to try out the production application’s video chat features and verify that it’s configured correctly.

    Prerequisites

    Windows 10 version: …

    Read More
  • By Miguel Grinberg
    Using Test Credentials and Magic Phone Numbers to Test Twilio Applications Using Test Credentials and Magic Phone Numbers to Test Twilio Applications

    A common problem when developing an application that uses Twilio services is how to effectively test it. Making real requests to Twilio for testing purposes is something that can be useful when done sparsely, but it is not ideal as a general approach to testing because it can end up being expensive. Also, when testing how your application responds to errors you are going to find that it is very hard to replicate all the possible error conditions that can occur in SMS or Voice communication.

    In this article you are going to learn how to work with your Twilio Test Credentials to be able to send fake, yet realistic requests to Twilio that have a predictable result, and more importantly, are 100% free.

    Tutorial requirements

    To follow this tutorial you need the following components:

    • Python 3.6 or newer. If your operating system does not provide a Python interpreter, you …
    Read More
  • By Athul Cyriac Ajay
    Running a Mailing List with Airtable, Twilio SendGrid and Python Running a Mailing List with Airtable, SendGrid and Python

    Mailing lists are the heart of many communities. They help community members be organized and up-to-date with all the communications and updates happening inside the community. Airtable is an all-round software which acts both as a spreadsheet and a database. In this post we’ll use Airtable to collect email addresses of members in the mailing list. We’ll use Airtable’s API to fetch the data and send emails to members using SendGrid’s powerful email API, all done with Python. So, lets get on to it!

    Tutorial Requirements

    • 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 free Airtable account. Signup here.
    • A free Twilio SendGrid account. Signup here.

    Setting Up a Python Virtual Environment

    Before we kick off, let’s create a Python virtual environment to start clean. We’ll be making a folder and a …

    Read More
  • By Miro Botur
    Link IVR Time/Path with Inbound Calls Using Flex Insights figure-insights-reports.bdf8b667c.png

    Want to see Twilio Flex in action? Check out our interactive demo.

    Ready to start building your contact center? We're offering $5,000 worth of free Flex Hours to help you get started. Sign up and start building with Twilio Flex!

    This post is part of a series on IVRs and Flex Insights. Learn how to track calls abandoned in your IVR here, and stayed tuned for an upcoming guide on keeping track of IVR workflow executions in Studio.


    Contact centers push for the use of self-service options to reduce the time their agents spend on handling common requests. In many cases an IVR is used to serve basic customer needs. However, to provide a good customer experience and increase the percentage of self-service inbound calls, visibility on how customers interact with an IVR is critical.

    In this guide, I’ll show you how to use Flex Insights to consume IVR …

    Read More
  • By Shane Rosenthal
    Create a Currency Data Type using Custom Casts in Laravel 7 Create a Currency Data Type using Custom Casts in Laravel 7

    Since Laravel version 5.1, as developers have been given the ability to cast attributes on models. Attribute casting provides a convenient method of converting attributes to common data types. Behind the scenes, Laravel actually uses these casts for the created_at and updated_at fields on a typical model. These attributes are cast as a datetime which converts the database timestamp to a Carbon instance. The cast types that we have had at our disposal are integer, real, float, double, string, boolean, object, array, collection, date, and datetime.

    However, with the release of Laravel 7, we have the ability to create our own custom cast types. For example, maybe you have a model that stores the price of a product or subscription as cents along with currency. We can now create a custom cast that will handle storing …

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