Instructor: Jon Zmikly
Week of June 1
Description
Welcome to this week’s module on Chatbots and AI. With advances in artificial intelligence (AI) and automation changing the way we interact with information, more and more news organizations are implementing chatbots to produce and consume digital content. This module will teach you how to plan, code and execute an effective bot — a software program that responds to humans like a human, either through text or speech. Your chatbot will be able to interact with an audience via SMS, Amazon Alexa, Facebook Messenger or the web, and you’ll learn how to effectively analyze and predict conversation.
Objectives
- Understand the purpose and usage of chatbots
- Comprehend the different types of bots
- Plan, code and execute an effective bot
- Appreciate the role of artificial intelligence across applications
Once you make your bot, please share it in our #chatbotsai Slack channel so we can all see each other’s work!
What Are Chatbots?
As you may have guessed, the term “bot” is derived from “robot”. While some form of mechanical automation has existed since Ancient Greece, it wasn’t until the introduction of electricity, and now digital technology, that advancements in automation have exponentially increased. The scope of this module will not focus on physical robots like Rosie from the Jetsons, or Boston Dynamics’ amazing Atlas robot. Instead, we will focus primarily on software that is programed to automate digital activity. You may be most familiar with search bots (also called “spiders”), which are web programs used to “crawl” through indexes of data to find the most relevant search results for a query. This happens every time you search on Google or Bing. Other bots, such as malicious spambots, can be written to harvest email addresses from a user’s contact list or hack a network system. Just like the robots we may see in other industries, such as manufacturing or consumer products, bots are built to perform mundane or repetitive tasks to make human life more efficient.
Beyond simple automation, more advanced bots use the power of machine learning to interact with users on a more “human” level. For example, you may be familiar with digital assistants such as Apple’s Siri or Amazon’s Alexa, which provide services like setting appointments and playing a user’s favorite tunes. This module will focus on these advanced bots, known simply as chatbots, and we will explore different use cases within the media industry. We will look at reasons for implementing automated conversation within a brand, business or organization, as well as consider implications for their use.
To learn more about chatbots and potential uses, check out the following examples:
- Infomagical: This was a week-long project about information overload produced by WNYC. Using a conversational SMS text bot, users could sign up to get daily text messages about ways to reduce digital “noise” and learn to be more mindful of the information they intake on a daily basis. The “bot” was able to check in with people throughout the day and gather feedback on the program’s effectiveness.
- ElectionLand: ProPublica also used SMS texting to gather information from voters during the 2016 Presidential Election. Users could report problems with voting booths and communicate to the bot how long lines were. ProPublica also used Facebook Messenger to gather information on whether or not Facebook users were experiencing hate speech.
- UNICEF has created a chatbot called U-Report that helps people in developing nations speak out about their most urgent basic needs.
- Quackbot was created by Quartz and DocumentCloud “to give journalists convenient access to tools that make their work easier, better, and a little more fun.” Within the Slack interface, the bot performs tasks helpful for reporters, editors and news producers such as capturing screenshots of webpages or pointing out clichés within stories.
- Entertainment: More and more, major entertainment companies like Disney and celebrities like Jim Gaffigan are creating interactive, personalized bot experiences to extend their brands and engage their audiences.
Why Use Chatbots?
As digital technology continues to expand and develop, the use of artificial intelligence (AI) has become a polarizing subject (especially within the media industry). Generally, users feel totally comfortable with a digital bot performing a simple, routine task such as retrieving search results or delivering a weather forecast. However, when a user begins to communicate with a bot for more advanced interactions, such as booking a flight or even learning about news, conversation can quickly become much more complex. With tech companies like Facebook building AI to negotiate and news organizations using bots to write full articles, we are beginning to see many different uses and purposes to bots. This is exactly why it’s so important for brands or businesses to first understand why it might integrate a chatbot before ever getting started. According to this article by Anadea, a software company specializing in intelligent mobile experiences, there are generally four reasons users might interact with a bot:
- Productivity: Chatbots provide the assistance or access to information quickly and efficiently.
- Entertainment: Chatbots amuse people by giving them funny tips, they also help killing time when users have nothing to do.
- Social and relational factors: Chatbots fuel conversions and enhance social experiences. Chatting with bots also helps to avoid lonliness, gives a chance to talk without being judged and improves conversational skills.
- Curiosity: The novelty of chatbots sparks curiosity. People want to explore their abilities and to try something new.
In addition, there are two types of chatbots:
- Simple chatbots work based on pre-written keywords that they understand. Each of these commands must be written by the developer separately using regular expressions or other forms of string analysis. If the user has asked a question without using a single keyword, the robot can not understand it and, as a rule, responds with messages like “sorry, I did not understand”. The first bot you create (below) will probably fall into this category.
- Smart chatbots rely on artificial intelligence when they communicate with users. Instead of pre-prepared answers, the robot may access a natural language library to interpret your meaning, or make predictions about the conversation. Smart chatbots can “infer” or “learn” as the user communicates with it, allowing for more complex conversation.
In this module, we will focus on “smart” chatbots. In doing so, we must consider a user’s needs and reasons for interacting with a bot. Read the article below to learn what differentiates a “good” bot experience from a “bad” bot experience. Doing so will help us, as bot creators, understand our own motivations for building these intelligent systems, as well as the users for which we’re developing them.
Natural Language Processing
You can imagine one of the biggest challenges to building an effective “smart” chatbot is the ability to communicate with humans. Because each person may come to a chatbot with a different expectation, bots must be able to understand quickly what a user is trying to learn or accomplish. In addition, with different dialects, idioms and overall intentions, having a complex conversation with a bot can be difficult, to say the least. Obviously, in and of themselves, computers can not understand human language. Therefore, we must tell the computer exactly how to handle human responses and conversations. This is known as Natural Language Processing (NLP). The goal of NLP is to allow computers to understand and speak language as humans do.
Read the following articles about NLP and how it is vital in building smarter chatbots:
Conversation Design
In addition to understanding language, computers must also be ready to handle entire conversations and dialog flow. And as we humans know, conversations can get quite complex. Using NLP and careful planning, bots must be programmed to “remember” the choices user makes along the way and adapt to different scenarios. It’s much like any type of “create your own adventure” type of game. The user has a limited number of choices he/she can make, and a computer reacts to that input. The same is true for chatbots. In order for computers to provide efficient, effective and human-like interactions, it’s important for us as communicators to plan, strategize and predict where a conversation might go.
This is known as conversation design, or a Conversational User Interface (UI). Conversational UI is being used as an extension (or replacement) of graphical user interfaces (GUI). Most GUIs (websites, for example) can be difficult to navigate or find the information a user might be searching for. Instead, with CUIs, a user can simply ask a question or interact with a bot to get specific, personalized information. For more discussion on Conversation Design, see the links below:
- FastCompany: Conversational Interfaces, Explained
- ChatBotsLife: Conversational UI: Writing Chatbot Scripts Step by Step
Build A Bot
To get some experience, we will creating our very own bot, and instructions are below. You can also follow along with the video tutorial below.
- Create an account at rundexter.com (signing up for an account is free).
- Press the “Start Walkthrough” button to go through the process of finding a theme (Choose the Blank Template), and then go through the 12-step walkthrough to see how Dexter works.
- Add two or three questions, with answers, and experiment with the interface for a bit. Use a + sign to provide a potential question the user might ask, and use a – sign to provide a response the bot will use to answer that question. Important note: All potential inputs (+ sign) MUST be lowercase. Answers can be upper/lowercase. Your interface should look something like this:
- When you are done, click the Publish button in the top right (select Current Topic). Then, choose the Deploy icon in the top navigation menu. It will look like this:
- On the Deploy page, make sure the “Website Embed” choice is selected (by default, it already should be), and be sure to Deploy your project by turning “on” the toggle button at the top. It should look like this:
- Copy the code it provides you, and paste it into the <head> tag of a new Glitch.com project (or the same one you used in the Web Design module).
- Test your bot out by clicking the link provided to you in the Share button. You should see a small icon in the bottom right of the page. Using the interface, type in the questions you prompted in the bot. Using the example screen shot above, I would type What is your name? to get the response “Jon”.
- Share the link to our #chatbotsai Slack channel so we can all see each other’s bots!
Now that you’ve built your very first basic bot, it’s time to get a little more advanced. Beyond simple triggers and responses, Dexter offers many other conditionals. For example, when a response for a trigger is an asterisk (*), the bot will push back whatever the human just said. An example is below:
+ hi
– *
In this case, when a human types in “hi”, the bot will answer back, “hi”. In addition, you can put this command to work in a more applicable way. For example, if the bot asks, “What is your name?” it can respond with “Hi, ___” and it will show the user’s name.
+ hi
– Hello! Welcome to the Best Bot! What is your name?
+ *
– Hi,
Give it a try on your own bot, and see what happens! You can also make conditional statements, such as the following:
+ hi
– Do you like dogs? (Y or N)
+ *
– == y ==> Dogs are great!
– == n ==> Cats are better.
In this example, when the human responds to the bot’s question of “Do you like dogs?” with a y, the bot will send back “Dogs are great!”. Likewise, when the human responds with a n, the bot will respond with “Cats are better.”
This is very simple logic. And obviously, there are many weaknesses. For example, what if a human types in “no” instead of “n”. Or, what if you wanted the bot to remember users’ responses for later use, and not right away? The above example will only return a user’s name if they typed it in their most recent message. Dexter offers many other features, such as variables, buttons, multimedia and other options, so we can provide a human with a more complex and meaningful conversation. Watch the video tutorials below to learn more about Dexter!
Messenger Bots vs. Voice Bots
So far, most of our bot-making has focused on messenger bots; specifically, we have deployed the chatbot to work within a website. However, Dexter can also deploy your bot to Facebook Messenger, SMS or other text interfaces. As we’ve seen, these spaces allow for the use of buttons, videos, images and links, and they are widely accessible — almost everyone has access to the web to view the chatbot you made already. And with the ubiquity of smartphones and texting, messenger chatbots seem like a natural fit for most users.
But as we’ve learned in previous modules, chatbots also exist within voice interfaces and can be highly useful in a hands-free capacity. With the onset of digital assistants like Siri and Internet-connected homes, voice-activated bots are becoming more popular than ever. Google has even built an assistant that will make calls for you. As bot creators, it is more important than ever to think about the end user and how your audience will interact with the bot. For example, the flow and direction of a text-based interaction can be vastly different from a voice interaction. It becomes all the more important to understand whether we’re writing a bot for the eye or for the ear, and to plan that well in advance. To learn more about the pros and cons of each of these platforms, visit the website below.
Ethical Considerations
As AI technology continues to develop and grow, it’s important to understand the implications and effects of our intelligent inventions. Thanks to innovations in deep machine learning, we now see computers that can “learn”, adapt and predict like never before. You may have heard about Microsoft’s Twitter bot gone wrong, or the fact that Facebook shut down an artificial intelligence engine after developers discovered it had created its own unique language that humans couldn’t understand. Other bots, like Tess, are digital psychologists who can help solve your personal problems. DoNotPay is the world’s first robot lawyer. And some people go even as far as creating virtual girlfriends/boyfriends. With the wide range of uses and capabilities, a strong ethical framework must be built into these smart technologies as well.
Think about the bot you created this week. Even though it’s not human, it does have human-like responses and users will interact with it as though it was a human. Depending on the bot, you may have to think about questions like, “Will my bot have a gender?” Should a bot have a gender? What about race? These questions, along with many others, require us to consider much more than just 1’s and 0’s in binary code. Check out the following articles to learn more:
- What are some ethical considerations chatbots raise?
- The code of ethics for AI and chatbots that every brand should follow
Especially for content producers and media professionals, having an ethical framework is key, and these values should be baked into any product created by a media professional, whether that’s a news story, a broadcast or even a bot. Read the article below to hear why Rob High, CTO of IBM Watson thinks that order to keep AI ethical, it needs to be transparent.
The Director of R&D at Quartz, Emily Withrow, spoke on the topic of Building Trust through Technology at the #mediaX2018 Conference. Check out the video below to hear how she navigates these interesting waters (the video is set to start at the 16-minute mark on purpose):