Editor: Christof Ebert SOFTWARE Vector Consulting Services TECHNOLOGY [email protected]

Software Bots

Carlene Lebeuf, Margaret-Anne Storey, and Alexey Zagalsky

From the Editor Bots have become a common user interface for software services. Many people prefer bots to real persons owing to bots’ perceivable passionate “personality.” The Turing test obviously has been passed. However, bots’ involvement in social net- works and fake emails in elections exposed major risks. A lot still must be done, in- cluding some indication that “you’re now talking with a bot.” Here, Carlene Lebeuf, Margaret-Anne Storey, and Alexey Zagalsky discuss current bot technology and present a practical case study on how to use bots in software engineering. I look forward to hearing from both readers and prospective authors about advances in software technologies. —Christof Ebert

FROM COMPUTER PROGRAMS’ intended to fool users into believing Bots and Software earliest days, people have dreamed they’re interacting with a real person, Development about programs that act, talk, and but many bots do have a pleasant, en- Bots are rapidly becoming a de facto think like humans. Such programs gaging personality. interface for interacting with soft- could not only automate tasks that Bots typically reside on platforms ware services. This is due partly to humans perform but also work with on which users work or play with the widespread adoption of messag- humans to solve intellectual tasks other users. They also frequently ing platforms (for example, Facebook that can’t be entirely automated. integrate secondary services into Messenger for social networking Even as far back as 1966, the hope communication channels, providing and for developer communi- was for these programs to pass the a conduit between users and other cation), and partly to the advance- Turing test,1 in which humans are tools. They might fetch or share in- ment of natural-language processing, fooled into believing they’re interact- formation, extract and analyze data, which many bots leverage. But an- ing with an intelligent human rather detect and monitor events and ac- other driver is the prevalence of big than a mere program. tivities in communication and social data, along with machine-learning The terms “,” “chatter- media, connect users with each other algorithms for analyzing data across bot,” and “bot” were interchangeably or with other tools, or provide feed- many domains. Bots provide a con- used to describe the realization of this back and recommendations on indi- venient way for developers to gener- vision quite early on. But now, they vidual and collaborative tasks. ate a UI for interacting with these refer mostly to a conversational-style Here, we discuss types of bots, algorithms and data. UI, an anthropomorphized script, describe some platforms for working Major software companies are or an agent that automates rote and with them, and offer guidelines on recognizing the value bots bring in tedious tasks. Bots typically aren’t how to create and use them. terms of integrating services, users,

18 IEEE SOFTWARE | PUBLISHED BY THE IEEE COMPUTER SOCIETY 0740-7459/18/$33.00 © 2018 IEEE SOFTWARE TECHNOLOGY

