PHP developers of all experiences are painfully aware that your script may not execute if it takes longer than 30 seconds to process. There’s nothing worse than failing to do proper testing and finding that your code doesn’t scale in production.
In a previous tutorial, I shared how you can calculate the script execution time of sending SMS messages. At the conclusion we discovered that each message takes about .33 seconds to send, meaning that PHP’s 30 second timeout will allow you to send 90 messages before failure.
So what do you do when you want to send more than 90 messages? What about 1000?
Unfortunately, if you want to send bulk SMS (or WhatsApp) messages using the standard Programmable Messaging API, it’s not going to scale in PHP. Great engineering practices would suggest that you break apart your requests and run batches asynchronously. However, Twilio engineering has …
Writing Node.js applications with TypeScript means you can take advantage of the TypeScript type system and tooling. We've seen on this blog how to send an SMS message with Node.js, but let's have a look at how to do this with TypeScript.
What you need
To follow this tutorial 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 SMS messages
- Node.js installed
Once you've got all that, let's dive into the code.
Getting started with TypeScript
Let's start a new TypeScript project for this example. In a terminal, run the following commands to create a new project directory and create a package.json file.
mkdir send-sms-with-typescript cd send-sms-with-typescript npm init --yes
Now we need to install some dependencies. We'll need TypeScript in our …
In my previous tutorial on how to send an SMS with PHP’s Mezzio framework, we covered sending a text message in PHP. In this tutorial, we’ll expand on the application that we built so that it can also reply to an SMS when it is received.
To follow along with this tutorial you should have the following:
Note: If you cloned the repository, make sure that you add your Twilio Account SID, Auth Token, and phone number to the .env file in the root directory of the project. You will also need to run
composer install to install existing dependencies for the project.
Regardless of the approach that …
What is an SMS Survey?
An SMS Survey allows you to capture user feedback via text message. Customer feedback is a critical part of doing business and SMS surveys are a cost-effective method of collecting data quickly and efficiently. With an SMS survey, you can reach your customers in a timely manner in order to organize user information into actionable insights.
When you create an SMS survey, customers can text your number to access the survey or, if you have permission, you can send the survey with SMS directly to their phones.
To better understand how to use SMS surveys, we chatted with the Twilio Customer Experience (CX) team to get their expert opinions. Let’s get started—read on for best practices for building SMS surveys.
Best Practices for SMS Surveys
According to the Twilio Customer Experience (CX) team, SMS surveys are best used for timely and recent events since SMS …
Sending notifications from your application means you can deliver your users relevant, timely and personalised information about their accounts or activity. You may have already built SMS notifications into your application, perhaps by following this Node.js tutorial on ETA notifications, but can we improve the experience? Your customers may want to receive notifications that are easily referenceable later or choose the channel through which they receive alerts.
In this post, we will explore how email notifications can work alongside SMS notifications for account alerts, and walk through how to build them into your application using the Twilio SendGrid Email API.
What you'll need
To follow along with the code and build the application in this post you will need:
- A Twilio account (if you don't have one yet, sign up for a new Twilio account here and receive $10 credit when you upgrade)
- A Twilio SendGrid account …
Picture the situation. You are working on a task that requires you to immediately connect to an on-call employee. You dial their phone number, but it hits their voicemail. Who do you call to resolve the situation?
This use case is not uncommon in organisations that utilise shifts or rosters for their workforce management, and it usually results in the employee having to manually search an on-call roster document for another phone number to call. This process is fine for some use cases, but imagine that the situation was time-critical and needed an immediate response, where every minute and second was critical. Would you want this process to be manual? Probably not.
If you are following along and want to implement this solution, you will need …
One useful and common way to use Twilio is to create a phone number which forwards to your real phone. You can hand out the Twilio number to colleagues or customers and take business calls on your personal phone without worrying about handing out your real phone number. This also gives you a lot of options for how to handle these calls - you have the full power of Twilio at your disposal.
In this post I'll show you how to create a voicemail system that will jump in when your cell number is busy, or when you don't answer the call. It will play a message to your caller, then record their message and text you a link to the recording when it's done.
Primer: How Twilio Handles Calls
When someone dials your Twilio number, an HTTP request is sent to a URL that you provide. The …
In this article, you’ll learn how to use Twilio Programmable SMS with Python and Flask to build a bot that permits a user to send a text message containing a location, country code, and date, and receive a satellite image for that time and location in response via NASA’s Earth APIs. In the image below, you can see how the bot was used to provide an image of New York City that was captured on January 1st, 2021.
- Python 3.6 or newer. You can download a Python interpreter here.
- A Twilio account with an SMS-capable phone number. If you are new to Twilio, you can create a free account.
Navigate to the directory where you’d like to create your project, and run the following commands:
mkdir satellite-image-bot cd satellite-image-bot
Next, create a virtual environment to isolate dependencies:
python3 -m venv venv
Then, activate the …
TransferWise is a digital bank that can save us from dread expensive bank fees. I have an account and love the service, but I’m really concerned about bad actors defrauding my card or login credentials.
What if TransferWise would send proactive alerts on debit transactions? Then I could act quickly to lock it down and minimize losses in case anything bad happens.
Twilio to the rescue!
Preparing the requirements
To follow this tutorial, you will need the following:
Python: we’ll use Python3.9 (latest stable), but the code should also run on Python3.6+. To download and install, follow instructions on the official website. Python runs on Windows, Linux/UNIX and MacOS.
TransferWise account: if you …
Home Assistant is an open source home automation system that allows you to control Internet of Things devices like smart bulbs, smart switches and sensors. In this article, I’ll show you how to use Twilio SMS to have your Home Assistant (HA) alert you via SMS when it detects problems in your home.
To follow along with this post, you’ll need:
- A Twilio account - if you don’t already have one, sign up for a free Twilio trial account that you’ll use later to test the notification system we’ll be setting up.
- A working Home Assistant installation, with some sensors connected to it. I used a Zigbee water sensor (an Aqara Water Leak Sensor, specifically) for this tutorial but any sensor that you have connected to your Home Assistant will also work - you could also use a garage door sensor and get alerted when the garage …