HowTo's and Example Code

Voice

  • Appointment Reminder
    • ruby

    Appointment reminder is an outgoing application that calls your phone and gives you an automated reminder with a simple phone tree. You enter your number in a webpage, Twilio initiates an outgoing call to that number and reads the appointment details. This demo is written in Ruby using the Ruby on Rails Framework.

  • Buy A Phone Number
    • php
    • ruby

    Twilio provides a powerful search interface for finding new phone numbers to buy. See how to use a few of the search features available in the REST API in this HowTo.

  • Call Queue
    • php

    Call Queue shows how to use Twilio's REST call redirection feature to manage a simple call queue.

  • Call Screening
    • php
    • coldfusion

    Many times a voice application will have a list of numbers to call in a specific order. If the first number doesn't pick up, then a second number should be called, and so on. We prompt the called number to accept the call. If no answer is received, we move on to the next phone number.

  • Call Tracking
    • php

    A call tracking application allows you to collect metrics about your phone calls so you can monitor their effectiveness and optimize marketing. Using Twilio, you can record every call as well as track information such as what number was dialed, what time of day it was dialed, the duration of the call, and the geographic location of the caller.

  • Click to Call
    • php
    • coldfusion
    • java

    Click-to-call enables your company to convert web traffic into direct telephony communication with just the click of a button. Twilio makes it easy to implement and integrate click-to-call directly into your web application.

  • Company Directory
    • mysql
    • php

    Most company phone systems have the idea of "extensions", an addition to the companies public phone number that lets you connect to one of many company phones that sit behind that phone number.

  • IVR: The Basics
    • php

    IVRs are automated phone systems that allow customers to interact with their information over the phone. If you've ever called up your bank or credit card and went through a series of automated prompts to check your account balance, you've used an IVR. You can easily create powerful IVRs for your business using Twilio's API's. This is part 1 in a 5 part series on building IVRs.

  • IVR: Extensions
    • php

    Building upon the code we wrote in part 1 of the IVR series, we now add support for phone extensions in our IVR. This is part 2 of the 5 part series on building IVRs.

  • IVR: Call Screening and Recording
    • php

    Using Twilio's <Number> verb, we can add features commonly found in sophisticated IVRs, such as call screening (often referred to as "whisper") and recording. This is part 3 in a 5 part series on building IVRs.

  • IVR: Database Integration
    • php

    By connecting the IVR we made in the prior sections to your database, you can allow your customers to access their data without having to speak to an agent. Doing this is as easy as using Twilio's <Gather> verb to collect input over the phone and retrieving information in the database based on that input. This is part 4 in a 5 part series on building IVRs.

  • IVR: Logging and Reporting
    • php

    When a call comes into your Twilio number, Twilio sends the phone call information to your application as an HTTP request. Information such as the caller's phone number and (if available) their city, state, and zip code. Logging this information is easy to do, and can be useful for reporting later on. This is part 5 of the 5 part series on building IVRs.

  • Moderated Conference
    • php

    The Moderated Conference how to shows you how to use Twilio's conferencing features to build a business conference application with more fine grained controls on how participants can behave in the conference.

  • Phone Menu
    • php
    • coldfusion

    Any small business knows the importance of having an automated phone menu system. Any small business also knows the pains of operating a PBX, especially when only a few menu items are necessary. Twilio makes it easy to create an automated phone menu system.

  • Phone Poll
    • mysql
    • php

    Phone Poll shows you how to setup a simple polling system that allows you to ask your friends a question, get their input and then store it in a MySQL database. This tutorial requires a knowledge of both PHP and MySQL, as well as access to a server that allows you to create a MySQL database.

  • Reject an Incoming Call
    • php
    • ruby

    Rejecting an incoming call shows how to prevent incoming calls from reaching your Twilio number, enabling you to build a simple blacklist.

  • Simple Conferencing
    • xml

    Simple Conferencing shows how to use Twilio's conference functionality to build a simple conference room. This demo uses static TwiML and is applicable to all languages.

  • Using Twilio Subaccounts
    • php
    • ruby

    With subaccounts your application can segment each of its user's Twilio activity into separate buckets, facilitating account management and reporting.

  • Voice Broadcast
    • php

    Voice broadcast connects users to their audiences. Broadcast recorded messages instantly and easily. All it takes is a call.

  • Voicemail
    • mysql
    • php

    Voicemail is a telephony application with which everyone is familiar. Twilio makes building a voicemail system simple, and makes integrating it with the web or other messaging technologies just as straight forward. This recipe will describe the building of a simple voicemail box application.

  • Voicemail Transcription
    • php

    Voicemail Transcription shows how to use Twilio's speech-to-text transcription API to automatically record and convert voicemail message to text. This demo is written in PHP

  • Weather By Phone
    • python
    • app_engine

    Weather By Phone lets you check the weather in your area by phone. Twilio answers the call, the application asks the caller for their US zipcode, the application looks up the weather using a remote web service and reads the weather to the caller. This demo is written in Python using Google App Engine.

Twilio Client

  • Audio Recording
    • php
    • js

    Twilio Client provides an easy way for your website visitors to create audio recordings using a usb headset or microphone. Twilio Client can make use of any TwiML tag, just like a Twilio phone call, making it easy to bring custom call flows to the browser.

  • Browser Soft Phone
    • php
    • js

    You can use your web browser as a telephone using Twilio Client. This HowTo shows how you can place outgoing calls to any phone using a usb headset or microphone and also create a virtual dialpad to send touch tone digits. You may also optionally provision a traditional phone number to ring in the browser when called.

  • Browser to Browser Call
    • php
    • js

    Twilio Client provides an easy way for your website visitors to speak to each using a usb headset or microphone. You can easily build an internal company switchboard or add voice chat to your social application. This example demonstrates browser to browser calling using Twilio Client.

  • Click to Call
    • php
    • js

    Twilio Client makes it easy to add browser calling to your website using a usb headset or microphone. You can use Click-to-call to connect your web user with a traditional phone number such as a sales line with just the click of a button. This example shows browser based click-to-call using Twilio Client.

  • Conference Call
    • php
    • js

    You can add group chat to your website using Twilio Client and conference rooms. Twilio client interoperates with traditional phone calls, so you can also provide a call in number for non web users to join in the fun.

  • Conference Call Monitor
    • php
    • js

    You can use Twilio Client to listen in to any conference call in progress. The conference calls may be phones only, web based, or a combination of the two. Using the Twilio REST API you can list all conferences room names in-progress, and you may select a room to listen in.

  • Text-to-Speech
    • php
    • js

    Twilio Client makes it easy to bring any TwiML functionality into the browser, including text to speech using the Say verb. Twilio Client can be used to offer a spoken version of your website content, rss feeds, read important updates, provide live commenting and more.

SMS Messages

  • SMS Notifications
    • php

    SMS messages are a common form of communication for mobile phone users and a great way to distribute information to several people at once. With Twilio SMS, developers can easily send and receive SMS messages programmatically from Twilio phone numbers.

  • Send an SMS From a Call
    • python
    • app_engine

    Sending text messages during a phone call is a useful way to give users content for offline reference, or even confirm an sms subscription. In this demonstration, we are going to describe how to build an application that can initiate an SMS message from a phone call.