Create your very own chatbot

Image for post
Image for post

Chatbots are programs that communicate in some way with humans. They can be very basic, responding to keywords or phrases, or use something like Twilio Autopilot to take advantage of natural language understanding (NLU) to provide a richer experience and build out more complicated conversations.

In this tutorial, we are going to see how easy it is to get started building chatbots for WhatsApp using the Twilio API for WhatsApp and the Ruby web framework Sinatra. Here’s an example of the conversation we’re going to build:

Image for post
Image for post

What You’ll Need

To build your own WhatsApp bot along with this tutorial, you will need the…


Image for post
Image for post

The Web Speech API has two functions, speech synthesis, otherwise known as text to speech, and speech recognition, or speech to text. We previously investigated text to speech so let’s take a look at how browsers handle recognising and transcribing speech with the SpeechRecognition API.

Being able to take voice commands from users means you can create more immersive interfaces and users like using their voice. In 2018, Google reported that 27% of the global online population is using voice search on mobile. …


Some things you do as a developer can work for years only to turn around and bite you when you least expect it

Image for post
Image for post

These are the things that you wish another developer had told you early in your career so that you never had to make the mistakes. This article is about one of those things, and if you’re reading this, consider it my warning to you.

File paths look like strings. You have a number of directories and maybe a file name with an extension at the end. You separate the directories and files with a / character and the result looks like /path/to/file. So you can treat them like strings, joining them or concatenating them until you pass them to another file method that is used to read from or write to the file. These were my thoughts from just a few months ago. …


Autocomplete, proper keyboards, and more

Image for post
Image for post

There are plenty of opportunities for friction in the user experience when logging in, particularly while entering a two-factor authentication code. As developers, we should be building applications that support the need for account security but don’t detract from the user experience. Sometimes, it can feel as though these requirements are in a battle against each other.

In this piece, we’ll look at the humble <input> element and the HTML attributes that’ll help speed up our users' two-factor authentication experience.

The Default Experience

When you implement two-factor authentication for a web application, perhaps with the Authy two-factor authentication API, you’ll need a form for your user to input the one-time password you’re going to send them. …


Image for post
Image for post

It happened! I’ve been waiting for the moment I needed to send a fax since Twilio launched the Programmable Fax API back in 2017 and this week it finally happened! I won’t go into detail about what I needed to send, but it’s safe to say the medical profession could consider their communication choices for the future.

I could have sent the fax by uploading a PDF to Twilio Assets and using the API explorer, but that wouldn’t have been as fun as over-engineering an entire application to send and track the fax to make sure it arrived and be prepared for any future fax situations. …


Image for post
Image for post

So you’ve decided to speak at a developer conference? You have a story you want to share with your peers-how you built something, how you learned something new, how you became a better developer and how everyone else can too-but you need to find a stage on which to share this story.

There are hundreds of developer conferences out there, covering everything you could think of in our industry. Knowing they are there is nice, but finding out which are coming up and are have an open call for proposals (CFP) is the challenge. …


Image for post
Image for post

Recently I’ve been refactoring the tests for a gem I maintain, and I needed to test that it sets the right cookies at the right time. But the cookies in use in the gem are signed cookies and that caused a slight hiccup for me. I’d never tested the value in a signed cookie before and it wasn’t immediately obvious what to do.

So I thought I would share what I found out in case it helps.

Cookies on Rails

In Rails applications there are three flavours of cookies available: simple session cookies, signed cookies and encrypted cookies. …


Image for post
Image for post

When your application sends emails it is useful to know what happens to those emails, like whether it has been delivered or opened. Or, sometimes more importantly, whether it bounced. The Twilio SendGrid email API doesn’t just send emails, it can also send you events via webhook that tell you what happened to your emails.

In this post we’ll build a small application using Ruby on Rails to send emails and update their status based on the Twilio SendGrid event webhooks.

What you’ll need

In order to build this application along with this post, you will need:


Build a video chat application using Twilio Video and React with only functional components

Image for post
Image for post

We’ve seen a video chat built with React on the Twilio blog before but since then, in version 16.8, React released Hooks. Hooks let you use state or other React features inside functional components instead of writing a class component.

In this post, we are going to build a video chat application using Twilio Video and React with only functional components, using the useState, useCallback, useEffect, and useRef Hooks.

What You’ll Need

To build this video chat application, you will need the following:

Once you’ve got all that, we can prepare our development environment. …


Image for post
Image for post

The Web Speech API has two functions, speech synthesis, otherwise known as text to speech, and speech recognition. With the SpeechSynthesis API we can command the browser to read out any text in a number of different voices.

From a vocal alerts in an application to bringing an Autopilot powered chatbot to life on your website, the Web Speech API has a lot of potential for web interfaces. Follow on to find out how to get your web application speaking back to you.

What you’ll need

If you want to build this application as we learn about the SpeechSynthesis API then you'll need a couple of…

About

Phil Nash

Developer evangelist for Twilio. I write JavaScript and Ruby. Probably listening to ska punk right now.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store