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 Felistas Ngumi
    Add Facebook Login to your Node.js App with Passport.js Add Facebook login to your Node.js app with Passport.js

    Almost all applications require users to create accounts on their websites in order to use certain services. This repetitive process of setting up new profiles and creating new passwords for every application is not only time consuming, but frustrating, and over time, account management becomes hard remembering credentials for every application.

    Thanks to OAuth, we can use popular social media applications such as Google, Facebook and Twitter to authenticate users. This process makes implementing authentication easier and increases adoption due to existing trust built with the social network. So why not integrate it into your application?

    In this tutorial, I will take you through how to integrate Facebook into your Node.js application.


    You will need the following dependencies to complete this tutorial:

    1. Node
    2. Facebook Developer account
    3. Mongo Db

    Getting Started

    Follow the instructions below in your preferred terminal in order to set up your development environment:

    $ mkdir …
    Read More
  • By Maciej Treder
    Asynchronous JavaScript: Refactoring Callbacks to Promises in Node.js Advanced JavaScript: Refactoring Callbacks to Promises

    If you know how the event loop mechanism works in JavaScript you know how it enables you to work with asynchronous events. You might also know how to refactor your code into separate functions to reduce the amount of nesting associated with a sequence of callback functions. If you work with web APIs you are probably familiar with the JavaScript request library, which is used to perform HTTP calls.

    You can put these skills together to retrieve remote data through an HTTP request and work with the call response asynchronously. But in doing so you’ll probably notice that code has at least one pitfall: the logical order of declared functions is reversed. That makes the code hard to read and maintain.

    With the node-fetch JavaScript library and Promise objects you can reduce nesting, known as the callback “Pyramid of Doom”, and organize your code in a more readable and logical …

    Read More
  • By Maciej Treder
    Asynchronous JavaScript: Advanced Promises with Node.js Asynchronous JavaScript: Advanced Promises with Node.js

    JavaScript Promise objects are a considerable improvement over basic JavaScript callback functions. Promises provide an object that represents both the state of an asynchronous function and the values returned by it. The state indicates whether the promise is pending, fulfilled by a successfully completed operation, or rejected because of an error or other condition. When a promise is fulfilled its value is determined by the asynchronous operation executed by the promise.

    Promises can also be chained together to use the state of settled promises (resolved or rejected) and the promises’ values to control the flow of execution in your program. This is useful when you have a sequence of asynchronous operations to perform that each depend on the results of the previous operation: the next step in the chain isn’t performed until the preceding step is resolved. Chains of promises also include error propagation; errors in a …

    Read More
  • By Phil Nash
    Build a Video Chat with React Hooks Build a Video Chat with React Hooks

    We've seen a video chat built in React on this blog before but since then, in version 16.8, React released Hooks. Hooks let you use state or other React features inside functional components instead of writing a class component.

    In this post we are going to build a video chat application using Twilio Video and React with only functional components, using the useState, useCallback, useEffect and useRef hooks.

    What you'll need

    To build this video chat application you will need the following:

    Once you've got all that, we can prepare our development environment.

    Getting started

    So we can get straight to the React application, we can start with the React and Express starter app I created. Download or clone the starter app's "twilio" branch, change into the new directory and …

    Read More
  • By AJ Saulsberry
    Starting from Zero with Node.js on Windows 10 Starting from Zero with Node.js on Windows 10

    JavaScript may be ubiquitous in the world of web development, but not every developer has been working on web front-end projects, and not every web developer has had the opportunity to get into server-side JavaScript. You might also be new to JavaScript—lots of folks are—and getting a handle on what you can do with the language.

    If your development experience fits into these broad categories your awareness of Node.js may be limited to having heard the name. You might also have heard something about running JavaScript without a browser. You might be wondering whether there’s a place for Node.js in your programming toolbox.

    If you’re ready to launch your Node.js learning mission, this post is for you: it’s a roundup of the essential information you need to get off the launchpad. The explanations below are valid for Windows, macOS, Linux, and AIX, but the instructions apply only to Windows 10. …

    Read More
  • By Alex Baban
    How to Send WhatsApp Messages from Google Sheets with JavaScript and Node.js How to Send WhatsApp Messages from Google Sheets with JavaScript and Node.js

    With Google Sheets (online spreadsheet app from Google) you can easily collaborate in real-time with coworkers, clients, or others. The structure and simplicity of keeping data in rows and columns brings many benefits.

    WhatsApp is a popular app for smartphones that offers a replacement to traditional text messaging systems. It allows you to send messages to another person who is also using WhatsApp. You can send simple text messages and you can also send attachments containing pictures, audio clips or video recordings.

    In this post, you will learn how to create a Node.js application which can be used to send WhatsApp messages to multiple recipients. It uses a Google Sheets spreadsheet as the data source for contacts and Twilio's API for WhatsApp to send the messages.

    We'll take an iterative approach building this application. Let's start with a name and call it "A Message Sender".

    What you'll need

    • A Google …
    Read More
  • By Nathaniel Okenwa
    Live Transcribing Phone Calls using Twilio Media Streams and Google Speech-to-Text Live Transcribing Phone Calls using Twilio Media Streams and Google Speech-to-Text

    With Twilio Media Streams, you can now extend the capabilities of your Twilio-powered voice application with real time access to the raw audio stream of phone calls. For example, we can build tools that transcribe the speech from a phone call live into a browser window, run sentiment analysis of the speech on a phone call or even use voice biometrics to identify individuals.

    This blog post will guide you step-by-step through transcribing speech from a phone call into text, live in the browser using Twilio and Google Speech-to-Text with Node.js.

    If you want to skip the step-by-step instructions, you can clone my Github Repository and follow the ReadMe to get setup.


    Before we can get started, you’ll need to make sure to have:

    Setting up the Local Server

    Twilio Media Streams use the WebSocket …

    Read More
  • By Evangelos Resvanis
    Small tricks: Utilize Temporary Storage under Twilio Functions Small Tricks: Utilize temporary storage under Twilio Functions

    When working with Twilio Functions, you might need to create resources you'd like to store locally for one-off activities. For example, you might like to create a file with user-provided data and send it onto the next step in a flow based on your business needs.

    In Functions, anything that you create on-the-fly gets stored in the temporary folder, which may not be obvious at first.

    In this quick tutorial, I'll show you how to access and utilize the temporary storage under Functions for your purposes. Let's get started.

    Temporary Storage in a Twilio Function

    If you try to perform operations anywhere other than the temporary folder in the underlying OS filesystem you will see something like:

    Error in Twilio Functions read-only file system

    Below I show a Twilio Function writing to and retrieving from the relevant temp folder:

    *  This Function shows you how to reach and utilise the temporary storage under the …
    Read More
  • By Dominik Kundel
    Using Twilio Functions with TypeScript decorative header image with "Using Twilio Functions with TypeScript" on it

    With the Serverless Toolkit we can include the development, debugging and deploying of Twilio Functions, Twilio's Serverless Runtime offering, more tightly into our existing development flows. For example we can add build tools such as TypeScript into our project to perform type checks on our Twilio Functions to catch more bugs during compilation time. In this post we'll look into how we can set up a Twilio Functions project using the Serverless Toolkit and TypeScript.


    Before we can get started, you'll need to make sure to have the following things:

    We'll be using the Serverless Toolkit via the Twilio CLI but you can also use it as a standalone. Check out the docs for more on how to use the Toolkit alone.

    If you don't …

    Read More
  • By Nathaniel Okenwa
    How I avoid getting trapped on the sweltering London Underground with Twilio and Azure Functions Sending SMS Reminders with Azure Functions, Twilio and Node - Blog Header

    There’s nothing worse than being stuck on the trains in London during rush hour when there are delays. Summer is wrapping up in London, but if you want to get a really cheap sauna experience, just head onto the Central Line during peak rush hours on a day when there are train delays. I know this because my miserable self has been trapped, sweltering on a tube with an armpit in my face, more times than I care to remember.

    Crowded Japanese Train

    If only there was a way that I could get a daily warning about the status of the tube lines I use to get to work every day. Well, thanks to Azure functions, Twilio SMS Output Bindings and the handy Transport for London (TFL) API I can make that a reality.

    Before We Begin

    Before we get started, this is what you need:

    • A Free Azure Account
    • An Azure …
    Read More
  • Newer
    Sign up and start building
    Not ready yet? Talk to an expert.