SlideShare une entreprise Scribd logo
1  sur  36
Build your first ChatBot
Nadim GOUIA – Co-founder of
Contact : nadim.gouia@formalab.tn
What is a ChatBot?
A conversational Bot
 Understands user’s input
 Manages a conversation
 Answers
Some of the most common chatbots
• Climate Bot
• News Bot
• Booking Bot
• Item Suggestion Bot
• Finance Bot
• Customer Support Bot
• Pizza Ordering Bot
An Example ?
But Wait …
•I Am not expert in Artificial Intelligence
Me too … I’m not an expert in ...
 Artificial Intelligence
 Natural Language Processing
 Facebook Platform
However ...
• I can build really cool and advanced ChatBot.
How to connect
your bot?
Messaging
Applications APIs
Rich messaging
What do I need?
Natural Language Processing
APIs
Best practices
 Always announce it’s a bot
 Say hello and introduce it
 Handle common questions
 Have a help
 Start Small
Enough talking !!
Let’s build a bot
Step 1: Setting up your development
environment
• Let’s create a simple webserver with one webhook
endpoint. I’ll use Express.js.
Initialize your Node.js app
 npm init
 npm install express body-parser –save
 create a file called index.js
 start Express server listening to the port 3000
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
const server = app.listen(3000, () => console.log(‘Webhook server is
listening, port 3000’));
Index.js
Step 2 : Setting up a proxy server
with ngrok
> ngrok http 3000
Step 3 : Dialogflow integration
Step 4. Setting up Facebook
Application
• A Facebook public page, that you’ll connect with your bot.
• A Facebook Developer application, which will be connected
to your webhook server and your public page, and work as a
middleware between them.
A Parrot ChatBot
First, we have to install a request node package to be able to
send requests to Facebook :
 npm install -- save request
Second, we have to install Dialogflow node.js package, but
until now the Api.ai package is still working :
 npm install -- save apiai
