Building Enterprise Chat Bots
-
Upload
vasu-jain -
Category
Engineering
-
view
261 -
download
0
Transcript of Building Enterprise Chat Bots
Building 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.
Bot Platform to order from marketplacess.
TacoBot within the Slack
Twitter Bot to order Pizza by Tweeting Pizza Emoji
Early disruptors in bots domain
PayPal announced their own Slackbot in early 2017 for to use PayPal within Slack.
Followed by PayPal in 2017…..
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
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.
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.
CODE WALKTHROUGH
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.
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
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
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.
Demo for GitBit !!&
Questions
Thank You !!
� 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