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 Daizen Ikehara
    Programmable VoiceとAITalkのWeb APIを使って表現力豊かな自動音声で着信電話に応答してみた Prog Voice with AITalk

    Twilioが提供するProgrammable Voiceを利用すると、電話の自動応答や発信をアプリケーションから制御することができます。 着信に応答する場合は、Twimlと呼ばれるマークアップ言語を用いることで、応答する言語や音声を設定することができます。 またこのProgrammable Voiceでは、2018年から標準の音声合成エンジン以外にもAmazon Pollyが使えるようになりました。

    Amazon Pollyの合成音声は標準の合成音声に比べてとても滑らかなのですが、他の音声をリアルタイムで利用したいという声もよくいただきます。今回は株式会社エーアイ様が提供する日本語に特化した音声合成サービス、AITalk® Web API(以下 AITalk Web API)と連携してみました。

    AITalk Web APIは 感情表現や自然な音声、豊富な話者ラインナップを提供する音声合成エンジンAITalkをSaaS型で利用できるサービスです。サーバーを自前で構築する必要がないため、他のSaaSやクラウドサービスと素早く連携できます。これまでは評価版の申し込みから利用開始まで少し時間がかかっていましたが、最近、Webから評価用アカウントを即時取得し利用できるようになりました。


    • Node.jsおよびnpm
    • AITalk Web API評価アカウント
    • TwilioアカウントとTwilio電話番号


    GitHub - Neri78: Twilio-Voice-AiTalk …

    Read More
  • By Phil Nash
    An introduction to the Web Contact Picker API An introduction to the Web Contact Picker API

    If you're building a mobile application and you need access to the user's contacts you wouldn't give it a second thought, but on the web this feature was missing. The Chrome team saw this gap and got to work on an API that makes users' contacts available to developers with the security and privacy expected on the web. That API is now available in Chrome 80 on Android M or later.

    In this post we will investigate the new Contact Picker API and put it to use it in a Twilio Client application to add contact selection for making browser phone calls.

    The Contact Picker API

    The Contact Picker API consists of the ContactsManager object, available as the contacts property on the navigator object. As it is only supported on Chrome on Android for now, the first thing we should concern ourselves with is checking for support. We can do …

    Read More
  • By Michael Okoko
    Build Your Own API Analytics in Vue.js with PHP, Laravel, and Twilio Sync Build Your Own API Analytics in Vue.js with PHP, Laravel, and Twilio Sync

    Twilio Sync is a service provided by Twilio that helps you keep your application state in sync across different services. Specifically, it provides a “stack-agnostic” API that helps you add real-time capabilities to your application.

    In this article, we will explore how we can build a custom real-time API analytics tool powered by Sync Lists, a Sync primitive type that helps us synchronize individual JSON objects.

    NOTE: You can learn more about Sync Lists and other primitives from the Twilio Sync Object Overview.


    To complete this tutorial you will need the following:

    Creating the Sample Application

    We will generate a fresh application with the Laravel installer and enter into the project directory with:

    $ laravel …
    Read More
  • By Imran Khan
    Build a Soccer Stats WhatsApp Chatbot with Python, Flask and Twilio Build a Soccer Stats WhatsApp Chatbot with Python, Flask and Twilio

    There isn’t much live sport to watch at the moment which gives us the perfect opportunity to analyze historical data about the sport instead!  In this tutorial I’m going to show you how to build a basic chatbot for WhatsApp using the Twilio API for WhatsApp and the Flask framework for Python.

    The chatbot will allow users to get information about soccer teams and match statistics.  Here’s an example showing how it works:

    soccer chatbot demo

    Tutorial requirements

    To follow this tutorial you will need the following:

    • Python 3.6 or newer.  You can download an installer from python.org.
    • Flask.  We will use this web framework to build an application that responds to incoming WhatsApp messages.
    • ngrok. We will use this free utility to connect our Flask application running on our local system to a public URL that Twilio can connect to from the Internet.  Installation instructions for your operating system …
    Read More
  • By Corey Weathers
    How to Build a Conference Line with Twilio, ASP.NET Core, and C# How to Build a Conference Line with Twilio and C#

    Another conference call, another app, another PIN, another log-in. Joining conference calls should be as simple as dialing a phone number, without needing to enter random conference IDs. In this post, we will walk through how you can build a conference line that anyone can join, using Twilio with C# and ASP.NET Core.

    Developer Environment Setup

    Let's make sure you have the software you need to build this conference line. For this, you will need:

    Create the ASP.NET Core Project

    Get started by creating a folder for your project. I'll be using C:\Code\Conference in this post but you can use your preferred project path. Open a command prompt and enter the following commands.

    mkdir C:\Code\Conference & cd C:\Code\Conference
    dotnet new webapi
    dotnet add package Twilio
    code .

    It will create …

    Read More
  • By Toby Allen
    Working around PSTN congestion with Twilio Client Working around PSTN congestion with Twilio Client

    In these unprecedented times of social distancing and a virus pandemic, we are seeing a huge increase in the number of voice calls being made. Our Supernetwork team is working around the clock to ensure that calls make it through. However, in some areas, we are seeing that lines from carriers are so congested that the calls are never reaching Twilio. Here in this tutorial, we will outline some options to bypass the congestion on the PSTN by using Twilio Client.

    Twilio Client is a WebRTC based voice client that works in browsers and mobile devices using a data connection. Once a client call is connected to Twilio it can be routed directly to your existing infrastructure via SIP or uncongested PSTN paths allowing calls to continue to flow.

    The Idea

    Currently, your customers and staff may be struggling to connect to your contact centers or business-critical services because …

    Read More
  • By Chas Bowman
    Create Queues and Skills for A Flex Contact Center Flex Queues and Agent Skills

    You’ve just deployed Flex and you might be asking yourself: what’s next.

    Next, you’ll need to start thinking about your routing and queueing strategy. In this blog post, we will cover some basic options for queueing and skilling – it sets the groundwork on how you will report and analyze your contact center business.

    Let’s get started!

    What We’re Building Today

    Flex has the ability to leverage the full power of Twilio TaskRouter. TaskRouter is a powerful attributes-based routing system, the heart of the contact center. It’s also fully programmable, allowing you to control your contact center from your code. We’ll walk through a simple use case today: “How can I setup a contact center to support my customers and employees using Flex?”.

    To do this, we are going to build two new Task Queues: Customer Service and Employee Service. These will provide the ability to …

    Read More
  • By Alina Libova Cohen
    Baby Proofing with Raspberry Pi, Machine Learning and Twilio Programmable SMS Baby proofing with Raspberry Pi, Machine Learning and Twillio Programmable SMS

    cat detection demo

    Anyone with a baby and a cat knows maintaining the peace requires constant vigilance.  Thankfully, complete vigilance can now be bought for the low price of a Raspberry Pi, a webcam and the time it takes to read the rest of this article.  Here’s how I turned my Raspberry Pi into a 24/7 rent-a-cop.  

    Bottom line

    Using machine learning and Twilio, your Raspberry Pi can continuously monitor any area of your home using an off-the-shelf USB webcam.  This guide will walk you through how to set up your Raspberry Pi with YOLO, a real time object detection library, Darknet, an open-source neural network framework, OpenCV, a library for image processing, NNPack, a package for accelerating neural network computation, and Twilio Programmable SMS for sending notifications.


    This project came out of a personal need. We’re the proud owners of:

    • A Cat-obsessed baby
    • A Baby-obsessed cat

    This …

    Read More
  • By Miguel Grinberg
    How to Run a Flask Application How to Run a Flask Application

    For many years the famous “Hello, World” example Flask application was 7 lines long. Below you can see a snapshot of the Flask website as it looked on June 12th, 2017:

    old flask website

    This example application then was shortened to just 5 lines. Here is the same page on June 17th, 2017:

    new flask website

    As you can see, the core of the application has not changed, but the method by which the application server is started has indeed changed, and in a very significant way. While previously a simple app.run() call inside the application script was used, now there is a flask run command, plus a FLASK_APP environment variable.

    While the design of the Flask website has changed considerably in the years that followed, as I’m wri …

    Read More
  • By AJ Saulsberry
    Verifying Phone Number Messaging Capabilities with ASP.NET Core and Twilio Lookup verifying-phone-number-capabilities.png

    The ability to send and receive SMS and MMS messages programmatically is great, but how do you ensure you’re sending messages to a phone that’s capable of receiving them? If a customer provides you with a phone number when they sign up for an account, is it possible to verify the phone number’s capabilities while you’re verifying they own the phone number?

    With Twilio Lookup it is, and it’s easy to integrate this capability into your ASP.NET Core projects. One of the best ways you can use this resource is to use it to determine whether your application should be sending SMS messages or voice messages using the text-to-speech capabilities of the TwiML <Say> verb and Answering Machine Detection. With these tools you can communicate with customers asynchronously using their phone’s capabilities regardless of whether it’s a mobile or landline phone.

    In this post you’ll learn how to use …

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