building enterprise chat bots

17
Building Chat Bots !!

Upload: vasu-jain

Post on 28-Jan-2018

261 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Building Enterprise Chat Bots

Building Chat Bots !!

Page 2: Building Enterprise Chat Bots

What is a Chatbot, Slack, SlackBot ..

Chatbot• A Chatbot is a computer program which conducts a conversation

via audio or textual methods. • E.g. • Voice based bots : Alexa, Siri

• Text based chat bots: Slack, Facebook, Skype.

Slack• Slack is a cloud-based messaging app for team collaboration. Got

very popular due to app integrations. Slack teams consist of channels, users (humans and bots)

• Similar Instant messenger platforms are Skype, Facebook Messenger, Whatsapp

SlackBot ??

©2017 PayPal Inc. Confidential and proprietary.

Page 3: Building Enterprise Chat Bots

Bot Platform to order from marketplacess.

TacoBot within the Slack

Twitter Bot to order Pizza by Tweeting Pizza Emoji

Early disruptors in bots domain

Page 4: Building Enterprise Chat Bots

PayPal announced their own Slackbot in early 2017 for to use PayPal within Slack.

Followed by PayPal in 2017…..

Page 5: Building Enterprise Chat Bots

What can a Slackbot do

Slack Bot interact with a user on a Slack team by

1. Connecting to Slack’s Real time Messaging (RTM )API and opening a web-socket connection with Slack. • Bot user will Monitor and process channel activity• Post messages and react to users• Web API to post formatted messages, attachments,

emoji• Make messages interactive with buttons

2. Listening to Slack Events via HTTP based Events API aka Slack Webhooks . Configure events at https://api.slack.com/events

Page 6: Building Enterprise Chat Bots

Developing a SlackBot

Two Kinds of Slack bot you can develop :

Custom Bots • Custom for a team’s requirements• Can be used for company’s process automation etc.

Bot Users attached to Slack App • For distribution to other teams• Governed by OAuth permission scopes• Distributed via Slack Button or Slack Appstore

Apps generally start as custom bots and evolve into a Slack App.

©2017 PayPal Inc. Confidential and proprietary.

Page 7: Building Enterprise Chat Bots

Programming a Slack bot

1. Make authenticated API calls and consume Slack RTM API

2. Use existing library or SDKs (such as node-slack-client) https://github.com/slackhq/node-slack-client

3. Botkit Framework : • Does heavy lifting for Slack API interaction• Open source bot builder platform for Node.js• Targets Slack, Facebook, Twilio currently• http://howdy.ai/botkit

Using Botkit to develop a custom Bot using Slack RTM API.

Page 8: Building Enterprise Chat Bots

CODE WALKTHROUGH

Page 9: Building Enterprise Chat Bots

Project Structure

Clone: https://github.com/vasujain/slack-bot-github • node_modules/ contain botkit module – generated by npm install• package.json specifies your project details and dependencies• index.js is the entry point• Util.js for utility functions• Config.json for string sensitive data • Npm-debug.log created by default for error logging• Lib/ directory containing slack libraries

©2017 PayPal Inc. Confidential and proprietary.

Page 10: Building Enterprise Chat Bots

Developing a Custom SlackBot - Setup

1. Install Botkit• From NPM• npm install --save botkit

• From Github• git clone

[email protected]:howdyai/botkit.git• npm install

2. Create a new bot user integration and customize ithttps://my.slack.com/services/new/bot

Page 11: Building Enterprise Chat Bots

Developing a Custom SlackBot – Hello World

3. Capture token generated in #1, to be used to connect to Slack API

4. Constructs base 64 encoded value and add it to config.json (not mandatory for regular bots)

5. Run a sample bot

• npm start index.js

6. Invite Bot to your team

7. Say Hello to your Bot

Page 12: Building Enterprise Chat Bots

Lets Integrate an API in our bot

1. API to integrate – Github2. Get tokens and make first successful API call3. Convert REST Call into Node Code4. Write a controller using Intents from Slack input

and parsing them for API call5. Integrate Node code6. Parse API Response and construct Slack Response7. Happy Bot-ing !!

©2017 PayPal Inc. Confidential and proprietary.

Page 13: Building Enterprise Chat Bots

Demo for GitBit !!&

Questions

Page 14: Building Enterprise Chat Bots
Page 15: Building Enterprise Chat Bots

Thank You !!

Page 16: Building Enterprise Chat Bots

� http://www.greenmellenmedia.com/wp-content/uploads/slack-chat.png

� https://tctechcrunch2011.files.wordpress.com/2016/05/robot-customer-service.png

� https://blog.zipfworks.com/content/images/2016/06/1-6J2T-ftDoHNGEvuMQiuWLA.jpeg

� https://www.wired.com/wp-content/uploads/2015/08/SlackBot-featured1.jpg

� https://cdn-images-1.medium.com/max/800/1*SRq8BmUQl1YWXTCbO859kw.png

� https://robotsandpencils.com/wp-content/uploads/2016/03/[email protected]

� https://beepboophq.storage.googleapis.com/_web/en_US/grande.edeb24.png

� https://beepboophq.storage.googleapis.com/_web/en_US/venti.dba620.png

Image Credits

Page 17: Building Enterprise Chat Bots