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
  • By Sam Agnew
    COVID-19 tracking via SMS with Twilio and Python Copy of Language template - PYTHON2.png

    Around the world, the Coronavirus Pandemic is affecting people and their communities. It might impact different areas in varying ways, but the virus causing the COVID-19 disease has reached a level of global pervasiveness. The situation is constantly evolving so it can be hard to keep track of.

    If you are in the United States, there is a COVID Tracking Project which provides up-to-date statistics for the nation as a whole and for each individual State on the number of tests administered, positive cases, and the death toll. The project also provides this data in the form of an API.
    You can text the phone number +1 (864) 77-STATS which is +1 (864) 777-8287 with a particular US State abbreviation to get the current statistics for that State, or any other message to get the nation-wide data.

    Let's walk through how to build a text-message-based COVID-19 tracker in Python …

    Read More
  • By Sam Agnew
    How to build a Conference line with Twilio Functions Copy of Language template - node2 (2).png

    Another conference call, another app, another PIN, another log-in. Joining conference calls shouldn’t take more than simply dialing a phone number. Lets walk through how you can quickly build a conference line anyone and everyone can use with Twilio Functions.

    Setting up a Twilio Function

    You’ll need to create a Twilio account if you don’t already have one. From the Twilio Functions page in your Twilio Console, create a new Function and select the “Blank” template as seen in this image:

    Create a Twilio Function

    Give your function a name and a path.

    Give your function a route

    Writing code to handle incoming calls

    Now replace the default code in the function with the following code for our app, and click save:

    exports.handler = funct …
    Read More
  • By Sam Agnew
    How to build a Conference line with Twilio and Node.js Copy of Language template - node2 (1).png

    Another conference call, another app, another PIN, another log-in. Joining conference calls shouldn’t take more than simply dialing a phone number. Lets walk through how you can quickly build a conference line anyone and everyone can use with Node.js.

    Development Environment Setup

    Start by making sure you have the right software installed that you'll need to use for the rest of this post. You will need:

    Here is a good guide to follow in general if you are going to be doing more with Twilio and Node.js and have any more questions.

    To install these npm modules, navigate to the directory where you want this code to live and run the following command in your terminal to create an npm …

    Read More
  • By Sam Agnew
    5 Ways to Make HTTP Requests in Node.js using Async/Await Copy of Language template - node2.png

    Making HTTP requests is core functionality for modern languages and one of the first things many developers learn when acclimating to new environments. When it comes to Node.js there are a fair amount of solutions to this problem both built into the language and by the community. Let’s take a look at some of the most popular ones.

    A few years ago, I wrote a similar post on this topic. But now that async/await functionality is more pervasive and mainstream in JavaScript code, making network requests is more straightforward than ever. On top of that, Request, the previously most popular HTTP library for Node has been deprecated. So it's time for an updated guide!

    As in the other post, we’ll be using NASA’s Astronomy Picture of the Day API as the JSON API that we are interacting with in all of these examples because space is the coolest …

    Read More
  • By Sam Agnew
    Automated Headless Browser scripts in Node.js with Puppeteer Copy of Language template - GENERIC3 (1).png

    Sometimes the data you need is available online, but not through a public API. Web scraping can be useful in these situations, but only if this data can be accessed statically on a web page. Fortunately for developers everywhere, most things that you can do manually in the browser can be done using Puppeteer, a Node library which provides a high-level API to control Chrome or Chromium over the DevTools protocol.

    Let's walk through how to use Puppeteer to write scripts to interact with web pages programmatically. In this example we'll use the Native Land Digital tool, an awesome project built to help people learn more about their local indigenous history. In this case, an API does exist, but it only takes location data in the form of geo-coordinates rather than a more user-friendly address. We'll write code to programmatically type in an address and figure out which …

    Read More
  • By Sam Agnew
    Web Scraping and Parsing HTML with Node.js and Cheerio Copy of Generic Blog Header 1.png

    The internet has a wide variety of information for human consumption. But this data is often difficult to access programmatically if it doesn't come in the form of a dedicated REST API. With Node.js tools like Cheerio, you can scrape and parse this data directly from web pages to use for your projects and applications.

    Let's use the example of scraping MIDI data to train a neural network that can generate classic Nintendo-sounding music. In order to do this, we'll need a set of music from old Nintendo games. Using Cheerio we can scrape this data from the Video Game Music Archive.

    Getting started and setting up dependencies

    Before moving on, you will need to make sure you have an up to date version of Node.js and npm installed.

    Navigate to the directory where you want this code to live and run the following command …

    Read More
  • 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 Sam Agnew
    Identifying Phone Number Carriers in Python with Twilio Lookup Copy of Generic Blog Header 2 (1).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 Python module, navigate to the directory where you want this code to live and make sure you create a virtual environment. Once you have a virtual environment activated, run the following command to install the dependencies:

    pip install twilio==6.31.1
    

    After this you should be good to write some code!

    Looking up a carrier with Twilio

    You can query the Twilio Lookup API for information about a phone number. There are two Type …

    Read More
  • By Sam Agnew
    Scheduling Tasks in Python with Redis Queue and RQ Scheduler Copy of Generic Blog Header 3.png

    Executing specific code at specific times is a common task in Python. There are a variety of tools to solve this issue, but RQ Scheduler is a lightweight, elegant solution built on top of another tool with a low barrier to entry called Redis Queue.

    With RQ Scheduler, all you need to do is create a Scheduler object and provide it with a Python datetime and a function to execute, along with any arguments you want to pass to the function:

    from datetime import datetime
    
    from redis import Redis
    from rq_scheduler import Scheduler
    
    from some_module import arbitrary_function
    
    scheduler = Scheduler(connection=Redis()) # Get a scheduler for the "default" queue
    scheduler.enqueue_at(datetime(20 …
    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.