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

JavaScript posts

  • By Dhruv Patel
    How to Send Recurring Emails in Node.js with SendGrid Header

    When building applications, there are often times when you need to create and run background tasks that run on a schedule such as checking for updates or backing up data.

    There are many ways of scheduling recurring tasks in Node.js such as using Crontab or cloud based extensions. Another approach to scheduling recurring tasks is through npm packages such as node-cron and node-schedule which provide flexible cron scheduling to Node.js through libraries without the need to rely on infrastructure.

    In this tutorial, you’ll learn how to use node-schedule and SendGrid to schedule recurring emails.

    Prerequisites

    Here is what you will need to follow along with this article:

    Configure your environment

    Start off by logging into your SendGrid account and heading to the API Keys section. Click the blue “Create API Key” button …

    Read More
  • By Heather Hargreaves
    Integrate Discord and Sentiment Analysis with Twilio Flex Integrate Discord and Sentiment Analysis with Twilio Flex

    In this post, you will learn how to set up a Discord bot connected to Flex so agents can chat directly with customers on that platform, while pulling in sentiment analysis of previous messages. You will learn how to use IBM’s Tone Analyzer API and Segment to calculate a user’s sentiment from their texts in a Discord channel.

    Originally this project was created as a part of the 2021 Solutions Engineering Hackathon. We pared our original project down to the following for simplicity’s sake and to distill the project’s essence, which is to help contact center teams interact with customers directly in Discord. To see the original contents of the project, see this Github repo.

    To see a demo of the original project and background on why we chose Discord, check out this quick video below.

    Read More
  • By Miguel Grinberg
    Add a Realtime Viewer Count to your Twilio Live Stream Add a Realtime Viewer Count to your Twilio Live Stream

    An important aspect of running a Twilio Live streaming experience is to track your viewership. But how do you do that? There are many different ways to do it, and the best method to use will depend on your needs and your technology stack.

    Are you ready to learn how to count your livestream viewers? In this article I’ll show you a few possible implementations with varying levels of complexity and flexibility.

    Requirements

    This article does not have any requirements beyond having some familiarity with the Twilio Live product. If you haven’t worked with Twilio Live before, I recommend that you follow an introductory tutorial first. My colleague Mia Adjei wrote a Twilio Live tutorial using Express.js, and I have also written one using the Twilio serverless platform, both of which show you how to build a complete livestreaming project step by step.

    To apply what you learn …

    Read More
  • By Lizzie Siegle
    Detect Objects in a Serverless Twilio Video App with TensorFlow.js header-tf-obj-det

    Object detection is a computer vision technique for locating instances of objects in media such as images or videos. This machine learning (ML) method can be applied to many areas of computer vision, like image retrieval, security, surveillance, automated vehicle systems and machine inspection. Read on to learn how to detect objects in a Twilio Programmable Video application using TensorFlow.js.

    object detection gif

    Setup

    To build a Twilio Programmable Video application, we will need:

    Download this GitHub repo and then create a file named .env in the top-level directory with the following contents, replacing the XXXXX placeholders with the values that apply …

    Read More
  • By Miguel Grinberg
    Deploy your Vue.js Application with the Twilio Serverless Toolkit Deploy your Vue.js Application with the Twilio Serverless Toolkit

    When you are ready to deploy your Vue.js application you are faced with the problem of selecting a hosting platform. For this there are lots of options, but many require you to set up and manage your own server or container.

    In this short tutorial I want to introduce you to the Twilio Runtime, a serverless hosting platform that when paired with the Twilio Serverless Toolkit makes deploying your front end application as easy as typing yarn deploy on your terminal.

    Requirements

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

    Read More
  • By Ashley Boucher
    How to Handle File Uploads from Node.js to Express fileuploads.png

    Recently I was developing a CLI in Node.js that would help make the process of writing articles in Markdown easier for my team. The flow required that a local .md file be parsed, formatted, converted to .docx, and then uploaded to Google Drive as a Google Doc file, all by running one command from the terminal.

    I approached this project in a few different ways, hoping initially that I could use serverless functions to handle the backend. I hit a lot of dead ends on this route, and eventually decided to build an Express server that I would ultimately host on Heroku.

    To upload the .docx file contents from my CLI to a secure backend endpoint, where it would then be uploaded to the user’s authenticated Google Drive, I needed a way to POST multipart/form-data directly from Node.js (without a browser). This requires several third party libraries, and it …

    Read More
  • By Miguel Grinberg
    Deploy your React Application with the Twilio Serverless Toolkit Deploy your React Application with the Twilio Serverless Toolkit

    When you are ready to deploy your React application you are faced with the problem of selecting a hosting platform. Here you have a variety of options, many of them requiring you to set up servers or containers.

    In this short tutorial I want to introduce you to the Twilio Runtime, a serverless hosting platform that when paired with the Twilio Serverless Toolkit makes deploying your React application as easy as typing yarn deploy on your terminal.

    Requirements

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

    Read More
  • By Mia Adjei
    Build a Livestreaming Application with Twilio Live and Express Build a Livestreaming Application with Twilio Live and Express

    Twilio Live is finally here! If you have ever wanted to build your own livestreaming application, now is your chance.

    In this tutorial, you will learn how to build a livestreaming application and share your live video feed with your friends, followers, and maybe even the world. For this project, you'll be using Node.js and Express to build the server side of the application, and vanilla JavaScript on the client side.

    Let's get started!

    Prerequisites

    • A free Twilio account. (If you register here, you'll receive $10 in Twilio credit when you upgrade to a paid account!)
    • Node.js v14+ and npm installed on your machine.
    • ngrok

    What you will build

    In this tutorial, you will be creating an application that allows a person to livestream video and audio from their device to people who have the link to the stream. The Express server you'll build will handle both the streamer …

    Read More
  • By Al Kiramoto
    Quickly Enable Your Employees to Work from Home Using Twilio Programmable Voice Enable WFH Quickly Hero

    If your PBX solution does not natively allow for remote working and you need to act fast, this solution is for you. This tutorial shows you how to create a solution with Twilio Programmable Voice and a SIP softphone software or an SIP IP Phone that enables employees to work from their homes.

    Configure the Programmable Voice SIP Endpoint

    You can forward incoming calls to Twilio numbers registered to SIP endpoints, and use a free softphone as an endpoint while working from home, as shown below:

    Flow for how employees can work from home using Twilio

    To get started with the project you will need the following:

    • A Twilio account. Sign up for a free trial account and get a $10 credit.
    • A call-enabled Twilio Phone Number.
    • SIP endpoint (IP Phones (e.g. Obihai) or Softphones (e.g. Zoiper or X-Lite)).

    Create the application

    Go to twilio.com and sign up for a free account or log in to your existing account. …

    Read More
  • By Mia Adjei
    Share a File over a WebRTC Data Channel with Twilio Video Share a File over a WebRTC Data Channel with Twilio Video

    When you're taking part in a video conversation, sometimes you have files you want to share with the other people on the call so that everyone can take a look. This is a great way to collaborate with your friends or colleagues when you're not in the same room or looking at the same screen.

    In this tutorial, you'll build a video application with JavaScript and learn how to use the Twilio Video DataTrack API to share a file over WebRTC with the other participants on the call.

    Follow along below step by step, or if you're interested in skipping ahead to take a look at the code, visit the project repository on GitHub here.

    Let's get started!

    Prerequisites

    • A free Twilio account. (If you register here, you'll receive $10 in Twilio credit when you upgrade to a paid account!)
    • Node.js v14+ and npm installed on your machine. …
    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.