Code, Tutorials and Hacks
この記事はTwilio Developer AdvocateのDominik Kundelがこちらで執筆した記事を日本語化したものになります。
If you're a developer who is building out a website that allows users to upload image files for reasons such as updating a profile picture, sharing images with other users, or utilizing other multimedia files, you will find yourself wondering, "what's the safest way to save their data?".
You could store the files directly in the server’s file system, integrate with APIs from cloud storage platforms, or you can learn how to store the information in your database!
In this tutorial, you will learn about blob (binary large object) data and why you need to convert your multimedia files to binary objects in order to store them properly in a database. Then you will learn how to retrieve the blobs and convert them back into regular files for use by your application.
Let's get started!
- Python 3.6 or newer. If your operating system does not provide a Python …
We've seen how to send an SMS with TypeScript and how to receive and reply to SMS messages with TypeScript. Now let's create something we could use! If you're into investing, you can never have too many ways to check in on the stock market, so let's build an application you can send a stock symbol to and get back a stock quote.
What you will need
To build the application in this post you will need:
- A Twilio account (if you don't have one yet, sign up for a free Twilio account here and receive $10 credit when you upgrade)
- A Twilio phone number that can send and receive SMS messages
- Node.js installed
- ngrok …
GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. It was developed internally by Facebook in 2012 before being publicly released in 2015. It allows clients to define the structure of the data required, and the same structure of the data is returned from the server, therefore preventing unnecessary data from being returned.
GraphQL has three primary operations: Queries for reading data, Mutations for writing data, and Subscriptions for automatically receiving real-time data updates. A GraphQL server provides clients with a predefined schema – a model of the data that can be requested. The schema serves as common ground between the client and the server.
To follow along with this tutorial you should have …
Recently a 200,000 ton container ship named the Ever Given has become stuck in the Suez Canal, halting one of the world's busiest waterways and disrupting global supply chains. And it looks like it might take weeks to move it. Luckily for those on the edge of their seats, with the Marine Traffic API we can access the location of marine vessels programmatically.
My coworker Kelley Robinson used this to create a Twilio phone number that you can text to see if the Ever Given is still stuck. Try it out by texting +1 (586) 800-BOAT, which is +1 (586) 800-2628, to get the status of the situation.
Let's walk through how you could build your own version of this, using Twilio Programmable Messaging, Flask, and the Marine Traffic API.
Setting up your environment
Make sure to have your Python environment set up before we get started. …
Twilio APIs make it possible to add communication features to your application, but to consume these APIs you have to keep track of your spending and ensure your account balance stays above zero.
Your balance is available in the main page when you log in to your Twilio Console, but having to actively monitor your account is tedious and inconvenient.
To get started with this tutorial, you’ll need the following:
- Node.js installed on your machine
- A free Twilio account (sign up with this link and get $10 in free credit when you upgrade your account)
Create a Node.js project
From your …
A chatbot is a software application used to automate interactions and conversations with people via messaging platforms. Common uses of chatbots include request routing, customer service, and information gathering.
Serverless architecture is a design pattern where applications are broken up into individual functions that can be invoked and scaled separately. The goal is to abstract the process of building and running applications from the complexities of developing and deploying infrastructure required to run them.
In this tutorial, I am going to show how you can build a serverless WhatsApp chatbot using Twilio’s WhatsApp API and Python functions in Google Cloud. The chatbot will accept a country name and return information about it. The country data will be retrieved from the REST Countries public API.
To follow this tutorial you need to have:
- Python 3.7 or newer. If your operating system does not have a pre-installed Python interpreter, you …
Asynchronous code has increasingly become a mainstay of Python development. With asyncio becoming part of the standard library and many third party packages providing features compatible with it, this paradigm is not going away anytime soon.
Let's walk through how to use the aiohttp library to take advantage of this for making asynchronous HTTP requests, which is one of the most common use cases for non-blocking code.
What is non-blocking code?
You may hear terms like "asynchronous", "non-blocking" or "concurrent" and be a little confused as to what they all mean. According to this much more detailed tutorial, two of the primary properties are:
- Asynchronous routines are able to “pause” while waiting on their ultimate result to let other routines run in the meantime.
- Asynchronous code, through the mechanism above, facilitates concurrent execution. To put it differently, asynchronous code gives the look and feel of concurrency.
So asynchronous …
Twilio Programmable Voice allows you to make and receive voice calls in your software application. In this tutorial, you’ll see a demonstration of how to use Programmable Voice to make a voice call directly from a Node.js app.
- A free Twilio account (register here and receive $10 in Twilio credit!)
- Node.js installed on your machine
- A phone that can make phone calls, to test the project
Set up your environment
In this section you are going to set up a brand new Node.js project. To keep things nicely organized, open a terminal or command prompt, find a suitable place and create a new directory where the project you are about to create will live:
mkdir nodejs-phone-call cd nodejs-phone-call
Install the Twilio Node Helper Library from your command line with the following:
npm install twilio
Configure Twilio credentials
To be able to access the Twilio service, your Node.js application …
Have you ever sent contact information from a phone to another ? If so, you already have encountered vCard, the standardized format for Virtual Contact Files. These .vcf files are super helpful for contact imports.
In this blog post we will create a vCard with Ruby and send it to our phones with Twilio Programmable SMS. By the end of this tutorial you will have a Ruby script that generates vCard files and another one that sends vCards to your contacts.
I will generate my vCard and send it to my personal phone number. You can add me to your contacts by using your phone number or create your own vCard and send it to whoever you want.
To follow along with me, you will need: