Build a Facebook Messenger bot with Twilio Autopilot, Functions, and SendGrid in Node.js
For event-organizers and business-owners, providing quick 24/7 customer service can be tough. I help run a hackathon for women and non-binary people and our Facebook page has to respond to so many questions, like when the event is happening, if we're looking for new organizing team members, when hacker applications open, and more! Answering these can get repetitive and tedious--if only there was a way for us developers to automate the process!
Never fear, this step-by-step tutorial will show you how to build an intelligent Facebook Messenger bot with Twilio Autopilot, Functions, and SendGrid in Node.js. If the Autopilot assistant gets stuck and the user wants to speak to a human, the assistant will hand off the conversation to the business, connecting them with a human via Email for a seamless customer experience.
Before you get started, you will need to have a Facebook Page for your ...
Generate Songs with Markov Models using Server-Side Swift, Perfect, and Twilio SMS
I like music and coding and one way to make music with code is by predicting words and generating a new song. You can do this with Markov models, as introduced in this last Twilio blog post. Now let's learn how to train a model on a .txt file to generate a song and then generate another song or text via Twilio SMS with server-side Swift and Perfect.
To code along with this post you should have the following:
- A Twilio account to buy a phone number
- ngrok, a tool for putting the app running on your local machine on the web
First, make a new Single View project in Xcode and run
pod initon the command line in the directory where your Xcode project exists to create a Podfile in order to install the Markov Model library via CocoaPods, as further detailed in the first ...
Receive and Respond to Text Messages with Server-Side Swift, Perfect, and Twilio
Perfect is a versatile open source server-side Swift framework and toolset that makes it easy for developers to quickly create server- and client-side apps. Let's see how easy it is to send SMS with Twilio and Perfect.
To follow along with this post we'll need
Install Perfect using the Swift Package Manager. Create a new project directory called
PerfectSMSand then on the command line in your project directory, run
swift package init --type executable swift package generate-xcodeproj
This generates a package with the same name as your current directory.
- Package.swift at the top-level of your project contains your package description and your package’s dependencies.
- Sources/ is home to all your Swift source files, including main.swift, which will be the entry point for your project. It currently prints hello, world to the Terminal.
- Tests/ will contain unit tests you can ...
Intro to Markov Models with Swift
Did you know PageRank, the algorithm Google uses to determine the order of search results, is a type of Markov chain? I first learned about Markov chains and Markov models in my Speech Synthesis and Recognition elective and was amazed at how they are used in speech recognition, music generation, and modeling sequential data to predict the outcome of a basketball game (or almost any competition.)
What are Markov Chains and Markov Models?
The most basic type of Markov model is a Markov chain, a model whose next state is only selected based on its current state. Markov chains are used in genetics, finance, economics, game theory, and other fields. An example of one would be predicting tomorrow's weather by looking only at today's weather, not yesterday's.
Wikipedia defines a Markov model like so:
In probability theory, a Markov model is a stochastic model used to model randomly changing systems ...
Intro to Speech Recognition in Swift via FlyoverKit
One of my favorite computer science electives was Speech Synthesis and Recognition because Natural Language Processing and Computational Linguistics are becoming more widespread (look at Siri!). In this post we will add speech recognition to select famous landmarks with FlyoverKit in Swift. If you haven't seen part one of this multi-part series, check it out on the Twilio blog here.
For this post you will need Xcode 10, a Mac, and a physical iOS device to test the speech recognition features. To follow along with this post make sure to clone the corresponding GitHub repo here as we'll be adding speech recognition capabilities to it. If you just want to make a simple speech recognition app in Swift, you can use the same code but just need to add a button to your ViewController. Name the button locButton, and create a label called placeLbl. Ignore the code in this ...
Travel the World with FlyoverKit in Swift
I was a bit jealous to see some of my peers visit multiple cities and countries after graduation. What if we could build an app that could take us to all those places instead? FlyoverKit is a Swift library that presents you with "stunning 360° flyover views of various monuments on a MKMapView." This post will go over how to see different sights with FlyoverKit by generating a random location at the click of a button. The Sagrada Familia and the Eiffel Tower (shown below) are just a few of the locales we'll be flying over in this post.
In part two of this multi-part series, we will go over how to travel the world with FlyoverKit with speech recognition in Swift.
This post uses Xcode 10 and a Mac which you will need to follow along. Preferably you will also have a physical iOS device to test ...
Parse HTML for Book quotes with Python, Beautiful Soup, and WhatsApp
My first real paid job was working at the local library in high school. This was perfect because I love reading. With a monthly book stipend company perk and more time to read in my post-grad life, I've started using Goodreads to find new books and to keep track of what I've already read.
This post will go over how to parse the Goodreads quotes page. We'll target popular book quotes and quotes with a specific tag received as input from a WhatsApp message and then send a random quote as an outbound WhatsApp message.
Setting Up Twilio API Sandbox for WhatsApp
At the moment, only approved business accounts can use Twilio's WhatsApp API so we need to use the Twilio API Sandbox for WhatsApp to play around. Let's go on over to the Sandbox in our Twilio console. To activate it we must choose a Sandbox number, agree to ...
Re-Introducing Twilio Developer Evangelist Lizzie Siegle
I was so fortunate to have the amazing opportunity to intern on the Twilio developer evangelism team last summer. That mind-blowing and fun experience made my post-graduation decision to join full-time easier so here are four reasons why I am beyond excited to be back at Twilio as a Developer Evangelist in San Francisco.
1. I learned a lot.
Sure, I was a big fan of Twilio intern activities like lunch with our CEO, but I also loved the work itself. I had a blast writing some of the first Haskell posts for the blog and diving into Twilio Video and ARKit in Swift. Speaking about how to make music with Node.js at QueensJS was probably the best talk I'd given and I smile thinking about how much I practiced the talk with my NYC evangelist teammate Sam and mentor Greg hours before.
2. The Evangelism Team
I remember ...
Dive into ARKit on iOS with Swift and Twilio Programmable Video
Augmented reality has is showing up everywhere these days. Apple’s release of ARKit in iOS 11 and Google’s ARCore APIs are guaranteed to accelerate this trend by making augmented reality development accessible to even more developers and users.
We’re especially excited about the combination of augmented reality and real-time communications. In this post we’ll dive into a simple example on how to combine Programmable Video and iOS’s ARKit to share an AR experience with another user. In upcoming posts, we’ll show how to add interactivity to your AR communications apps.
What You Need
All anyone needs to develop with ARKit is
- an Apple device with an A9 or later processor (iPhone 6s or later, iPhone SE, any iPad Pro, or the 2017 iPad)
- iOS 11
- XCode 9 (both of which you can download here.)
We’ll also be using Twilio Programmable Video so you ...
Build a Reddit Slack Bot in Haskell
Do you like Reddit? Do you like bots? If you answered yes to one, both, or neither of those, then you are in luck. This post will go over how to build a Reddit Slack bot in Haskell.
This is the second Haskell post here on the Twilio blog. So if you haven’t read the first one on setting up your Haskell developer environment, check that out here.
What are Slash Commands?
According to the Slack API site, messages beginning with “/” are treated differently from other messages: they “enable Slack users to interact with your app directly from Slack” and all send their messages “…to the configured external URL via HTTP POST.”
In this post, we’ll build a custom slash command that shares a trending programming post from Reddit about whatever you pass it as a command. For example, if you typed /redditbot python, it would return an ...