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 Niels Swimberghe
    Making Phone Calls from Blazor WebAssembly with Twilio Voice blazor-twilio-voice (1).png

    Mobile phones are ubiquitous and convenient but there are times when it’s more practical to be able to receive and place phone calls from a computer. If you’ve called customer service about the tickets you ordered, or anything else, it’s likely the rep you spoke to took your call with a mouse click.

    Using Twilio Voice you can add the ability to make and receive phone calls from your own ASP.NET web applications. Twilio’s helper library for JavaScript makes it easy to integrate client functionality into web front ends built with Blazor WebAssembly, and the Twilio NuGet packages provide you with convenient interfaces to Twilio’s APIs for server-side tasks.

    Blazor WebAssembly lets you build your application front end in C# and Razor, so you can focus the client-side JavaScript on functionality that requires JavaScript for implementation.

    JavaScript interoperability (JS interop) is a feature of Blazor that makes it easy to …

    Read More
  • By Huzaima Khan
    Build a Chat App with Twilio Programmable Chat and React.js chatapp.png

    This tutorial will teach you how to build a chat app in React using Twilio’s Programmable Chat API. After finishing this tutorial, you will have developed a web app to chat with other participants.

    Prerequisites

    Getting started

    React project setup

    Create a new directory on your computer called chat-app and change directory into it:

    mkdir chat-app
    cd chat-app
    

    Your new chat-app directory will house both the backend and frontend components of the app. To create a new React project for the frontend, run the following command in your terminal:

    npx create-react-app react-chat
    

    Change directory to the newly crea …

    Read More
  • By Rachel Black
    Building an SMS notification service with Serverless. Using Node.js, Serverless and Twilio’s SMS API to write a notification service for Ethereum gas prices.

    Ethereum is a blockchain with a cryptocurrency. As with Bitcoin, it costs users to send ethereum transactions, or interact with a smart contract (an on chain programme). The cost of these transactions is called gas, and the price can vary depending on usage. If lots of people are using the network, gas prices can get very high. Read more on gas prices, and how they skyrocketed earlier this summer here. Savvy users wait for lower gas prices to interact with Ethereum smart contracts. Twilio’s SMS API is the perfect tool to keep you updated on prices.  I am going to show you how to write a serverless application to send SMS notifications when gas fees are below a certain level.

    If you aren’t interested in gas prices, the flow in this tutorial can be used to query and connect any https REST api via Serverless to Twilio’s SMS api. …

    Read More
  • By Ashley Boucher
    How to Send a WhatsApp Message in 30 Seconds with JavaScript whatsapp.png

    Just like Memphis Raines figured out how to steal fifty cars in one night, you’re going to learn how to send one WhatsApp message in thirty seconds (using JavaScript!).

    Buckle up, cause here we go.

    GIF of Nicholas Cage in Gone in Sixty Seconds saying "Okay let's ride"

    Prerequisites

    Get your development environment setup

    Create a new directory on your computer, change into it, and initialize a new Node.js project:

    mkdir whatsapp
    cd whatsapp
    npm init -y
    

    Install the Twilio Node Helper Library and the dotenv package:

    npm install twilio dotenv
    

    Create two new files inside your new whatsapp directory:

    touch index.js && touch .env
    

    Open the .env file and add two environment variables to sto …

    Read More
  • By Dotun Jolaoso
    Build a Real-Time SMS Dashboard with Python, Flask and Twilio Sync Build a Real-Time SMS Dashboard with Python, Flask and Twilio Sync

    Twilio Sync provides you with a set of intuitive APIs that allow you to synchronize application state across mobile apps and websites in real-time. Some example use cases where you can make use of Twilio Sync within your application include:

    • Real-time Dashboard Charts
    • Broadcasting notifications to users in real-time
    • Real-time Collaboration Software such as Google Docs.

    In this tutorial, we’ll use Python and the Flask framework to build a dashboard that displays SMS messages in real-time as they are sent to your Twilio phone number.

    Technical requirements

    To follow along, you’ll need the following:

    • A free Twilio account and a Twilio phone number. 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.

    Creating a Python environment

    Let’s create a directory …

    Read More
  • By Oluyemi Olususi
    Create a Secured RESTful API with CodeIgniter and JSON Web Tokens Create a Secured RESTful API with CodeIgniter.png

    The growing use and applications of cloud services necessitates a more efficient architectural style than the Simple Object Access Protocol (SOAP). REST (REpresentational State Transfer) allows for a light-weight, stateless communication between clients and the Application Programming Interface (API). Because the communication is stateless, access control for Restful APIs is based on tokens which carry enough information to determine whether or not the client is authorized to perform the requested action on the resource.

    In this tutorial, I will use CodeIgniter to build a RESTful API. CodeIgniter is a powerful PHP framework with a very small footprint which allows developers to build full-scale web applications.

    Prerequisites

    A basic understanding of CodeIgniter will be helpful in this tutorial. However, I will provide explanations and links to official documentation throughout the tutorial. If you’re unclear on any concept, you can review the linked material before continuing with the …

    Read More
  • By Oluyemi Olususi
    Build a Single Page Application in PHP with CodeIgniter and React Build a Single Page Application in PHP with CodeIgniter and React

    Having a clear dichotomy between client-side and server-side applications comes with many advantages such as separation of concerns and loose coupling, which allows teams to work independently. However this might be overkill for smaller teams or projects managed by the same person. In such situations, a better approach might be to have relevant code for both the front-end and back-end reside in the same project. In this tutorial, I’ll show you how to build a web application with React and CodeIgniter.

    According to the official documentation, React is a JavaScript library for building user interfaces. My favorite feature of React is that it allows me to structure my web applications by breaking the interface into components and building accordingly. I’ve found this to add reusability and consistency to my applications.

    CodeIgniter, on the other hand, is a lightweight open source PHP framework that allows developers to build web applications …

    Read More
  • By Ashley Boucher
    Generate an Access Token for Twilio Chat, Video, and Voice using Twilio Functions accesstoken.png

    Twilio offers client-side software development kits (SDKs) for several of its products including Programmable Video, Programmable Voice, Programmable Chat, and Conversations.

    To make use of these SDKs, you need to generate Access Tokens. As described in the Twilio docs, Access Tokens are short-lived tokens to authenticate Twilio Client SDKs like Voice, Chat and Video. You create them on your server to verify a client's identity and grant access to client API features.

    In this article you’ll learn how to generate an Access Token using Twilio Functions. You’ll be able to replicate this setup again and again in your future projects, allowing you to save time and focus on the fun stuff!

    Prerequisites

    Install dependencies

    Your first goal is to get setup with Twilio Functions. Twilio Functions …

    Read More
  • By Dustin Ewers
    Get in Touch with Your Inner Hipster Using C# 9.0 Records csharp-9-records.png

    If you’ve been a professional developer for more than a year or two, you’ve probably heard some hipster developer rave about functional programming. Much like how music sounds better on vinyl, programming is just better in functional languages. Your IQ jumps ten points if you can write a Fibonacci generator in Lisp, and it jumps twenty points if you can accurately describe what a monad is.

    Jokes aside, like craft beer and artisan bacon, the hipsters have a point. As someone who has kids and hobbies, I can’t help you with monads, but learning about less esoteric functional programming concepts will help you write cleaner code with fewer bugs.

    Functional programming concepts have been finding their way in our general-purpose programming languages for years, and C# 9 is no exception. In the latest version of C#, Microsoft has introduced some new functional goodies, mostly around immutable programming. In this post, …

    Read More
  • By Miguel Grinberg
    Add Text Chat To Your Video Calls With The Twilio Conversations API Add Text Chat To Your Video Calls With The Twilio Conversations API

    If you implemented a video calling application using the Twilio Programmable Video API, you may find that during a call you want to share textual information with the other participants. This could be a link to a document, or even a reaction emoji. In this article you are going to learn how to take your video application to the next level by adding a chat room with the Conversations API.

    Video call with chat demo

    Tutorial requirements

    This is the third article in my series of Programmable Video tutorials, so we are going to take advantage of the video chat application built in the previous two installments and add the chat room feature to it. This application uses a vanilla JavaScript front end and a Python back end. To run this application on your computer you need the following requirements:

    • Python 3.6 or newer. If your operating system does not provide a Python …
    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.