and communication channels. Face- in a command- interface. Other • Productivity bots improve user book aims to “replace apps” one bot bots might parse natural language or team productivity by auto- at a time in its messaging platform,2 through text or speech. These bots mating rote or tedious tasks (for while Microsoft claims that “conver- might also embed rich UI controls example, updating calendars or sation as a platform” is the OS of the in a platform that lets users respond silencing notifications). future.3 quickly. • Collaboration bots help users Alexa, Siri, IBM Watson, and Bots can support a pull-based ap- communicate, coordinate, and Google Now all support this shift proach in which users initiate interac- collaborate (for example, con- toward bots. There are also many tion with them (for example, a user necting the right people at the bots in the platforms software devel- invokes the bot using commands such right time). opers use to connect with other de- as “Hey Siri”). They can also support velopers and services, such as Slack, a push-based approach in which they The sidebar provides examples of , and HipChat. initiate the interaction on the basis of how developers use bots to support The transition from command- some system or user context. their work. line interfaces to interacting with Another way to characterize bots bots through messaging tools feels is in terms of their intelligence: Creating and Hosting Bots intuitive to most developers. We see Although simple bots can be built new examples of sophisticated and • Adaptation. Some bots are from scratch and self-hosted, many innovative bots stemming from de- context-aware and might use developers leverage third-party veloper’s needs;4 these examples that context to change how they frameworks to streamline creation are paving the way for bots in other interact with users. and distribution. With the explo- domains. • Reasoning. Some bots follow sion of new tools for bot devel- This situation is inspiring the de- simple logic rules; others use opment, we need to distinguish velopment of bots for users, who are more advanced AI to drive their between the tools for building bots spending increased time in messag- behavior. (creation platforms) and the plat- ing applications and are embracing • Autonomy. Some bots are en- forms on which the bots dwell (dis- bots as an alternative to installing tirely autonomous, some rely on tribution platforms).5 and relying on external apps. How- human input before acting, and Companies such as Micro- ever, bot developers must carefully others use a mixed approach. soft and Facebook offer compre- consider not only where to host bots hensive tooling to support bot and how to create them but also Finally, we can characterize bots creation and distribution. Other when not to use them. according to their purpose: companies provide customized re- sources for specific creation and Botology: Understanding • Generalist bots such as Siri or distribution tasks. Table 1 lists the Bot Landscape Cortana support a range of some common bot platforms and Although the development and wide- simple tasks and direct users to the creation and distribution ser- spread adoption of bots have oc- appropriate external resources vices they use, along with other curred in just a few years, what’s when deeper knowledge is bot technologies. truly surprising are the diverse tasks required. and roles bots have taken on. Instead • Transactional bots work on the Creation Platforms of trying to narrowly define bots or users’ behalf, automatically exe- Creation platforms provide a variety , we embrace their diversity cuting transactions with external of software foundations, frameworks, and look for ways to characterize systems (for example, automati- toolkits, , and other advanced their distinct features. cally making a purchase when a features (for example, natural- One way to characterize bots is price level is reached). language processing, search, and im- through their interaction model. • Informational bots fetch infor- age processing). These platforms Some bots support a domain-specific mation for users (for example, can be distribution-platform-specific language in which users interact gathering insights about stocks or produce bots that are deployable with bots using specific commands or providing weather updates). across multiple platforms, such as the

JANUARY/FEBRUARY 2018 | IEEE SOFTWARE 19 SOFTWARE TECHNOLOGY

DEVELOPMENT BOTS IN ACTION

Software developers have been early adopters and proponents of bots because they’ve recognized bots’ potential for both enhanc- ing individual and team productivity and significantly improving software quality. Chatbots bring awareness and transparency to the communication channel and enable nontechnical team members to engage with operations without needing domain expertise (for example, by using a bot for deployment). For example, Sendwithus (sendwithus.com), a company that provides transactional email services, has adopted bots as part of software development. With 25 employees and two office locations (Victoria, Canada, and San Francisco), Sendwithus uses Slack as the central hub for its communications and DevOps, and bots fulfill several development tasks. For example, the bots

•• set reminders for team members (using Slackbot); •• manage and coordinate customer support and help-desk tickets (using Help Scout; www.helpscout.net); •• facilitate real-time communication with users visiting the Sendwithus website (using Olark piped into Help Scout; www.olark .com); •• manage physical communication (for example, through short message service and phone) and send to the company’s communications hub (using Twilio; www.twilio.com); •• accommodate custom tasks (for example, ordering a team’s lunch via a message on Slack) (using Hubot; hubot..com); •• automatically share resources and documents (for example, screenshots) within the team (using Dropbox and Google Drive); •• manage and track code migration and deployment from within Slack, raising team awareness when this happens, because this might cause errors during migration (using a customized bot with Heroku integration); •• monitor and index runtime warnings, errors, and exceptions (using Papertrail; papertrailapp.com); •• notify the appropriate team members when errors and exceptions occur (using Sentry; sentry.io/welcome); and •• track and aggregate the service status of other service providers the company depends on (using StatusPage; statuspage.io).

Developers can expect to see more and more bots being introduced to support their workflow and development-related activi- ties. In addition, companies such as Sendwithus are recognizing their dependence on Slack and the bots that perform many of their daily tasks, which have become crucial to the running of the company.

