Build the future of communications.
Start building for free
  • By Miguel Grinberg
    How to Play Video Files in a Twilio Video Call How to Play Video Files in a Twilio Video Call

    A common need in video calling applications is to allow a user to play a media file for the other participants in the call. This can enable, for example, a teacher or doctor to share a recording with the call attendees.

    In this article I will show you how a participant in a Twilio Video call can share video and audio content in formats such as mp4 or webm.

    The MediaStream API

    The JavaScript version of the Twilio Video SDK uses existing APIs in the browser to obtain access to the camera and microphone. More specifically, it uses the MediaDevices.getUserMedia() function to access MediaStream objects for these devices, which expose the raw video and audio tracks that are then published to the video call.

    But the MediaStream APIs cover much more than webcams and microphones and can be used to obtain MediaStream objects from other sources. For example, the …

    Read More
  • By Miguel Grinberg
    Using Ngrok in 2022 Using Ngrok in 2022

    A large number of online tutorials on this blog and elsewhere recommend the use of Ngrok as a quick way to temporarily make a web application running locally on your computer available on the Internet. This tool is an extremely popular solution that enables developers to test their webhooks and other web based applications during development.

    Have you tried following a tutorial that uses Ngrok and could not make it work? The reason is likely that Ngrok has recently added some restrictions to its service, making the instructions that you find in a lot of tutorials incorrect for current versions of the tool. This article explains what the changes are, and how to avoid hitting the limitations this service has put in place.

    What is Ngrok?

    Ngrok is a development tool that you can use to expose a server running locally on a computer, possibly even behind a firewall, to …

    Read More
  • By Miguel Grinberg
    Erstelle einen WhatsApp-Chatbot mit Python Build a WhatsApp Chatbot with Python, Flask and Twilio

    Ein Chatbot ist eine Softwareanwendung, die ein Gespräch mit einem menschlichen Nutzer in geschriebener oder gesprochener Sprache führen kann. Der Grad der „Intelligenz“ von Chatbots kann sehr unterschiedlich sein. Während einige Chatbots ein eher einfaches Sprachverständnis zeigen, setzen andere hochkomplexe Algorithmen künstlicher Intelligenz (KI) und maschinelles Lernen (ML) ein, um ein nahezu menschliches Konversationsniveau zu erreichen.

    In diesem Tutorial zeige ich Ihnen, wie einfach Sie einen Chatbot für WhatsApp mit der Twilio-API für WhatsApp und dem Flask-Framework für Python erstellen können. Unten sehen Sie ein Beispiel für eine Interaktion, die ich mit diesem Chatbot hatte:

    WhatsApp chatbot demo session

    Anforderungen für das Tutorial zum WhatsApp-Chatbot

    Für dieses Tutorial benötigen Sie Folgendes:

    • Python 3.6 oder höher. Wenn Ihr Betriebssystem keinen Python-Interpreter bereitstellt, können Sie unter python.org einen Installer herunterladen.
    • Flask. Wir erstellen eine Webanwendung, die damit auf eingehende WhatsApp-Nachrichten reagiert.
    • ngrok. Dieses praktische Dienstprogramm verwenden wir, um die Flask-Anwendung auf Ihrem System mit …
    Read More
  • By Miguel Grinberg
    Synchronized State Variables for React using Twilio Sync Synchronized State Variables for React using Twilio Sync

    State variables are one of the most important building blocks in front end applications developed with the React library. When a state variable is updated, React automatically re-renders any application components that depend on it, ensuring that the application always displays updated information to the user.

    The automatic state update mechanisms in React are fantastic, but they are limited to a single instance of the application. Sometimes, however, an application needs state variables that are automatically synchronized across all running instances of the application. In this tutorial you are going to learn how to create a custom React hook that implements synchronized state variables using Twilio Sync as a cloud storage back end.

    Tutorial demonstration

    Requirements

    To work on this tutorial you will need the following items:

    Read More
  • By Miguel Grinberg
    Serverless Twilio Webhooks on AWS with Lambda Function URLs Serverless Twilio Webhooks on AWS with Lambda Function URLs

    Serverless platforms are ideal for the deployment of webhooks such as those used by Twilio services, as they provide flexibility and scalability without the complications involved in hosting on your own infrastructure.

    In this tutorial you are going to learn how to create a Twilio SMS webhook written in Python using AWS Lambda, with its brand new function URLs feature.

    Requirements

    To work on this tutorial you will need the following items:

    • A Python 3 interpreter compatible with AWS Lambda (as of April 2022, Python 3.6, 3.7, 3.8 or 3.9). If your operating system does not provide a Python interpreter, you can go to python.org to download an installer.
    • Node.js installed on your computer. You can download a Node.js installer from the Node.js website.
    • A Twilio account. If you are new to Twilio click here to create a free account now and receive $10 credit when you upgrade …
    Read More
  • By Miguel Grinberg
    Transcribe your Phone Calls to Text in Real Time with Twilio and Vosk  Transcribe your Phone Calls to Text in Real Time with Twilio and Vosk

    In this tutorial, you are going to learn how to implement live transcription of phone calls to text. The phone calls will be routed through a Twilio phone number, and we will use the Media Streams API to stream the incoming audio to a small WebSocket server built using Python. Once in your server, the audio stream will be passed to Vosk, a lightweight open-source speech recognition engine that runs locally on your computer, with support for many languages.

    Live transcription of phone calls demonstration

    Requirements

    To work on this tutorial, you will need:

    Read More
  • By Miguel Grinberg
    How to Play Audio Files in a Twilio Video Call How to Play Audio Files in a Twilio Video Call

    A common need in video calling applications is to allow a user to play an audio file for the other participants. This could be used to add background music to a call, to share a recorded conversation, or just to make calls more fun with sound effects or a rickroll.

    In this short tutorial you will learn how a participant in a Twilio Video call can publish a secondary audio track and play back an audio file on it.

    Brief introduction to the MediaStream API

    The JavaScript Twilio Video library uses existing APIs in the browser to obtain access to the camera and microphone. More specifically, it uses the MediaDevices.getUserMedia() function to access MediaStream objects for these devices, which expose the raw video and audio tracks that are then published to the video call.

    Interestingly, there are other ways to obtain MediaStream objects, beyond the camera and the microphone. …

    Read More
  • By Miguel Grinberg
    Build a Serverless Video Chat Application with JavaScript and Twilio Programmable Video Build a Serverless Video Chat Application with JavaScript and Twilio

    In this article you are going to learn how to build a basic video conferencing solution using Twilio Video. The system is going to run on desktop and mobile web browsers, so participants will not need to download or install any software on their computers to join a call.

    The application will be coded in JavaScript, with some HTML and CSS. It will be deployed to the Twilio Serverless platform, so that you can use it to connect with family, friends or colleagues anywhere in the world without having to worry about complicated hosting solutions.

    Do you want to see what you’ll build before you start? Here is a screenshot.

    Project screenshot

    By following this article, you can learn how to create this project in small incremental steps. If you prefer to download the complete project instead of building it step-by-step, you can find the code in this GitHub repository: https://github.com/miguelgrinberg/twilio-serverless-video …

    Read More
  • By Miguel Grinberg
    Send Scheduled SMS with Go and Twilio Send Scheduled SMS with Go and Twilio

    Twilio is all about powering communication – and doing it conveniently and fast. Our Programmable Messaging service has been available for a long time, but until now, scheduling a message to be sent at a future time required a developer to use their own scheduling solution.

    Fortunately, this is now a thing of the past! With Message Scheduling, you can send your scheduled SMS and MMS messages with a single API call, without using custom schedulers.

    In this tutorial, you’ll learn how to send scheduled SMS notifications in Go.

    Tutorial requirements

    Read More
  • By Miguel Grinberg
    Send Scheduled SMS with Ruby and Twilio Send Scheduled SMS with Ruby and Twilio

    Twilio is all about powering communication – and doing it conveniently and fast. Our Programmable Messaging service has been available for a long time, but until now, scheduling a message to be sent at a future time required a developer to use their own scheduling solution.

    Fortunately, this is now a thing of the past! With Message Scheduling, you can send your scheduled SMS and MMS messages with a single API call, without using custom schedulers.

    In this tutorial, you’ll learn how to send scheduled SMS notifications in Ruby.

    Tutorial requirements

    • Ruby version 3 or newer. If your operating system does not provide a Ruby interpreter, you can go to ruby-lang.org to download an installer.
    • Bundler installed, to manage your Ruby dependencies.
    • A Twilio account. If you are new to Twilio click here to create a free account now and receive $10 credit when you upgrade to a paid …
    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.