Let’s add some code
const apiaiApp = require('apiai')(”Your token here");
const request = require('request');
/* For Facebook Validation */
app.get('/', (req, res) => {
if (req.query['hub.mode'] && req.query['hub.verify_token'] === 'wkhayenBot') {
res.status(200).send(req.query['hub.challenge']);
} else {
res.status(403).end();
}
});
Handling all messenges
app.post('/', (req, res) => {
if (req.body.object === 'page') {
req.body.entry.forEach((entry) => {
entry.messaging.forEach((event) => {
if (event.message && event.message.text) {
sendMessage(event);
}
});
});
res.status(200).end();
}
});
Send back a message
function sendMessage(event) {
let sender = event.sender.id;
let text = event.message.text;
request({
url: 'https://graph.facebook.com/v2.6/me/messages',
qs: {access_token: “access token"},
method: 'POST',
json: {
recipient: {id: sender},
message: {text: text}
}
}, function (error, response) {
if (error) {
console.log('Error sending message: ', error);
} else if (response.body.error) {
console.log('Error: ', response.body.error);
}
});
}
Thank you!
Nadim GOUIA
Co-founder of FormaLab
Nadim.gouia@formalab.tn

Contenu connexe

Tendances

Developing Chatbots with Google DialogFlow
Developing Chatbots with Google DialogFlowDeveloping Chatbots with Google DialogFlow
Developing Chatbots with Google DialogFlowEveristus Olumese
 
AI Chatbot Development Methodology
AI Chatbot Development MethodologyAI Chatbot Development Methodology
AI Chatbot Development MethodologyIgor Luzhanskiy
 
Chatbot and Virtual AI Assistant Implementation in Natural Language Processing
Chatbot and Virtual AI Assistant Implementation in Natural Language Processing Chatbot and Virtual AI Assistant Implementation in Natural Language Processing
Chatbot and Virtual AI Assistant Implementation in Natural Language Processing Shrutika Oswal
 
Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Samuel Adams, MBA
 
Chatbot Basics - Building Chatbots using Google Dialogflow
Chatbot Basics - Building Chatbots using Google DialogflowChatbot Basics - Building Chatbots using Google Dialogflow
Chatbot Basics - Building Chatbots using Google DialogflowBiswaranjan Rout
 
How a chat bot using dialog flow works
How a chat bot using dialog flow worksHow a chat bot using dialog flow works
How a chat bot using dialog flow worksCountants
 
An Introduction To Chat Bots
An Introduction To Chat BotsAn Introduction To Chat Bots
An Introduction To Chat BotsSohan Maheshwar
 
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
 
The Ultimate Guide to Implementing Conversational AI
The Ultimate Guide to Implementing Conversational AIThe Ultimate Guide to Implementing Conversational AI
The Ultimate Guide to Implementing Conversational AICeline Rayner
 
Artificially Intelligent chatbot Implementation
Artificially Intelligent chatbot ImplementationArtificially Intelligent chatbot Implementation
Artificially Intelligent chatbot ImplementationRakesh Chintha
 
Chatbots - The Business Opportunity
Chatbots - The Business OpportunityChatbots - The Business Opportunity
Chatbots - The Business OpportunityAlexandros Ivos
 

Tendances (20)

Developing Chatbots with Google DialogFlow
Developing Chatbots with Google DialogFlowDeveloping Chatbots with Google DialogFlow
Developing Chatbots with Google DialogFlow
 
Chat bots
Chat botsChat bots
Chat bots
 
AI Chatbot Development Methodology
AI Chatbot Development MethodologyAI Chatbot Development Methodology
AI Chatbot Development Methodology
 
Chatbot and Virtual AI Assistant Implementation in Natural Language Processing
Chatbot and Virtual AI Assistant Implementation in Natural Language Processing Chatbot and Virtual AI Assistant Implementation in Natural Language Processing
Chatbot and Virtual AI Assistant Implementation in Natural Language Processing
 
Chatbot
ChatbotChatbot
Chatbot
 
Chatbot
ChatbotChatbot
Chatbot
 
Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16
 
Chatbots - An Introduction
Chatbots - An IntroductionChatbots - An Introduction
Chatbots - An Introduction
 
Chatbot Abstract
Chatbot AbstractChatbot Abstract
Chatbot Abstract
 
Chatbot Basics - Building Chatbots using Google Dialogflow
Chatbot Basics - Building Chatbots using Google DialogflowChatbot Basics - Building Chatbots using Google Dialogflow
Chatbot Basics - Building Chatbots using Google Dialogflow
 
Chatbot ppt
Chatbot pptChatbot ppt
Chatbot ppt
 
How a chat bot using dialog flow works
How a chat bot using dialog flow worksHow a chat bot using dialog flow works
How a chat bot using dialog flow works
 
What is a chatbot?
What is a chatbot?What is a chatbot?
What is a chatbot?
 
An Introduction To Chat Bots
An Introduction To Chat BotsAn Introduction To Chat Bots
An Introduction To Chat Bots
 
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
 
The Ultimate Guide to Implementing Conversational AI
The Ultimate Guide to Implementing Conversational AIThe Ultimate Guide to Implementing Conversational AI
The Ultimate Guide to Implementing Conversational AI
 
Chatbot
ChatbotChatbot
Chatbot
 
Artificially Intelligent chatbot Implementation
Artificially Intelligent chatbot ImplementationArtificially Intelligent chatbot Implementation
Artificially Intelligent chatbot Implementation
 
Chatbots - The Business Opportunity
Chatbots - The Business OpportunityChatbots - The Business Opportunity
Chatbots - The Business Opportunity
 
ChatGPT.pptx
ChatGPT.pptxChatGPT.pptx
ChatGPT.pptx
 

Similaire à Build your first Chatbot

Build your first messenger bot
Build your first messenger botBuild your first messenger bot
Build your first messenger botNowa Labs Pte Ltd
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Evan Lin
 
React Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationReact Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationKobkrit Viriyayudhakorn
 
Building Enterprise Chat Bots
Building Enterprise Chat BotsBuilding Enterprise Chat Bots
Building Enterprise Chat BotsVasu Jain
 
How to build a realtime, WebSockets-enabled chat in less than 5 minutes
How to build a realtime, WebSockets-enabled chat in less than 5 minutesHow to build a realtime, WebSockets-enabled chat in less than 5 minutes
How to build a realtime, WebSockets-enabled chat in less than 5 minutesDerek Edwards
 
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
 
Introduction to Facebook Messenger, Conversational UI & NLP
Introduction to Facebook Messenger, Conversational UI & NLPIntroduction to Facebook Messenger, Conversational UI & NLP
Introduction to Facebook Messenger, Conversational UI & NLPSaurabh Sharma
 
Chat Bots and how to build a Slack bot
Chat Bots and how to build a Slack botChat Bots and how to build a Slack bot
Chat Bots and how to build a Slack botVasu Jain
 
How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkKommunicate Intentive Inc
 
Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirst
Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirstBuilding CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirst
Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirstJun-ichi Sakamoto
 
Identifying and solving enterprise problems
Identifying and solving enterprise problems  Identifying and solving enterprise problems
Identifying and solving enterprise problems Vasu Jain
 
Build your First Chat Bot using Power Virtual Agents (PVA)
Build your First Chat Bot using Power Virtual Agents (PVA)Build your First Chat Bot using Power Virtual Agents (PVA)
Build your First Chat Bot using Power Virtual Agents (PVA)Dhruvin Shah
 
Build a bot with Botkit
Build a bot with BotkitBuild a bot with Botkit
Build a bot with BotkitXOXCO
 
CyberArk Impact 2017 - REST for the Rest of Us
CyberArk Impact 2017 - REST for the Rest of UsCyberArk Impact 2017 - REST for the Rest of Us
CyberArk Impact 2017 - REST for the Rest of UsJoe Garcia
 
Getting Started with Twilio
Getting Started with TwilioGetting Started with Twilio
Getting Started with TwilioMichael Kimsal
 
Serverless chatbot: from idea to production at blazing speed
Serverless chatbot: from idea to production at blazing speedServerless chatbot: from idea to production at blazing speed
Serverless chatbot: from idea to production at blazing speedLuca Bianchi
 
Let's Build a Chatbot
Let's Build a ChatbotLet's Build a Chatbot
Let's Build a ChatbotTessa Mero
 
Build a Twitter Bot with Basic Python
Build a Twitter Bot with Basic PythonBuild a Twitter Bot with Basic Python
Build a Twitter Bot with Basic PythonThinkful
 

Similaire à Build your first Chatbot (20)

Build your first messenger bot
Build your first messenger botBuild your first messenger bot
Build your first messenger bot
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot
 
React Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationReact Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + Authentication
 
Building Enterprise Chat Bots
Building Enterprise Chat BotsBuilding Enterprise Chat Bots
Building Enterprise Chat Bots
 
How to build a realtime, WebSockets-enabled chat in less than 5 minutes
How to build a realtime, WebSockets-enabled chat in less than 5 minutesHow to build a realtime, WebSockets-enabled chat in less than 5 minutes
How to build a realtime, WebSockets-enabled chat in less than 5 minutes
 
Chatbot Meetup
Chatbot MeetupChatbot Meetup
Chatbot Meetup
 
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...
 
Introduction to Facebook Messenger, Conversational UI & NLP
Introduction to Facebook Messenger, Conversational UI & NLPIntroduction to Facebook Messenger, Conversational UI & NLP
Introduction to Facebook Messenger, Conversational UI & NLP
 
Chat Bots and how to build a Slack bot
Chat Bots and how to build a Slack botChat Bots and how to build a Slack bot
Chat Bots and how to build a Slack bot
 
How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python Framework
 
Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirst
Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirstBuilding CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirst
Building CLR/H Registration Site with ASP.NET MVC4 and EF4CodeFirst
 
Identifying and solving enterprise problems
Identifying and solving enterprise problems  Identifying and solving enterprise problems
Identifying and solving enterprise problems
 
Build your First Chat Bot using Power Virtual Agents (PVA)
Build your First Chat Bot using Power Virtual Agents (PVA)Build your First Chat Bot using Power Virtual Agents (PVA)
Build your First Chat Bot using Power Virtual Agents (PVA)
 
Build a bot with Botkit
Build a bot with BotkitBuild a bot with Botkit
Build a bot with Botkit
 
CyberArk Impact 2017 - REST for the Rest of Us
CyberArk Impact 2017 - REST for the Rest of UsCyberArk Impact 2017 - REST for the Rest of Us
CyberArk Impact 2017 - REST for the Rest of Us
 
Getting Started with Twilio
Getting Started with TwilioGetting Started with Twilio
Getting Started with Twilio
 
Serverless chatbot: from idea to production at blazing speed
Serverless chatbot: from idea to production at blazing speedServerless chatbot: from idea to production at blazing speed
Serverless chatbot: from idea to production at blazing speed
 
Let's Build a Chatbot
Let's Build a ChatbotLet's Build a Chatbot
Let's Build a Chatbot
 
Build a Twitter Bot with Basic Python
Build a Twitter Bot with Basic PythonBuild a Twitter Bot with Basic Python
Build a Twitter Bot with Basic Python
 

Plus de Nadim GOUIA

Raise money out of mobile apps
Raise money out of mobile appsRaise money out of mobile apps
Raise money out of mobile appsNadim GOUIA
 
Initiation firebase Nadim GOUIA
Initiation firebase Nadim GOUIAInitiation firebase Nadim GOUIA
Initiation firebase Nadim GOUIANadim GOUIA
 
Presentation animation android
Presentation animation android Presentation animation android
Presentation animation android Nadim GOUIA
 
Why should i learn android how to start -
Why should i learn android   how to start -Why should i learn android   how to start -
Why should i learn android how to start -Nadim GOUIA
 
Initiation Android Niveau Débutant
Initiation Android Niveau DébutantInitiation Android Niveau Débutant
Initiation Android Niveau DébutantNadim GOUIA
 

Plus de Nadim GOUIA (6)

Raise money out of mobile apps
Raise money out of mobile appsRaise money out of mobile apps
Raise money out of mobile apps
 
Cv nadim-gouia
Cv nadim-gouiaCv nadim-gouia
Cv nadim-gouia
 
Initiation firebase Nadim GOUIA
Initiation firebase Nadim GOUIAInitiation firebase Nadim GOUIA
Initiation firebase Nadim GOUIA
 
Presentation animation android
Presentation animation android Presentation animation android
Presentation animation android
 
Why should i learn android how to start -
Why should i learn android   how to start -Why should i learn android   how to start -
Why should i learn android how to start -
 
Initiation Android Niveau Débutant
Initiation Android Niveau DébutantInitiation Android Niveau Débutant
Initiation Android Niveau Débutant
 

Dernier

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Dernier (20)

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

Build your first Chatbot

  • 1. Build your first ChatBot Nadim GOUIA – Co-founder of Contact : nadim.gouia@formalab.tn
  • 2. What is a ChatBot?
  • 3. A conversational Bot  Understands user’s input  Manages a conversation  Answers
  • 4. Some of the most common chatbots • Climate Bot • News Bot • Booking Bot • Item Suggestion Bot • Finance Bot • Customer Support Bot • Pizza Ordering Bot
  • 6. But Wait … •I Am not expert in Artificial Intelligence
  • 7. Me too … I’m not an expert in ...  Artificial Intelligence  Natural Language Processing  Facebook Platform
  • 8. However ... • I can build really cool and advanced ChatBot.
  • 9.
  • 10.
  • 12.
  • 13.
  • 15.
  • 17.
  • 18. What do I need?
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. Best practices  Always announce it’s a bot  Say hello and introduce it  Handle common questions  Have a help  Start Small
  • 26. Step 1: Setting up your development environment • Let’s create a simple webserver with one webhook endpoint. I’ll use Express.js.
  • 27. Initialize your Node.js app  npm init  npm install express body-parser –save  create a file called index.js  start Express server listening to the port 3000
  • 28. const express = require('express'); const bodyParser = require('body-parser'); const app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); const server = app.listen(3000, () => console.log(‘Webhook server is listening, port 3000’)); Index.js
  • 29. Step 2 : Setting up a proxy server with ngrok > ngrok http 3000
  • 30. Step 3 : Dialogflow integration
  • 31. Step 4. Setting up Facebook Application • A Facebook public page, that you’ll connect with your bot. • A Facebook Developer application, which will be connected to your webhook server and your public page, and work as a middleware between them.
  • 32. A Parrot ChatBot First, we have to install a request node package to be able to send requests to Facebook :  npm install -- save request Second, we have to install Dialogflow node.js package, but until now the Api.ai package is still working :  npm install -- save apiai
  • 33. Let’s add some code const apiaiApp = require('apiai')(”Your token here"); const request = require('request'); /* For Facebook Validation */ app.get('/', (req, res) => { if (req.query['hub.mode'] && req.query['hub.verify_token'] === 'wkhayenBot') { res.status(200).send(req.query['hub.challenge']); } else { res.status(403).end(); } });
  • 34. Handling all messenges app.post('/', (req, res) => { if (req.body.object === 'page') { req.body.entry.forEach((entry) => { entry.messaging.forEach((event) => { if (event.message && event.message.text) { sendMessage(event); } }); }); res.status(200).end(); } });
  • 35. Send back a message function sendMessage(event) { let sender = event.sender.id; let text = event.message.text; request({ url: 'https://graph.facebook.com/v2.6/me/messages', qs: {access_token: “access token"}, method: 'POST', json: { recipient: {id: sender}, message: {text: text} } }, function (error, response) { if (error) { console.log('Error sending message: ', error); } else if (response.body.error) { console.log('Error: ', response.body.error); } }); }
  • 36. Thank you! Nadim GOUIA Co-founder of FormaLab Nadim.gouia@formalab.tn