Microsoft Bot Framework, Botkit, Distribution Platforms overcoming the cold-start user prob- and Pandorabots. Distribution platforms dictate where lem many new applications face. De- The provided services range from and how users access bots; many velopers should consider not only the documentation and code templates center around messaging or social size of the platform’s user base but to no-code-required bot-building networking (for example, Messen- also the general user demographics interfaces such as Chatfuel. Many ger, , and WeChat). Other plat- and the access costs for users. These popular creation platforms also forms are domain-specific channels platforms define and standardize have vibrant developer ecosystems— for developers (for example, Slack, how users interact with bots and developers can connect with these Teams, and HipChat). These plat- have built-in support for commands, online communities to obtain exper- forms support human–bot, bot–bot, natural language, speech, and even tise in the form of tutorials, articles, or even system–bot interactions. rich UI controls. The method of in- discussions, and support. Other gen- Selecting the right distribution teracting with a bot strongly influ- eral bot development communities, platform can benefit developers in a ences the user’s experience and the such as Botmaker’s Slack group and variety of ways. Some platforms pro- types of tasks users can perform. the Chatbot Magazine community, vide access to a user base. Launch- Many distribution platforms of- are hotbeds for discussions on a vari- ing a bot on an existing platform fer mechanisms for users to discover ety of bot-related topics. gives developers a head start in and try out new bots. Like Apple’s

20 IEEE SOFTWARE | WWW.COMPUTER.ORG/SOFTWARE | @IEEESOFTWARE SOFTWARE TECHNOLOGY

Table 1. Features of popular bot creation and distribution services.*

Distribution services Creation services

User base Monetization Software foundations (bots collecting Cost for Interaction payment from Cost or Tools or Developer Platform Size users mechanisms Discovery users) license technologies Platforms community

Slack (slack.com) 6 M daily • Free • Text App No Free • Web API Slack Yes & 2 M • Paid • Commands directory • RTM API paid users • GUI • App (2017) blueprints

