Book Image

Building Bots with Node.js

By : Eduardo Freitas, Madan Bhintade
Book Image

Building Bots with Node.js

By: Eduardo Freitas, Madan Bhintade

Overview of this book

<p>The bots are taking over and we're all for it! Messenger-based bots will be the dominant software UI for the next generation of applications – even Slack, Telegram, and Facebook are driving a new approach where "threads are the new apps."</p> <p>This book shows you how to create work automation bots that interact with users through Slack, e-mail, Skype, Twitter, and more using Node.js. You'll learn to create conversational UIs for your Node.js apps, and then use those UIs to provide workflow automation tools.</p> <p>You will be shown how to handle customer service requests that come in through messenger systems – this includes interpreting the natural language to reveal the user's intent and respond accordingly. You will also learn how to automate processes that involve several people, such as processing holiday requests, arranging meetings, or sending updated reports on time.</p> <p>By the end of this book you'll have the knowledge to create bots that can handle and manipulate documents, URLs, and other items of content. Harness the power of bots and your organization will reap the benefits.</p>
Table of Contents (16 chapters)
Building Bots with Node.js
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

Bots everywhere! Conversational and chat-enabled apps are well positioned to become the next big platform and how apps are developed. Advances in machine learning, natural conversational APIs have taken off and many high tech and software giants are embracing conversational bots and provide APIs that allow developers to create applications that seamlessly integrate into these conversational platforms, enhancing user’s experience. This book explores some of these platforms in and simple and intuitive way, allowing developers to quickly come up to speed with them.

What this book covers 

Chapter 1 , The Rise of Bots – Getting the Message Across, introduces and explains the growing importance of bots in today’s world and also teaches you how to create an SMS bot app using the Twilio messaging platform.

Chapter 2 , Getting Skype to Work for You, explains how to use the new Microsoft Bot Framework in order to create a Skype bot.

Chapter 3 , Twitter as a Flight Information Agent, teaches you how to create a Twitter bot application that interacts with the Air France KLM API in order to retrieve flight details.

Chapter 4 , A Slack Quote Bot, explains how to create a Slack bot application that sends inspirational quotes to users.

Chapter 5 , Telegram-Powered Bots, shows you how to develop a bot that will provide you the sentiments of messages on Telegram using Telegram APIs.

Chapter 6 , BotKit – Document Manager Agent for Slack, teaches you how to use Slack APIs with BotKit to provide documents at the fingertips of team members collaborating in Slack.

Chapter 7 , Facebook Messenger Bot, Who's Off – A Scheduler Bot for Teams, shows you how to set up a Facebook Messenger Bot that can be used to schedule team meetings, or to see who is off when with the help of the Microsoft Azure platform and services.

Chapter 8 , A Bug-Tracking Agent for Teams, teaches you how to use the IRC platform and DocumentDB for a bug-tracking bot.

Chapter 9 , A Kik Salesforce CRM Bot, explores how to use Force.com API and a Kik to create a Salesforce CRM Bot.

What you need for this book 

The following requirements are recommended for maximum enjoyment:

  • A good Internet connection

  • A fairly modern computer or laptop (preferably Windows-based, but not necessarily)

  • A fairly good dose of creativity, imagination, and willingness to learn and explore new concepts

Pretty much all software and APIs mentioned in this book are free of charge and can be downloaded from the Internet.

Who this book is for 

This book is for anyone that knows some Node.js and would like to explore how a bot can be written with the various existing conversational platforms available today. The book is written in an easy-to-understand way that is suitable for developers of all kinds, from novice to very experienced ones. Some know-how of Node.js is recommended.

Conventions 

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The session object contains the information that Skype passes on to the bot app, which describes the session data that has been received and from whom. Notice that the session object contains properties such as message and text."

A block of code is set as follows:

bot.dialog('/', function (session) { 
  if (session.message.text.toLowerCase().indexOf('hi') >= 0){ 
    session.send('Hi ' + session.message.user.name +  
     ' thank you for your message: ' + session.message.text); 
  } else{ 
    session.send('Sorry I dont understand you...'); 
  } 
});

Any command-line input or output is written as follows:

mkdir telegrambot
cd telegrambot

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on the Register a bot option in order to create and register your Skype bot. Once you've done that, you'll see the following screen:"

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code 

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support  and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Building-Bots-with-Nodejs. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/BuildingBotswithNodejs_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.