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 Dominik Kundel
    環境変数の設定方法 environment variables - header

    この記事はTwilio Developer AdvocateのDominik Kundelがこちらで執筆した記事を日本語化したものになります。



    dog - wondering




    Windowsの環境変数 …

    Read More
  • By Diane Phan
    How to Store Multimedia Files in a SQLite3 Database with Python header - How to Store Multimedia Files in a SQLite3 Database with Python

    If you're a developer who is building out a website that allows users to upload image files for reasons such as updating a profile picture, sharing images with other users, or utilizing other multimedia files, you will find yourself wondering, "what's the safest way to save their data?".

    You could store the files directly in the server’s file system, integrate with APIs from cloud storage platforms, or you can learn how to store the information in your database!

    In this tutorial, you will learn about blob (binary large object) data and why you need to convert your multimedia files to binary objects in order to store them properly in a database. Then you will learn how to retrieve the blobs and convert them back into regular files for use by your application.

    Let's get started!

    Tutorial requirements

    • Python 3.6 or newer. If your operating system does not provide a Python …
    Read More
  • By Phil Nash
    Build a stock quote SMS bot with Twilio and TypeScript Build a stock quote SMS bot with Twilio and TypeScript

    We've seen how to send an SMS with TypeScript and how to receive and reply to SMS messages with TypeScript. Now let's create something we could use! If you're into investing, you can never have too many ways to check in on the stock market, so let's build an application you can send a stock symbol to and get back a stock quote.

    In this post we will build a Node.js application with TypeScript, using Express, the Twilio Node package, and the Finnhub API to reply to incoming SMS messages with stock quotes.

    What you will need

    To build the application in this post you will need:

    Read More
  • By Adeyemi Atoyegbe
    Building GraphQL APIs in Django with Graphene Building GraphQL APIs in Django with Graphene

    GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. It was developed internally by Facebook in 2012 before being publicly released in 2015. It allows clients to define the structure of the data required, and the same structure of the data is returned from the server, therefore preventing unnecessary data from being returned.

    GraphQL has three primary operations: Queries for reading data, Mutations for writing data, and Subscriptions for automatically receiving real-time data updates. A GraphQL server provides clients with a predefined schema – a model of the data that can be requested. The schema serves as common ground between the client and the server.

    In this tutorial we will use Graphene, a GraphQL framework for Python, to build a Django API that uses queries and mutations.

    Tutorial Requirements

    To follow along with this tutorial you should have …

    Read More
  • By Sam Agnew
    Using Python and Twilio Messaging to find out if the Suez Canal is still blocked Copy of Generic Blog Header 1(4).png

    Recently a 200,000 ton container ship named the Ever Given has become stuck in the Suez Canal, halting one of the world's busiest waterways and disrupting global supply chains. And it looks like it might take weeks to move it. Luckily for those on the edge of their seats, with the Marine Traffic API we can access the location of marine vessels programmatically.

    My coworker Kelley Robinson used this to create a Twilio phone number that you can text to see if the Ever Given is still stuck. Try it out by texting +1 (586) 800-BOAT, which is +1 (586) 800-2628, to get the status of the situation.

    Boat still stuck? Text message

    Let's walk through how you could build your own version of this, using Twilio Programmable Messaging, Flask, and the Marine Traffic API.

    Setting up your environment

    Make sure to have your Python environment set up before we get started. …

    Read More
  • By Ashley Boucher
    How to Check your Twilio Account Balance in JavaScript accountbalance.png

    Twilio APIs make it possible to add communication features to your application, but to consume these APIs you have to keep track of your spending and ensure your account balance stays above zero.

    Your balance is available in the main page when you log in to your Twilio Console, but having to actively monitor your account is tedious and inconvenient.

    In this tutorial you are going to learn how to write a script that retrieves your account balance using JavaScript. You can also schedule this script to run on a regular cadence, and even set up SMS based notifications if you drop below a certain balance.


    To get started with this tutorial, you’ll need the following:

    Create a Node.js project

    From your …

    Read More
  • By Mwangi Kabiru
    Building a Serverless WhatsApp Chatbot using Python, Google Cloud Functions and Twilio Building a Serverless WhatsApp Chatbot using Python, Google Cloud Functions and Twilio

    A chatbot is a software application used to automate interactions and conversations with people via messaging platforms. Common uses of chatbots include request routing, customer service, and information gathering.

    Serverless architecture is a design pattern where applications are broken up into individual functions that can be invoked and scaled separately. The goal is to abstract the process of building and running applications from the complexities of developing and deploying infrastructure required to run them.

    In this tutorial, I am going to show how you can build a serverless WhatsApp chatbot using Twilio’s WhatsApp API and Python functions in Google Cloud. The chatbot will accept a country name and return information about it. The country data will be retrieved from the REST Countries public API.

    Project demo

    Tutorial requirements

    To follow this tutorial you need to have:

    • Python 3.7 or newer. If your operating system does not have a pre-installed Python interpreter, you …
    Read More
  • By Sam Agnew
    Asynchronous HTTP Requests in Python with aiohttp and asyncio Copy of Generic Blog Header 3(4).png

    Asynchronous code has increasingly become a mainstay of Python development. With asyncio becoming part of the standard library and many third party packages providing features compatible with it, this paradigm is not going away anytime soon.

    Let's walk through how to use the aiohttp library to take advantage of this for making asynchronous HTTP requests, which is one of the most common use cases for non-blocking code.

    What is non-blocking code?

    You may hear terms like "asynchronous", "non-blocking" or "concurrent" and be a little confused as to what they all mean. According to this much more detailed tutorial, two of the primary properties are:

    • Asynchronous routines are able to “pause” while waiting on their ultimate result to let other routines run in the meantime.
    • Asynchronous code, through the mechanism above, facilitates concurrent execution. To put it differently, asynchronous code gives the look and feel of concurrency.

    So asynchronous …

    Read More
  • By Diane Phan
    How to Make a Phone Call Using Node.js and Twilio Programmable Voice phonecallnode

    Twilio Programmable Voice allows you to make and receive voice calls in your software application. In this tutorial, you’ll see a demonstration of how to use Programmable Voice to make a voice call directly from a Node.js app.


    • A free Twilio account (register here and receive $10 in Twilio credit!)
    • Node.js installed on your machine
    • A phone that can make phone calls, to test the project

    Set up your environment

    In this section you are going to set up a brand new Node.js project. To keep things nicely organized, open a terminal or command prompt, find a suitable place and create a new directory where the project you are about to create will live:

    mkdir nodejs-phone-call
    cd nodejs-phone-call

    Install the Twilio Node Helper Library from your command line with the following:

    npm install twilio 

    Configure Twilio credentials

    To be able to access the Twilio service, your Node.js application …

    Read More
  • By Valeriane Venance
    Send vCard with Ruby and Twilio send-vcard-twilio-ruby

    Have you ever sent contact information from a phone to another ? If so, you already have encountered vCard, the standardized format for Virtual Contact Files. These .vcf files are super helpful for contact imports.

    In this blog post we will create a vCard with Ruby and send it to our phones with Twilio Programmable SMS. By the end of this tutorial you will have a Ruby script that generates vCard files and another one that sends vCards to your contacts.

    I will generate my vCard and send it to my personal phone number. You can add me to your contacts by using your phone number or create your own vCard and send it to whoever you want.


    To follow along with me, you will need:

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