Microsoft Teams 125 K Paid • Text Bot No Microsoft Bot Framework (teams teams • Commands directory .microsoft (2017) • GUI OSS • Bot Builder Multiple Yes .com • Bot (Bot Connector Framework • Service Portal) integrations • Azure Bot Service Skype 3 M • Free • Speech Bot Yes • .NET (C#) (www monthly • Paid • Text directory SDK .skype users • Commands • Node.js .com) (2017) • GUI REST SDK

HipChat (www.hipchat 90 K paid Paid • Text Marketplace ? No No No No .com) users • Commands (2017) • GUI

Messenger (www 1.2 B Free • Text • Facebook Yes Free • WebHooks Facebook No .messenger.com) monthly • Commands pages • APIs users • GUI • Bot • Design Kit (2017) Explorer • Wit.ai • QR codes • RTM

WeChat/Weixin (web 889 M Free • Speech QR codes Yes No No No No ..com) monthly • Text users • Commands (2016) • GUI

Telegram ( 100 M Free • Text Bot store Yes OSS • Bot API Telegram No .com) monthly • Commands • Telegram users • GUI API (2017) • BotFather

Kik (www.kik.com) 15 M Free • Text • Bot shop No Free API Kik No monthly • Commands • QR codes users • GUI (2017)

Other technologies Bot-hosting Extending Bot Payment SDKs Bot-building tools Online platforms interactions directories • PayPal • Api.ai communities • Alexa • Google Cloud • BotList • Stripe • Pandorabots • Botmakers • Echo • Watson • ChatBottle • Chatfuel • Chatbots.org • Cortana Conversation • Botwiki • Rebotify • chatbotsmagazine • Line • Alexa Voice • Botkit .com • Android • Luis.ai • Gupshup • Stack Overflow • • MindMeld • OnSequel • Cisco Spark • Flow XO • Messages • Botsify • • BotMock • Intercom • BotMan • • Twilio • SMS • Web

*The table’s bottom row lists additional bot development technologies, by category. This list isn’t comprehensive; it’s just a sampling of popular technologies for bot builders to leverage. RTM = Real Time Messaging, OSS = open source software, REST = Representational State Transfer, SDK = software development kit, and SMS = Short Message Service.

JANUARY/FEBRUARY 2018 | IEEE SOFTWARE 21 SOFTWARE TECHNOLOGY

App Store, some platforms offer vir- lead to information and interruption many platforms have specific guide- tual “bot stores” where users browse overload—issues bot designers must lines for bots to follow; for example, for bots. Third-party sites (for ex- watch out for. Facebook recommends that its bots ample, BotList and ChatBottle) follow a set of simple conversational also provide online catalogs of bots Users Should Always Know guidelines.8 for many popular distribution plat- What to Expect forms, making it easier for devel- In contrast to the Turing bots pro- Personality Matters More Than Looks opers to promote and market their posed in the 1950s, bot developers Because bots are predominantly text bots. Mature distribution channels should make it clear to users that based, how they use language—and have monetization features that let they’re interacting with a bot, not even how they’re named—can influ- bots safely collect payments from another human. Similarly, if a bot ence users’ perceptions of their per- users, which is particularly useful passes control to a human (for exam- sonality, role, and capability. This for people developing transactional- ple, when the bot can’t understand might seem surprising given that style bots. a command or answer a question), users should know they’re interact- the user should be aware of this, and ing with a mere program. However, Insights on Creating and the handover should be graceful and early research has shown that a bot’s Using Bots transparent. This ensures that users personality changes how users in- Bots are rapidly becoming perva- don’t lose trust in the systems sup- teract with it. Even if a bot can ef- sive: we interact with them in cars, ported by bots and that users under- fectively accomplish a user’s tasks, at home, in entertainment devices, stand why control is being passed to people won’t adopt it if they find it and at work. And, as we discuss in them. Also, the bot’s purpose—what boring. The bot’s language should be the sidebar, bots play a sophisticated it can and can’t do—must be evident casual, accessible, friendly, and fun. and increasingly significant role in and match user expectations. Bots should expect users to test their software development projects. We abilities and respond accordingly. need to learn from these early adop- User–Bot Interaction Should Be But too much personality might tion experiences to find out not only Optimized not be a good thing, either. Accord- what works well but also what might Ideally, users’ interactions with bots ing to Slack, “a little goes a long go wrong. Here are insights we’ve should be smooth and frictionless. way.”9 Done right, bots can accen- gained from our research that devel- This is achievable if designers care- tuate a company’s brand or commu- opers should consider when creating fully plan conversational flows, es- nicate a company culture (such as and using bots. pecially for conversational bots. For playfulness). example, bots might need to repeat Amplification Doesn’t Replace commands so that users know that Bots Should Do No Harm Collaboration the bots are listening. Bots must also Isaac Asimov’s three laws of robot- Bots are frequently used in group or be able to detect dead ends in conver- ics state that robots must not harm collaborative settings to automate sations and prompt users by giving humans, must obey orders, and must tasks that normally require human hints on how to continue interaction. protect themselves.10 These rules can interaction. But removing collabora- Some bots could incorporate UI also apply to software bots. But per- tion opportunities can hamper cre- elements to reduce the number of haps, with the complexity and rapid ativity and productivity. Rather than user clicks required and to make growth of bots in our software eco- replacing collaboration, bots can the conversation more efficient. Im- systems, these rules are too simple. be used to reduce friction in com- plementing global input checks for Simple mistakes could have dev- munication or task coordination. common navigational keywords astating effects, and protecting a For example, bots could provide (for example, help, back, cancel, user’s privacy might be difficult. We transparency on task progress, make start over, and exit) can help avoid can expect to see a code of ethics for team goals more visible, link experts the creation of “stubborn” or “clue- human–bot interactions in the near with novices, and build team trust less” bots.7 Tools such as BotMock future. (One organization working and cooperation.6 However, the can help you prototype the user’s on this is the Partnership on AI; www poor design or overuse of bots might “journey through your bot.” Finally, .partnershiponai.org.)

22 IEEE SOFTWARE | WWW.COMPUTER.ORG/SOFTWARE | @IEEESOFTWARE SOFTWARE TECHNOLOGY

In the meantime, developers should carefully consider how their bots might be misused, intentionally CARLENE LEBEUF is a master’s student in computer science and or unintentionally. Many bots are al- a researcher at the University of Victoria. Contact her at clebeuf@ ready seen as malicious, so building uvic.ca. user trust might also pose a challenge. For now, many bot creation and dis- tribution platforms provide basic principles or best practices for bot de- sign (for example, the platforms from Microsoft,7 Slack,9 and Facebook8). MARGARET-ANNE STOREY is a professor of computer science But developers wishing to use bots or at the University of Victoria. Contact her at [email protected]. create them for users must be careful which bots they bring to life. ABOUT THE AUTHORS THE ABOUT

e anticipate a rapid in- crease in developers us- Wing and creating bots. Indeed, Joel Splosky of Stack Over- ALEXEY ZAGALSKY is PhD candidate in computer science at the flow claims that “developers are University of Victoria. Contact him at [email protected]. writing the script for tomorrow”11 by providing insights, through their ability to innovate and lead by exam- ple, into how technology can be used in other domains. Developers have the unique opportunity to not only use bots in their knowledge work but also lead the way on how bots can solve both their and others’ needs. of Software Eng. (FSE 16), 2016, .com/en-us/bot-framework/bot pp. 928–931. -design-principles. References 5. M. Vakulenko, “Messenger vs. Skype 8. “Designing for Messenger,” Face- 1. A.M. Turing, “Computing Machin- vs. Slack vs. Telegram: How to Spot book, 2017; developers.facebook ery and Intelligence,” Mind, vol. 59, the Winners,” Mobile Lifestyle, .com/docs/messenger-platform no. 236, 1950, pp. 433–460; www 6 Apr. 2016; medium.com/mobile /design-resources. .jstor.org/stable/2251299. -lifestyle/messenger-vs-skype-vs 9. “Voice and Tone: Communicating 2. M. Murgia, “Can Facebook Messen- -slack-vs-telegram-how-to-spot-the for Clarity,” Building Great User ger Kill Off Apps?,” The Telegraph, -winners-adc34b4ca066. Experiences on Slack, Slack, 2017; 15 Nov. 2015; www.telegraph.co.uk 6. C. Lebeuf, M.-A. Storey, and A. .slack.com/best-practices /technology/facebook/11996896/Can Zagalsky, “How Software Developers /voice-and-tone. -Facebook-Messenger-kill-off-apps Mitigate Collaboration Friction with 10. I. Asimov, “Runaround,” Astound- .html. Chatbots,” presentation at Talking ing Science-Fiction, Mar. 1942, pp. 3. “Conversation as a Platform,” video, with Conversational Agents in Col- 94–103. Channel 9, 25 Mar. 2016; channel9 laborative Action Workshop, 2017 11. J. Spolsky, “Developers Are Writing .msdn.com/Events/Build/2016/C902. Conf. Computer-Supported Coop- the Script for the Future,” blog, 4. M.-A. Storey and A. Zagalsky, “Dis- erative Work and Social Computing 9 Dec. 2016; www.joelonsoftware rupting Developer Productivity One (CSCW 17), 2017. .com/2016/12/09/developers Bot at a Time,” Proc. 24th ACM 7. “Principles of Bot Design,” Micro- -are-writing-the-script-for-the SIGSOFT Int’l Symp. Foundations soft, 4 Aug. 2017; docs.microsoft -future.

JANUARY/FEBRUARY 2018 | IEEE SOFTWARE 23