SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Building Chatbots using
Existing Platforms with
NodeJS!
Ashish!
!
!
!
Linkedin: https://www.linkedin.com/in/ashkmr!
What are chatbots ?!
•  Tools whom you can message and it replies back
accordingly.!
Chatbots: Latest Trend!
•  The biggest incoming after the Facebook
messenger.!
•  The biggest in thing since the app stores.!
•  The future of the way we communicate, the way we
order things, the way we buy, the way we travel, the
way we book things and services.!
•  In future we may forget websites, these bots are
going to be the new websites in a way.!
Mobile messaging apps worldwide as of
January 2017, monthly active users (in millions)!
https://www.statista.com/statistics/258749/most-popular-global-mobile-messenger-apps/!
No more apps ?!
•  Almost 70 percent of all app usage comes from just
200 apps. !
•  Most apps go unused.!
•  Lot easier to get users to just chat with the chatbots
than to download an app, login, learn to use and
then try to remember its flow.!
Why use chatbots?!
Development cost!
command line! chatbot! website! mobile app!
Deploying updates!
command line! chatbot! website! mobile app!
Push notifications!
command line! chatbot! website! mobile app!
Customer Support!
Traditional Way
1.  Find contact info of company through the
Internet
2.  Call contact number
3.  Navigate through a sequence of touch
tones or semi-functional speech
recognition steps
4.  Wait on hold until a specialist is available
5.  Step through a sequence of verifications
to make sure it is truly you who is calling
6.  Get told you need to talk with a different
representative and get put on hold
7.  Connect with a rep who now tries to have
you navigate the Internet via voice
instructions
8.  Login to the company website
9.  Finally, get an answer to your question
Future
1.  Open Facebook Messenger and search for
the business name
2.  Start the conversation by making a
request
3.  Receive rich media feedback (text +
images + hyperlinks + voice) that answer
your question
Why ChatBots are future of
customer support ?!
• Standardised way of interaction!
• Automatic verification via profile (FB, Telegram ...) !
• No “transferring” to “other experts” !
• No media breaks -> web to web (link, pictures, rich-web) !
• Huge cost savings !
• New marketing and up-selling tool for brands!
!
Business Chatbots : !
Need of the Hour !!
•  If you don’t have strategy on your bot yet, you
definitely need to rethink in order to catch up to be
competitive in the market.!
•  users like to perform tasks like scheduling
meetings, ordering a product, booking a flight etc
all via text. Its easier, quicker.!
Business Chatbots
Examples!
KUDI!
•  KUDI — seamless bill
payment through messaging!
•  Helps users transfer money,
buy airtime for their phone,
pay bills and stay on top of
their bank accounts easily. !
•  More info : https://kudi.ai!
MyStarbucks Barista!
•  lets customers place orders by speaking, “I want a
latte.” !
•  can be used to pay for orders. !
•  http://money.cnn.com/2017/01/30/technology/starbucks-mobile-app/!
VerbalAccess!
•  VerbalAccess uses natural
language processing
technology to empowers its
bot to take voice commands
and do banking transactions.!
!
•  http://northsideinc.com/index.php/verbalaccess/!
eBay Shopbot!
•  eBay ShopBot is a chatbot on
facebook which will help you
find a gift for your friend.!
•  You can test eBay
Shopbot here: 
https://www.facebook.com/
ebayshopbot/!
Microsoft’s ZO!
•  Zo : Social Bot in general!
•  https://www.zo.ai/!
How ChatBots work ?!
1.  Rule based!
•  If this, then do that !!
•  If the word “Book” appears, return website where books can be bought
or …!
•  If user types “Travel”, then ask for a city name , then send list of
“places to see” in that city.!
How ChatBots work ?!
2.  Machine learning!
•  Supervised learning!
inputs and their desired outputs, given by a programmed code
•  Unsupervised learning!
leaving it on its own to find structure in its input
FB Messenger Platform!
•  900 million people around the world who use
Messenger every month.!
•  Available on all platforms, including iOS, Android,
and web.!
•  You define the message templates, using features
like images, text and calls to action (CTAs) !
Bot for Messenger!
•  Three ways to interact!
•  Send / Receive API!
•  Generic Message Template!
•  Welcome screen + Null state CTAs!
Building Chatbot !
using !
NodeJS!
Step1!
1.  Create a Facebook App and Page, Select
“Messenger”!
Step 2, 3!
2.  Setup Web hook!
4.  Enter a URL for a webhook,
enter a Verify Token and
select messages and
messaging_postbacks under
Subscription Fields.!
Step 4!
Clone the repository : https://github.com/fbsamples/messenger-platform-samples!
4.  In the sample app, this method is defined in app.js!
!
app.get(/webhook, function(req, res) {!
if (req.query[hub.mode] === subscribe &&!
req.query[hub.verify_token] === <VERIFY_TOKEN>) {!
console.log("Validating webhook");!
res.status(200).send(req.query[hub.challenge]);!
} else {!
console.error("Failed validation. Make sure the validation tokens match.");!
res.sendStatus(403); !
} !
});!
Step 5!
5.  Get a Page Access Token!
Step 6!
6.  Subscribe the App to the Page!
Step 7!
7. Receive Messages!
app.post(/webhook, function (req, res) {!
var data = req.body;!
!
// Make sure this is a page subscription!
if (data.object === page) {!
!
// Iterate over each entry - there may be multiple if batched!
data.entry.forEach(function(entry) {!
var pageID = entry.id;!
var timeOfEvent = entry.time;!
!
// Iterate over each messaging event!
entry.messaging.forEach(function(event) {!
if (event.message) {!
receivedMessage(event);!
} else {!
console.log("Webhook received unknown event ", event);!
}!
});!
});!
!
// Assume all went well.!
//!
// You must send back a 200, within 20 seconds, to let us know!
// youve successfully received the callback. Otherwise, the request!
// will time out and we will keep trying to resend.!
res.sendStatus(200);!
}!
});!
!
function receivedMessage(event) {!
// Putting a stub for now, well expand it in the following steps!
console.log("Message data ", event.message);!
}!
Step 8!
8.  Send a Text Message from Facebook page!
!
function receivedMessage(event) {!
!
var senderID = event.sender.id;!
var recipientID = event.recipient.id;!
var timeOfMessage = event.timestamp;!
var message = event.message;!
!
console.log("Received message for user %d and page %d at %d with message", !
senderID, recipientID, timeOfMessage);!
console.log(JSON.stringify(message));!
!
var messageId = message.mid;!
!
var messageText = message.text;!
var messageAttachments = message.attachments;!
!
if (messageText) {!
!
// If we receive a text message, check to see if it matches a keyword!
// and send back the example. Otherwise, just echo the text we received.!
switch (messageText) {!
generic!
sendGenericMessage(senderID);!
break;!
!
default!
sendTextMessage(senderID, messageText);!
}!
} else if (messageAttachments) {!
sendTextMessage(senderID, "Message with attachment received");!
}!
}!
callSendAPI() function!
!
function sendTextMessage(recipientId,
messageText) {!
var messageData = {!
recipient {!
id recipientId!
},!
message {!
text messageText!
}!
};!
!
callSendAPI(messageData);!
}!
!
function callSendAPI(messageData) {!
request({!
uri https//graph.facebook.com/v2.6/me/messages,!
qs { access_token PAGE_ACCESS_TOKEN },!
method POST,!
json messageData!
!
}, function (error, response, body) {!
if (!error && response.statusCode == 200) {!
var recipientId = body.recipient_id;!
var messageId = body.message_id;!
!
console.log("Successfully sent msg id %s to recipient %s", !
messageId, recipientId);!
} else {!
console.error("Unable to send message.");!
console.error(response);!
console.error(error);!
}!
}); !
}!
Lets start sending messages!
A Structured Message!!
var messageData = {!
recipient {!
id recipientId!
},!
!
message {!
attachment {!
type "template",!
payload {!
template_type "generic",!
elements [{!
title "rift",!
subtitle "Next-generation virtual reality",!
item_url "https//www.oculus.com/en-us/rift/", !
image_url "http//messengerdemo.parseapp.com/img/rift.png",!
buttons [{!
type "web_url",!
url "https//www.oculus.com/en-us/rift/",!
title "Open Web URL"!
}, {!
type "postback",!
title "Call Postback",!
payload "Payload for first bubble",!
}],!
}, {!
title "touch",!
subtitle "Your Hands, Now in VR",!
item_url "https//www.oculus.com/en-us/touch/", !
image_url "http//messengerdemo.parseapp.com/img/touch.png",!
buttons [{!
type "web_url",!
url "https//www.oculus.com/en-us/touch/",!
title "Open Web URL"!
}}]!
Handle Postbacks!
function receivedPostback(event) {!
!
var senderID = event.sender.id;!
var recipientID = event.recipient.id;!
var timeOfPostback = event.timestamp;!
!
// The payload param is a developer-defined field which is set in a postback !
// button for Structured Messages. !
var payload = event.postback.payload;!
!
console.log("Received postback for user %d and page %d with payload %s " + !
"at %d", senderID, recipientID, payload, timeOfPostback);!
!
// When a postback is called, well send a message back to the sender to !
// let them know it was successful!
sendTextMessage(senderID, "Postback called");!
!
}!
Demo with following keyword Inputs!
•  image !
•  gif!
•  audio!
•  video !
•  file !
•  button!
•  generic!
•  receipt!
•  quick reply!
•  read receipt!
•  typing on!
•  typing off!
•  account linking!
Natural Language Processing Tools!
•  API.AI and WIT.AI !
•  integrate natural language processing and
understanding into your applications.!
Comparison!
api.ai Wit.ai !
•  Y-Combinator startup, !
•  $3M seed-round by
Andreessen Horowitz,
Ashton Kutcher and Eric
Hahn, !
•  bought by Facebook Inc
after 18 months.!
•  API.AI is a conversational UX
platform enabling natural
language interactions for
devices, applications, and
services.!
•  $8.6M in 4 Rounds !
•  API.AI is backed by Intel
Capital, Motorola Solutions,
SAIC Motor, and Alpine
Electronics.!
•  bought by Google in Sept 2016!
What does Wit.AI or API.AI do ?
Suppose user types this message!
I want to book ticket for 2 from SanFrancisco to NewYork on 5th Apr
2017.!
These Platforms extracts parts from input, then follows the rules /
machine learning as programmed!
Action book ticket
Travellers 2
From Location SanFrancisco
To Location NewYork
Date 5th Apr 2017
Understanding API.AI!
Understanding API.AI!
•  API.AI Agent : a bot, app, service or device that you would like to have
conversation to.!
•  Entities: Objects you want to interact with. !
•  example, for travel booking agent, we have location, or date or number Of
Passengers as entities.!
•  3 Types of entities: system , developer , and user entities.!
Demo!
api.ai!
Thanks!
!
!
!
!
!
!
Linkedin: https://www.linkedin.com/in/ashkmr!
!

Weitere ähnliche Inhalte

Was ist angesagt?

How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?Mobile Monday Srbija
 
The Chatbot Imperative: Intelligence, Personalization and Utilitarian Design
The Chatbot Imperative: Intelligence, Personalization and Utilitarian DesignThe Chatbot Imperative: Intelligence, Personalization and Utilitarian Design
The Chatbot Imperative: Intelligence, Personalization and Utilitarian DesignCognizant
 
Chatbots - What, Why and How? - Beerud Sheth
Chatbots - What, Why and How? - Beerud ShethChatbots - What, Why and How? - Beerud Sheth
Chatbots - What, Why and How? - Beerud ShethWithTheBest
 
chatbot and messenger as a platform
chatbot and messenger as a platformchatbot and messenger as a platform
chatbot and messenger as a platformDaisuke Minamide
 
Introduction to Chat Bots
Introduction to Chat BotsIntroduction to Chat Bots
Introduction to Chat BotsAlyona Medelyan
 
Chatbot Artificial Intelligence
Chatbot Artificial IntelligenceChatbot Artificial Intelligence
Chatbot Artificial IntelligenceMd. Mahedi Mahfuj
 
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot DesignChatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot DesignStefan Kojouharov
 
How Chatbots will overtake the app in 2017
How Chatbots will overtake the app in 2017How Chatbots will overtake the app in 2017
How Chatbots will overtake the app in 2017eBranding Ninja
 
The Chatbots Are Coming: A Guide to Chatbots, AI and Conversational Interfaces
The Chatbots Are Coming: A Guide to Chatbots, AI and Conversational InterfacesThe Chatbots Are Coming: A Guide to Chatbots, AI and Conversational Interfaces
The Chatbots Are Coming: A Guide to Chatbots, AI and Conversational InterfacesTWG
 
Chat bot get ready for the next trend of business [en]
Chat bot   get ready for the next trend of business [en]Chat bot   get ready for the next trend of business [en]
Chat bot get ready for the next trend of business [en]Sikharin Cholpratin
 
Chat bots and AI
Chat bots and AIChat bots and AI
Chat bots and AIGeff Thomas
 
Build a Chatbot with IBM Watson - No Coding Required
Build a Chatbot with IBM Watson - No Coding RequiredBuild a Chatbot with IBM Watson - No Coding Required
Build a Chatbot with IBM Watson - No Coding RequiredCharlotte Han
 
Chat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of botsChat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of botsBAM
 
The lifecycle of a chatbot
The lifecycle of a chatbotThe lifecycle of a chatbot
The lifecycle of a chatbotSohan Maheshwar
 

Was ist angesagt? (20)

Chatbots 101
Chatbots 101Chatbots 101
Chatbots 101
 
How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?How to Build a Serverless Chatbot for $0?
How to Build a Serverless Chatbot for $0?
 
The Chatbot Imperative: Intelligence, Personalization and Utilitarian Design
The Chatbot Imperative: Intelligence, Personalization and Utilitarian DesignThe Chatbot Imperative: Intelligence, Personalization and Utilitarian Design
The Chatbot Imperative: Intelligence, Personalization and Utilitarian Design
 
Chatbots - What, Why and How? - Beerud Sheth
Chatbots - What, Why and How? - Beerud ShethChatbots - What, Why and How? - Beerud Sheth
Chatbots - What, Why and How? - Beerud Sheth
 
chatbot and messenger as a platform
chatbot and messenger as a platformchatbot and messenger as a platform
chatbot and messenger as a platform
 
Introduction to Chat Bots
Introduction to Chat BotsIntroduction to Chat Bots
Introduction to Chat Bots
 
Chatbot Artificial Intelligence
Chatbot Artificial IntelligenceChatbot Artificial Intelligence
Chatbot Artificial Intelligence
 
Chatbot
ChatbotChatbot
Chatbot
 
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot DesignChatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
Chatbot Revolution: Exploring Opportunities, Use Cases, & Bot Design
 
How Chatbots will overtake the app in 2017
How Chatbots will overtake the app in 2017How Chatbots will overtake the app in 2017
How Chatbots will overtake the app in 2017
 
The Chatbots Are Coming: A Guide to Chatbots, AI and Conversational Interfaces
The Chatbots Are Coming: A Guide to Chatbots, AI and Conversational InterfacesThe Chatbots Are Coming: A Guide to Chatbots, AI and Conversational Interfaces
The Chatbots Are Coming: A Guide to Chatbots, AI and Conversational Interfaces
 
Let's Build a Chatbot!
Let's Build a Chatbot!Let's Build a Chatbot!
Let's Build a Chatbot!
 
Chat bot get ready for the next trend of business [en]
Chat bot   get ready for the next trend of business [en]Chat bot   get ready for the next trend of business [en]
Chat bot get ready for the next trend of business [en]
 
Chat bots and AI
Chat bots and AIChat bots and AI
Chat bots and AI
 
Build a Chatbot with IBM Watson - No Coding Required
Build a Chatbot with IBM Watson - No Coding RequiredBuild a Chatbot with IBM Watson - No Coding Required
Build a Chatbot with IBM Watson - No Coding Required
 
Chat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of botsChat bots101 - practical insights on the business of bots
Chat bots101 - practical insights on the business of bots
 
Chatbot ppt
Chatbot pptChatbot ppt
Chatbot ppt
 
Chatbot
ChatbotChatbot
Chatbot
 
Chatbots: Connecting Artificial Intelligence and Customer Service
Chatbots: Connecting Artificial Intelligence and Customer ServiceChatbots: Connecting Artificial Intelligence and Customer Service
Chatbots: Connecting Artificial Intelligence and Customer Service
 
The lifecycle of a chatbot
The lifecycle of a chatbotThe lifecycle of a chatbot
The lifecycle of a chatbot
 

Ähnlich wie Building chat bots using ai platforms (wit.ai or api.ai) in nodejs

TOC Workshop 2013
TOC Workshop 2013TOC Workshop 2013
TOC Workshop 2013Haig Armen
 
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile FrameworkBuilding a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile FrameworkSt. Petersburg College
 
Be Awesome with Emerging Tech [SUNYCUAD}
Be Awesome with Emerging Tech [SUNYCUAD}Be Awesome with Emerging Tech [SUNYCUAD}
Be Awesome with Emerging Tech [SUNYCUAD}Robin Smail
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Jean-Loup Yu
 
Single Page Web Apps
Single Page Web AppsSingle Page Web Apps
Single Page Web AppsJan Monschke
 
The Mobile Development Landscape
The Mobile Development LandscapeThe Mobile Development Landscape
The Mobile Development LandscapeAmbert Ho
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachITCamp
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp
 
Using Chatbots in Extension Programming
Using Chatbots in Extension ProgrammingUsing Chatbots in Extension Programming
Using Chatbots in Extension ProgrammingAmy Cole
 
BLUG 2011 - Explaining the IBM Social Business Toolkit
BLUG 2011 - Explaining the IBM Social Business ToolkitBLUG 2011 - Explaining the IBM Social Business Toolkit
BLUG 2011 - Explaining the IBM Social Business ToolkitRené Winkelmeyer
 
The Future of Progressive Web Apps - View Source conference, Berlin 2016
The Future of Progressive Web Apps - View Source conference, Berlin 2016The Future of Progressive Web Apps - View Source conference, Berlin 2016
The Future of Progressive Web Apps - View Source conference, Berlin 2016Robert Nyman
 
Making Effective Prototypes
Making Effective PrototypesMaking Effective Prototypes
Making Effective PrototypesMatthew Ho
 
The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016Robert Nyman
 
Mobile Web Performance - Getting and Staying Fast
Mobile Web Performance -  Getting and Staying FastMobile Web Performance -  Getting and Staying Fast
Mobile Web Performance - Getting and Staying FastAndy Davies
 
Build an Intelligent Bot (Node.js)
Build an Intelligent Bot (Node.js)Build an Intelligent Bot (Node.js)
Build an Intelligent Bot (Node.js)Sorin Peste
 
Getting Started With bots
Getting Started With botsGetting Started With bots
Getting Started With botsGaurav sharma
 
Mad Easy Marketing For People Who Aren't Marketers
Mad Easy Marketing For People Who Aren't MarketersMad Easy Marketing For People Who Aren't Marketers
Mad Easy Marketing For People Who Aren't MarketersMad Mimi
 
The future of bots and how to use them to drive sustainable growth
The future of bots and how to use them to drive sustainable growthThe future of bots and how to use them to drive sustainable growth
The future of bots and how to use them to drive sustainable growthAl Bentley
 
Chatbots DDD North2016
Chatbots DDD North2016Chatbots DDD North2016
Chatbots DDD North2016Galiya Warrier
 

Ähnlich wie Building chat bots using ai platforms (wit.ai or api.ai) in nodejs (20)

TOC Workshop 2013
TOC Workshop 2013TOC Workshop 2013
TOC Workshop 2013
 
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile FrameworkBuilding a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
 
Be Awesome with Emerging Tech [SUNYCUAD}
Be Awesome with Emerging Tech [SUNYCUAD}Be Awesome with Emerging Tech [SUNYCUAD}
Be Awesome with Emerging Tech [SUNYCUAD}
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
 
Single Page Web Apps
Single Page Web AppsSingle Page Web Apps
Single Page Web Apps
 
The Mobile Development Landscape
The Mobile Development LandscapeThe Mobile Development Landscape
The Mobile Development Landscape
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
 
Using Chatbots in Extension Programming
Using Chatbots in Extension ProgrammingUsing Chatbots in Extension Programming
Using Chatbots in Extension Programming
 
BLUG 2011 - Explaining the IBM Social Business Toolkit
BLUG 2011 - Explaining the IBM Social Business ToolkitBLUG 2011 - Explaining the IBM Social Business Toolkit
BLUG 2011 - Explaining the IBM Social Business Toolkit
 
Mobile Services for Your Library
Mobile Services for Your LibraryMobile Services for Your Library
Mobile Services for Your Library
 
The Future of Progressive Web Apps - View Source conference, Berlin 2016
The Future of Progressive Web Apps - View Source conference, Berlin 2016The Future of Progressive Web Apps - View Source conference, Berlin 2016
The Future of Progressive Web Apps - View Source conference, Berlin 2016
 
Making Effective Prototypes
Making Effective PrototypesMaking Effective Prototypes
Making Effective Prototypes
 
The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016
 
Mobile Web Performance - Getting and Staying Fast
Mobile Web Performance -  Getting and Staying FastMobile Web Performance -  Getting and Staying Fast
Mobile Web Performance - Getting and Staying Fast
 
Build an Intelligent Bot (Node.js)
Build an Intelligent Bot (Node.js)Build an Intelligent Bot (Node.js)
Build an Intelligent Bot (Node.js)
 
Getting Started With bots
Getting Started With botsGetting Started With bots
Getting Started With bots
 
Mad Easy Marketing For People Who Aren't Marketers
Mad Easy Marketing For People Who Aren't MarketersMad Easy Marketing For People Who Aren't Marketers
Mad Easy Marketing For People Who Aren't Marketers
 
The future of bots and how to use them to drive sustainable growth
The future of bots and how to use them to drive sustainable growthThe future of bots and how to use them to drive sustainable growth
The future of bots and how to use them to drive sustainable growth
 
Chatbots DDD North2016
Chatbots DDD North2016Chatbots DDD North2016
Chatbots DDD North2016
 

Mehr von Entrepreneur / Startup

R-FCN : object detection via region-based fully convolutional networks
R-FCN :  object detection via region-based fully convolutional networksR-FCN :  object detection via region-based fully convolutional networks
R-FCN : object detection via region-based fully convolutional networksEntrepreneur / Startup
 
You only look once (YOLO) : unified real time object detection
You only look once (YOLO) : unified real time object detectionYou only look once (YOLO) : unified real time object detection
You only look once (YOLO) : unified real time object detectionEntrepreneur / Startup
 
Machine Learning Algorithms in Enterprise Applications
Machine Learning Algorithms in Enterprise ApplicationsMachine Learning Algorithms in Enterprise Applications
Machine Learning Algorithms in Enterprise ApplicationsEntrepreneur / Startup
 
Build a Neural Network for ITSM with TensorFlow
Build a Neural Network for ITSM with TensorFlowBuild a Neural Network for ITSM with TensorFlow
Build a Neural Network for ITSM with TensorFlowEntrepreneur / Startup
 
Understanding Autoencoder (Deep Learning Book, Chapter 14)
Understanding Autoencoder  (Deep Learning Book, Chapter 14)Understanding Autoencoder  (Deep Learning Book, Chapter 14)
Understanding Autoencoder (Deep Learning Book, Chapter 14)Entrepreneur / Startup
 

Mehr von Entrepreneur / Startup (13)

R-FCN : object detection via region-based fully convolutional networks
R-FCN :  object detection via region-based fully convolutional networksR-FCN :  object detection via region-based fully convolutional networks
R-FCN : object detection via region-based fully convolutional networks
 
You only look once (YOLO) : unified real time object detection
You only look once (YOLO) : unified real time object detectionYou only look once (YOLO) : unified real time object detection
You only look once (YOLO) : unified real time object detection
 
Machine Learning Algorithms in Enterprise Applications
Machine Learning Algorithms in Enterprise ApplicationsMachine Learning Algorithms in Enterprise Applications
Machine Learning Algorithms in Enterprise Applications
 
OpenAI Gym & Universe
OpenAI Gym & UniverseOpenAI Gym & Universe
OpenAI Gym & Universe
 
Build a Neural Network for ITSM with TensorFlow
Build a Neural Network for ITSM with TensorFlowBuild a Neural Network for ITSM with TensorFlow
Build a Neural Network for ITSM with TensorFlow
 
Understanding Autoencoder (Deep Learning Book, Chapter 14)
Understanding Autoencoder  (Deep Learning Book, Chapter 14)Understanding Autoencoder  (Deep Learning Book, Chapter 14)
Understanding Autoencoder (Deep Learning Book, Chapter 14)
 
Build an AI based virtual agent
Build an AI based virtual agent Build an AI based virtual agent
Build an AI based virtual agent
 
Building Bots Using IBM Watson
Building Bots Using IBM WatsonBuilding Bots Using IBM Watson
Building Bots Using IBM Watson
 
Building mobile apps using meteorJS
Building mobile apps using meteorJSBuilding mobile apps using meteorJS
Building mobile apps using meteorJS
 
Building iOS app using meteor
Building iOS app using meteorBuilding iOS app using meteor
Building iOS app using meteor
 
Understanding angular meteor
Understanding angular meteorUnderstanding angular meteor
Understanding angular meteor
 
Introducing ElasticSearch - Ashish
Introducing ElasticSearch - AshishIntroducing ElasticSearch - Ashish
Introducing ElasticSearch - Ashish
 
Meteor Introduction - Ashish
Meteor Introduction - AshishMeteor Introduction - Ashish
Meteor Introduction - Ashish
 

Kürzlich hochgeladen

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 

Kürzlich hochgeladen (20)

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 

Building chat bots using ai platforms (wit.ai or api.ai) in nodejs

  • 1. Building Chatbots using Existing Platforms with NodeJS! Ashish! ! ! ! Linkedin: https://www.linkedin.com/in/ashkmr!
  • 2. What are chatbots ?! •  Tools whom you can message and it replies back accordingly.!
  • 3. Chatbots: Latest Trend! •  The biggest incoming after the Facebook messenger.! •  The biggest in thing since the app stores.! •  The future of the way we communicate, the way we order things, the way we buy, the way we travel, the way we book things and services.! •  In future we may forget websites, these bots are going to be the new websites in a way.!
  • 4. Mobile messaging apps worldwide as of January 2017, monthly active users (in millions)! https://www.statista.com/statistics/258749/most-popular-global-mobile-messenger-apps/!
  • 5. No more apps ?! •  Almost 70 percent of all app usage comes from just 200 apps. ! •  Most apps go unused.! •  Lot easier to get users to just chat with the chatbots than to download an app, login, learn to use and then try to remember its flow.!
  • 7. Development cost! command line! chatbot! website! mobile app!
  • 8. Deploying updates! command line! chatbot! website! mobile app!
  • 9. Push notifications! command line! chatbot! website! mobile app!
  • 10. Customer Support! Traditional Way 1.  Find contact info of company through the Internet 2.  Call contact number 3.  Navigate through a sequence of touch tones or semi-functional speech recognition steps 4.  Wait on hold until a specialist is available 5.  Step through a sequence of verifications to make sure it is truly you who is calling 6.  Get told you need to talk with a different representative and get put on hold 7.  Connect with a rep who now tries to have you navigate the Internet via voice instructions 8.  Login to the company website 9.  Finally, get an answer to your question Future 1.  Open Facebook Messenger and search for the business name 2.  Start the conversation by making a request 3.  Receive rich media feedback (text + images + hyperlinks + voice) that answer your question
  • 11. Why ChatBots are future of customer support ?! • Standardised way of interaction! • Automatic verification via profile (FB, Telegram ...) ! • No “transferring” to “other experts” ! • No media breaks -> web to web (link, pictures, rich-web) ! • Huge cost savings ! • New marketing and up-selling tool for brands! !
  • 12. Business Chatbots : ! Need of the Hour !! •  If you don’t have strategy on your bot yet, you definitely need to rethink in order to catch up to be competitive in the market.! •  users like to perform tasks like scheduling meetings, ordering a product, booking a flight etc all via text. Its easier, quicker.!
  • 14. KUDI! •  KUDI — seamless bill payment through messaging! •  Helps users transfer money, buy airtime for their phone, pay bills and stay on top of their bank accounts easily. ! •  More info : https://kudi.ai!
  • 15. MyStarbucks Barista! •  lets customers place orders by speaking, “I want a latte.” ! •  can be used to pay for orders. ! •  http://money.cnn.com/2017/01/30/technology/starbucks-mobile-app/!
  • 16. VerbalAccess! •  VerbalAccess uses natural language processing technology to empowers its bot to take voice commands and do banking transactions.! ! •  http://northsideinc.com/index.php/verbalaccess/!
  • 17. eBay Shopbot! •  eBay ShopBot is a chatbot on facebook which will help you find a gift for your friend.! •  You can test eBay Shopbot here:  https://www.facebook.com/ ebayshopbot/!
  • 18. Microsoft’s ZO! •  Zo : Social Bot in general! •  https://www.zo.ai/!
  • 19. How ChatBots work ?! 1.  Rule based! •  If this, then do that !! •  If the word “Book” appears, return website where books can be bought or …! •  If user types “Travel”, then ask for a city name , then send list of “places to see” in that city.!
  • 20. How ChatBots work ?! 2.  Machine learning! •  Supervised learning! inputs and their desired outputs, given by a programmed code •  Unsupervised learning! leaving it on its own to find structure in its input
  • 21. FB Messenger Platform! •  900 million people around the world who use Messenger every month.! •  Available on all platforms, including iOS, Android, and web.! •  You define the message templates, using features like images, text and calls to action (CTAs) !
  • 22. Bot for Messenger! •  Three ways to interact! •  Send / Receive API! •  Generic Message Template! •  Welcome screen + Null state CTAs!
  • 24. Step1! 1.  Create a Facebook App and Page, Select “Messenger”!
  • 25. Step 2, 3! 2.  Setup Web hook! 4.  Enter a URL for a webhook, enter a Verify Token and select messages and messaging_postbacks under Subscription Fields.!
  • 26. Step 4! Clone the repository : https://github.com/fbsamples/messenger-platform-samples! 4.  In the sample app, this method is defined in app.js! ! app.get(/webhook, function(req, res) {! if (req.query[hub.mode] === subscribe &&! req.query[hub.verify_token] === <VERIFY_TOKEN>) {! console.log("Validating webhook");! res.status(200).send(req.query[hub.challenge]);! } else {! console.error("Failed validation. Make sure the validation tokens match.");! res.sendStatus(403); ! } ! });!
  • 27. Step 5! 5.  Get a Page Access Token!
  • 28. Step 6! 6.  Subscribe the App to the Page!
  • 29. Step 7! 7. Receive Messages! app.post(/webhook, function (req, res) {! var data = req.body;! ! // Make sure this is a page subscription! if (data.object === page) {! ! // Iterate over each entry - there may be multiple if batched! data.entry.forEach(function(entry) {! var pageID = entry.id;! var timeOfEvent = entry.time;! ! // Iterate over each messaging event! entry.messaging.forEach(function(event) {! if (event.message) {! receivedMessage(event);! } else {! console.log("Webhook received unknown event ", event);! }! });! });! ! // Assume all went well.! //! // You must send back a 200, within 20 seconds, to let us know! // youve successfully received the callback. Otherwise, the request! // will time out and we will keep trying to resend.! res.sendStatus(200);! }! });! ! function receivedMessage(event) {! // Putting a stub for now, well expand it in the following steps! console.log("Message data ", event.message);! }!
  • 30. Step 8! 8.  Send a Text Message from Facebook page! ! function receivedMessage(event) {! ! var senderID = event.sender.id;! var recipientID = event.recipient.id;! var timeOfMessage = event.timestamp;! var message = event.message;! ! console.log("Received message for user %d and page %d at %d with message", ! senderID, recipientID, timeOfMessage);! console.log(JSON.stringify(message));! ! var messageId = message.mid;! ! var messageText = message.text;! var messageAttachments = message.attachments;! ! if (messageText) {! ! // If we receive a text message, check to see if it matches a keyword! // and send back the example. Otherwise, just echo the text we received.! switch (messageText) {! generic! sendGenericMessage(senderID);! break;! ! default! sendTextMessage(senderID, messageText);! }! } else if (messageAttachments) {! sendTextMessage(senderID, "Message with attachment received");! }! }!
  • 31. callSendAPI() function! ! function sendTextMessage(recipientId, messageText) {! var messageData = {! recipient {! id recipientId! },! message {! text messageText! }! };! ! callSendAPI(messageData);! }! ! function callSendAPI(messageData) {! request({! uri https//graph.facebook.com/v2.6/me/messages,! qs { access_token PAGE_ACCESS_TOKEN },! method POST,! json messageData! ! }, function (error, response, body) {! if (!error && response.statusCode == 200) {! var recipientId = body.recipient_id;! var messageId = body.message_id;! ! console.log("Successfully sent msg id %s to recipient %s", ! messageId, recipientId);! } else {! console.error("Unable to send message.");! console.error(response);! console.error(error);! }! }); ! }!
  • 32. Lets start sending messages!
  • 33. A Structured Message!! var messageData = {! recipient {! id recipientId! },! ! message {! attachment {! type "template",! payload {! template_type "generic",! elements [{! title "rift",! subtitle "Next-generation virtual reality",! item_url "https//www.oculus.com/en-us/rift/", ! image_url "http//messengerdemo.parseapp.com/img/rift.png",! buttons [{! type "web_url",! url "https//www.oculus.com/en-us/rift/",! title "Open Web URL"! }, {! type "postback",! title "Call Postback",! payload "Payload for first bubble",! }],! }, {! title "touch",! subtitle "Your Hands, Now in VR",! item_url "https//www.oculus.com/en-us/touch/", ! image_url "http//messengerdemo.parseapp.com/img/touch.png",! buttons [{! type "web_url",! url "https//www.oculus.com/en-us/touch/",! title "Open Web URL"! }}]!
  • 34. Handle Postbacks! function receivedPostback(event) {! ! var senderID = event.sender.id;! var recipientID = event.recipient.id;! var timeOfPostback = event.timestamp;! ! // The payload param is a developer-defined field which is set in a postback ! // button for Structured Messages. ! var payload = event.postback.payload;! ! console.log("Received postback for user %d and page %d with payload %s " + ! "at %d", senderID, recipientID, payload, timeOfPostback);! ! // When a postback is called, well send a message back to the sender to ! // let them know it was successful! sendTextMessage(senderID, "Postback called");! ! }!
  • 35. Demo with following keyword Inputs! •  image ! •  gif! •  audio! •  video ! •  file ! •  button! •  generic! •  receipt! •  quick reply! •  read receipt! •  typing on! •  typing off! •  account linking!
  • 36. Natural Language Processing Tools! •  API.AI and WIT.AI ! •  integrate natural language processing and understanding into your applications.!
  • 37. Comparison! api.ai Wit.ai ! •  Y-Combinator startup, ! •  $3M seed-round by Andreessen Horowitz, Ashton Kutcher and Eric Hahn, ! •  bought by Facebook Inc after 18 months.! •  API.AI is a conversational UX platform enabling natural language interactions for devices, applications, and services.! •  $8.6M in 4 Rounds ! •  API.AI is backed by Intel Capital, Motorola Solutions, SAIC Motor, and Alpine Electronics.! •  bought by Google in Sept 2016!
  • 38. What does Wit.AI or API.AI do ? Suppose user types this message! I want to book ticket for 2 from SanFrancisco to NewYork on 5th Apr 2017.! These Platforms extracts parts from input, then follows the rules / machine learning as programmed! Action book ticket Travellers 2 From Location SanFrancisco To Location NewYork Date 5th Apr 2017
  • 40. Understanding API.AI! •  API.AI Agent : a bot, app, service or device that you would like to have conversation to.! •  Entities: Objects you want to interact with. ! •  example, for travel booking agent, we have location, or date or number Of Passengers as entities.! •  3 Types of entities: system , developer , and user entities.!