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 Sam Agnew
    Identifying Phone Number Line Types with Twilio Lookup and Node.js Copy of Generic Blog Header 2 (3).png

    While the Twilio Messaging API won't charge you for attempting to send an SMS to a landline number, identifying the line type of a phone number can be useful for other reasons. A lot of businesses won't let users sign up with VoIP numbers, for example.

    Let's walk through how to identify a phone number's line type with Twilio Lookup and Node.js.

    Setting up

    For this post you will need:

    To install the Twilio npm module, navigate to the directory where you want this code to live and navigate to the directory where you want this code to live and run the following command in your terminal to create a package for this project:

    npm init --yes
    

    The --yes argument just runs through all of the prompts that you would otherwise …

    Read More
  • By Sam Agnew
    Identifying Phone Number Carriers with Node.js and Twilio Lookup Copy of Generic Blog Header 2 (2).png

    Trolls and bad actors sometimes use phone numbers from free online providers to create fake profiles for making spam calls. Twilio's Lookup API helps you identify the carrier behind the phone number to learn which users have real mobile numbers.

    Setting up

    To lookup a phone number you will need:

    To install the Twilio npm module, navigate to the directory where you want this code to live and navigate to the directory where you want this code to live and run the following command in your terminal to create a package for this project:

    npm init --yes
    

    The --yes argument just runs through all of the prompts that you would otherwise have to fill out or skip. Now that we have a package.json for our app, let’s install the Twilio module …

    Read More
  • By Tilde Thurium
    Sending Bulk Emails 3 Ways With Twilio SendGrid And Node.js Sending Bulk Email 3 Ways With Twilio SendGrid and Node.js by Tilde Thurium, Twilio Developer Evangelist

    Sending a single email is great, but one of the big advantages of email is quickly reaching a wider audience. Today I’ll show you three ways to send bulk emails with Node.js and SendGrid. Just for fun, let’s say you’re a JavaScript developer who works at a donut shop. You need a way of letting the customers who have signed up to your email list know when fresh donuts have come straight out of the oven.

    Prerequisites

    Setting up your environment

    First, create your API key from the …

    Read More
  • By Dominik Kundel
    Sending SMS from GitHub Actions Decorative header image "Sending SMS from GitHub Actions"

    At GitHub Universe 2019, GitHub announced that Actions have been moved into General Availability. We are very excited about this launch and as part of it have launched the Twilio SMS for GitHub Action. In this blog post we'll look at how you can get started with that and some use cases for it.

    Getting Started

    You can find the Twilio SMS Action in the GitHub Marketplace. Before using it, you'll need a Twilio account. Sign up for free to get your account details.

    Once you have an account, we'll need two additional things.

    Get a phone number

    If you haven't gotten a phone number yet, head over to the Phone Numbers section of the Twilio Console and select your preferred phone number. Make sure it has SMS capabilities enabled.

    screenshot of Twilio Console with arrow pointing at SMS capability checkbox in Phone Numbers screen

    Once you have that phone number, make sure to note it down somewhere. We'll need it later when …

    Read More
  • By Tilde Thurium
    SMS Affirmations With Twilio And Flic Buttons SMS affirmations with Twilio and Flic buttons

    Earlier this year I built an affirmations button with Twilio Internet of Things. When I’m feeling insecure or anxious (which is often), the button lets me ground myself with a physical gesture and receive a reassuring text message in return.

    A wooden box with a blue button on the top sits on a table. The box has turquoise, teal, and neon yellow stripes.

    The box holding the button looks cool but it's not as portable as I’d like, since it contains a Raspberry Pi. As a Twilio Developer Evangelist, I’m on the road writing code fairly often. I needed something that takes up less space in my luggage.

    Today I’ll show you how to build a more portable affirmations button with Flic.

    What is a Flic button?

    Flic buttons are hardware buttons that are small enough to fit in a pocket. Out of the box, they can be configured to do various things when pushed, such as:

    You can …

    Read More
  • By Stefan Judis
    How to secure Twilio webhook URLs in Node.js Copy of Photo blog Header 3.jpg

    How to secure Twilio webhook URLs in Node.js

    Twilio’s APIs allow developers to reinvent communications with things like programmable phone calls, SMS or intelligent chatbots. Developers can build applications to interact with their users and react to their responses. To respond to events like incoming messages, you can define a webhook URL. A webhook is an HTTP request that Twilio performs to find out what the reaction to a Twilio even like an incoming SMS should be. Your defined HTTP endpoints have to respond with a Twilio-understandable configuration language called TwiML (Twilio Markup Language).

    These endpoints can be hosted anywhere as long as they’re available publicly and accessible by Twilio’s infrastructure.

    Three ways to secure your webhook URLs

    Let’s assume you built a rating application that allows users to rate an event they’re at by sending an SMS to a certain number. Every incoming SMS to your number …

    Read More
  • By Felistas Ngumi
    Send Serverless Emails using SendGrid and Twilio Functions Serverless Emails

    Software developers are moving away from the expensive, traditional, server-based architecture platforms and shifting towards the trendy serverless applications. This new way of developing applications is event-driven, cheaper in comparison to the operating costs of maintaining a server, offers a quick way of deploying functions and allows businesses to pay for only what they use.

    In this tutorial, you will learn how to send emails using Twilio Functions and SendGrid.

    Project Setup

    To complete this tutorial you will need the following:

    1. SendGrid Account
    2. Twilio Account
    3. Twilio CLI
    4. Node Version 8 and above.

    Getting Started

    After creating a free account on Twilio, install the Twilio CLI which enables you to  develop and deploy functions locally. To install the tool, run the following command in your console window.

    $ brew tap twilio/brew && brew install twilio
    

    NOTE: This command is specific to Mac users. If you are on a different platform, …

    Read More
  • By Sam Agnew
    Updating Twilio phone calls in real time with Node.js Copy of Generic Blog Header 2.png

    Twilio use TwiML to programmatically define the actions that take place during a phone call. But this doesn't have to be a rigid script that every call follows. You can also use the Twilio REST API to update these phone calls in real time.

    For example, given a Call SID, a unique identifier to a phone call resource, you can redirect which TwiML the phone call is using with the following code:

    const client = require('twilio')();
    
    client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
      .update({method: 'POST', url: 'http://demo.twilio.com/docs/voice.xml'})
    

    Let's walk through how to set up a Twilio phone number to receive phone calls, and test this out for yourself.

    Development Environment Setup

    Start by making sure you have the right software installed and set up that you'll need to use for the rest of this post. Throughout this post, you will need: …

    Read More
  • By Felistas Ngumi
    Serverless SMS Messaging using JavaScript and Twilio Functions Serverless SMS Messaging using JavaScript and Twilio Functions

    Function As A Service is a solution that allows developers to develop, deploy, and run event-driven functions in the cloud that are fully managed. Without the need for maintaining infrastructure, "serverless" architecture is achieved. In this tutorial, you will learn how to send Twilio Programmable SMS using the new Twilio CLI.

    Project Setup

    You will need the following items in order to get started:

    1. A Twilio account
    2. Twilio CLI
    3. Node Version 8 and above.

    Getting Started

    First, install the Twilio CLI. I'm currently using version 1.8.1. Run the following command in your preferred terminal if on a Mac:

    $ brew tap twilio/brew && brew install twilio
    

    If you are on a different platform, you can find the setup instructions here.

    To confirm a successful installation of the CLI has occurred, type twilio in a new terminal session and the output below should appear.

    Twilio CLI console

    Login to your Twilio account by …

    Read More
  • By Maciej Treder
    Asynchronous JavaScript: Introducing ReactiveX and RxJS Observables async-js-reactivex-rxjs-observables.png

    Reactive Extensions (ReactiveX) are one of the most widely-adopted set of tools in programming today. ReactiveX libraries for JavaScript and other languages provide a way to operate on sequences of data as if they were events. This is a convenient way to handle data from asynchronous sources like web APIs: your programs can react to data as it is emitted from the source without tightly coupling the code that uses the data with the code that gets the data.

    In this post you’ll learn about the fundamental concepts of ReactiveX programming and get hands-on experience doing ReactiveX programming with RxJS for JavaScript. You’ll learn how to retrieve data asynchronously, manipulate it as it arrives, and handle errors. You’ll also see how RxJS Observables compare to JavaScript Promises.

    Introducing the ReactiveX API and the RxJS library

    Reactive Extensions, known as ReactiveX, is an application programming interface (API) enabling programming languages …

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