Save User Input via Slackbot with Twilio Autopilot, Functions, and MongoDB
This step-by-step tutorial will go over how to build a Slackbot using Twilio Autopilot and Twilio Functions, saving the user's answers to a MongoDB Atlas database. If you haven't seen part one of this two-part blog series yet, check it out here and make sure you have your Autopilot Slackbot and Function set up before continuing below.
Let's receive and save the data the user gave us. On the MongoDB Cloud Atlas homepage, make a free account. Once logged in, make a new cluster.
Under Cloud Provider & Region, select a cloud provider. For this post, I decided to use Azure. Then select a region (one with a free tier may be preferable.)
For Cluster Tier, you can then select "M0 Sandbox"--your account will only be able to have one cluster at this level. Now you can scroll to the bottom and click the green "Create Cluster" ...
Call Twilio Functions from iOS in Swift
There are many things you can do from iOS but sometimes, for example, you may need to make a web request to fetch information. With Twilio Functions you can focus on writing the code that matters without having to maintain a server. This tutorial will show you how to set up a Twilio Function that returns a Pokemon joke or two and then call that Function from an iOS application.
Before you get started, you'll need
- a Twilio account to create a Twilio Function
- Xcode installed to make a rudimentary iOS app to call the Function
Make a Twilio Function
The Twilio Function in this tutorial will return a simple hard-coded Pikachu joke. To make that Function, from your Functions page, click the red "+" button to make a new Function.
If this is your first Function, you'll click ...
Build a Slackbot with Twilio Autopilot
1. Go to the Autopilot Console and click "Create a new Assistant."
2. Give it a name and click "Create". In this case, I wanted to make a Slackbot to handle event sponsorships so I put "Dev-conf-bot".
To make your Autopilot Assistant a Slackbot, you must do three things.
1. Make a new public Slack channel. First click the plus button next to Channels on the left-hand side bar of your Slack client.
Then, name the channel. Make sure it is public as shown below, and click "Create Channel".2. Create a new outgoing webhook integration in Slack to send a POST request containing message details to a URL ...
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 ...