Send Images and Files via WhatsApp Using Ruby
With the Twilio API for WhatsApp we can send messages to WhatsApp numbers. Those messages can be plain text or include files like images, audio and even PDFs up to 5MB. Let's see how to do so using Ruby.
Things you'll need
If you want to code along with this post, you'll need a few things:
- A Twilio account (sign up for a free account now)
- Ruby and Bundler installed
- The WhatsApp Sandbox Channel installed (learn how to activate your WhatsApp sandbox)
Got all that? Let's get coding then!
Create a new directory for your project and use Bundler to initialise a new
mkdir whatsapp-messages cd whatsapp-messages bundle init
Open up the new
Gemfileand add the
# frozen_string_literal: true source "https://rubygems.org" gem "twilio-ruby"
Install the gem by running
bundle installon the command line.
Sending your first WhatsApp message
Create a file in your project ...
Building Resilient Service-to-Service Communications in ASP.NET Core with Polly, the .NET Resilience Framework
Service-to-service communication is becoming more and more common, but we know the network has never been reliable and that other people's code has bugs. Packets are lost, exceptions are thrown, and requests fail; it will happen to your application—to all applications!
Using the Polly Resilience Framework you can easily retry a failed request, no messy for loops or try catches needed. Just a few lines of code and your applications will never be the same!
This post shows how to make reliable requests to an unreliable "remote" service with almost no overhead.
You’ll start with a “remote” web api application that returns errors 75% of the time. Then you’ll build a “local“ web API application that calls the remote one (of course receiving errors three quarters of the time).
Finally, you will add Polly to the “local” application to perform retires on failed requests. With a few ...
How Twilio SendGrid Ensures 99.97% of 50B Monthly Emails are Phish-Free
Twilio SendGrid processes over 50 billion emails every month, meaning we touch over half of the world’s unique email users on a rolling 90-day basis. With such massive scale and reach, it’s imperative that we protect recipients’ guarded information and credentials from dangerous phish.
A platform’s security and ongoing battle against bad actors only becomes an issue when defenses fail. But open platforms like Twilio SendGrid and other public cloud providers are under attack every day of the year.
In fact, 83% of InfoSec professionals said they experienced a phishing attack in 2018, an increase from 76% in 2017. And with the average cost of a phishing attack for a mid-size company in the neighborhood $1.6 million, it can make or break a business that doesn’t have the necessary security protocols in place.
Twilio SendGrid’s Inbox Protection Rate measures the success of its compliance ...
Save Voicemails to Dropbox with Twilio Voice API, PHP, and Laravel
There are a number of ways to record calls with Twilio. Whichever method you decide to use, it is very important to keep the storage space used below the chargeable limit to prevent added cost. To achieve this, you need to backup up and delete your voice recording occasionally. Storage over 10,000 minutes per project is billed by the minute, once a month.
In this tutorial, we are going to discuss how to automate recordings management with recording status callback, download recordings programmatically via the REST API, save the recordings in Dropbox and finally delete the recordings programmatically via the REST API.
You will need the following technologies and tools:
- Twilio Account
- Dropbox account
- Composer globally installed
- PHP development environment Laravel
To follow along, you should have a basic understanding of PHP. Knowledge of the Laravel framework is not required. You can choose to use any other ...
Start a new Twilio Functions project the easy way
If you're building a Twilio project you will inevitably need to run some code in response to an incoming webhook request. One of the easiest ways to do this is with Twilio Functions, our serverless platform for running Node.js. Recently my colleague Dominik released the
twilio-runpackage that makes it easier to develop, test and debug Twilio Functions locally.
I wanted to make it even easier to get started with a Twilio Functions project, so I built a project generator called
Let's take a look at how you can easily start and develop a Twilio Functions project using
There are a few ways you can use
create-twilio-function. The easiest is if you have
npmversion 6 or higher. You can check this out on the command line with:
$ npm --version 6.9.0
If you don't have an up to date version of ...
Build Your Own Personal Training Exercise Bot with Python, Zappa, AWS and Twilio SMS
Heading into the new year I wanted to set myself up to be successful living a healthier life. Saying you’re going to do something is easy, following through with action is the hard part. To ensure success being more physically active I needed help with a seemingly simple question, what should I do for a workout? With so many options available I wanted to spend less time thinking about what I’m going to do and more time doing the actual workout.
I needed a prescriptive solution to dictate a workout each day that would be balanced with enough daily variation to avoid becoming redundant. Most of the fitness apps available allow tracking of workouts, but lack the prescriptive component I was looking for.
Unsatisfied, I decided to roll-up my sleeves and build my own SMS-enabled personal trainer bot I call twilio-fit. Twilio-fit designs a workout on-demand that incorporates ...
Send Images and Other Media via WhatsApp Using Node.js
The Twilio API for WhatsApp allows you to not only send text-based messages to WhatsApp numbers but also send and receive media messages. This allows you to send images (JPG, JPEG, PNG), audio files and even PDFs up to 5MB. Let's see how we can do this using Node.js.
First Things First
Before we get started, make sure you have:
- A Twilio account (sign up for free)
- Node.js and a package manager like
- The WhatsApp Sandbox Channel installed (learn how to activate your WhatsApp sandbox)
- Set your Account SID and Auth Token as environment variables
If you want to try this out make sure to set up a new project by running:
mkdir whatsapp-media-messages cd whatsapp-media-messages npm init -y
Sending Your First Media Message
twiliohelper library by running:
npm install twilio
Create a new file called
index.jsand place the following code ...
Nomorobo Helps Stop Fake IRS Calls
“Hello. This is Agent Bloom calling you from tax crime investigation unit of Internal Revenue Services. This is to inform you that IRS has issued an arrest warrant against you and within one hour you will get arrested from your house...”
Sound familiar? Every day, thousands of people are victimized by robocalls like this, particularly during tax filing season.
Go where the money is: criminals on the phone
Criminals used to rob people with guns. Now they use the phone.
They pretend to be technical support and fool you into paying thousands of dollars to “fix” your computer. They pretend to be the Chinese Consulate and threaten (in Mandarin, of course) to have you deported. They pretend that you’ve won a free cruise or an all-inclusive vacation when all you’ve really “won” is a smaller bank account.
At Nomorobo, protecting people and businesses from these and other kinds ...
Hacking Twilio Client to Play Videos Over the Phone
How can I play a Youtube video over WebRTC?
Is there a way to play dynamic audio over a Twilio Voice call?
Many people have asked about playing dynamic audio over the phone using Twilio. And while TwiML does allow you to create dynamic templates based on user input, it doesn’t help me if I want to start and stop audio or play a video over the phone. I could imagine some enterprising person using these powers to prank the robocallers, spammers and even the occasional pesky family member. In this post, we are going to look at one quick way to inject any MediaStream into a phone call using the WebRTC-based Twilio Client SDK.
Prerequisite: This post starts off at the very end of the Twilio Client quickstart, so if you haven’t completed that it is recommended you do so now. Of course, these concepts could be ...
Deploying and Running Angular ASP.NET Core Video Chat Applications on Microsoft Azure
With Twilio Programmable Video you can add robust video chat functionality to web applications built with Angular and ASP.NET Core. With the Microsoft Azure App Service you can host your video-enabled apps on a fully managed, enterprise-grade cloud platform. Deployment and configuration are easy and take just minutes.
You will learn how to publish your application to the Azure App Service, and securely configure the app on Azure to use the Twilio Video Chat API with the App Service settings. You’ll be able to try out the production applications’ video chat features and verify that it’s ...