SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

How do Chatbots Work? A Guide to Chatbot Architecture
How do Chatbots Work? A Guide to Chatbot ArchitectureHow do Chatbots Work? A Guide to Chatbot Architecture
How do Chatbots Work? A Guide to Chatbot ArchitectureMaruti Techlabs
 
Artificially Intelligent chatbot Implementation
Artificially Intelligent chatbot ImplementationArtificially Intelligent chatbot Implementation
Artificially Intelligent chatbot ImplementationRakesh Chintha
 
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 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
 
Using Machine Learning and Chatbots to handle 1st line Technical Support
Using Machine Learning and Chatbots to handle 1st line Technical SupportUsing Machine Learning and Chatbots to handle 1st line Technical Support
Using Machine Learning and Chatbots to handle 1st line Technical SupportBarbara Fusinska
 
8 most important benefits of chatbots
8 most important benefits of chatbots8 most important benefits of chatbots
8 most important benefits of chatbotsMindTitan
 
AI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For EnterprisesAI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For EnterprisesTeewee Ang
 
Conversational AI with Rasa - PyData Workshop
Conversational AI with Rasa - PyData WorkshopConversational AI with Rasa - PyData Workshop
Conversational AI with Rasa - PyData WorkshopTom Bocklisch
 
Student information chatbot final report
Student information chatbot  final report Student information chatbot  final report
Student information chatbot final report jaysavani5
 
Chatbot Artificial Intelligence
Chatbot Artificial IntelligenceChatbot Artificial Intelligence
Chatbot Artificial IntelligenceMd. Mahedi Mahfuj
 
Chatbot FAQs – The Most Common Chatbot Questions Answered!
Chatbot FAQs – The Most Common Chatbot Questions Answered!Chatbot FAQs – The Most Common Chatbot Questions Answered!
Chatbot FAQs – The Most Common Chatbot Questions Answered!Onlim GmbH
 
How to build a Chatbot with Google's Dialogflow
How to build a Chatbot with Google's DialogflowHow to build a Chatbot with Google's Dialogflow
How to build a Chatbot with Google's DialogflowMoses Sam Paul Johnraj
 

Was ist angesagt? (20)

How do Chatbots Work? A Guide to Chatbot Architecture
How do Chatbots Work? A Guide to Chatbot ArchitectureHow do Chatbots Work? A Guide to Chatbot Architecture
How do Chatbots Work? A Guide to Chatbot Architecture
 
Chatbot
ChatbotChatbot
Chatbot
 
Artificially Intelligent chatbot Implementation
Artificially Intelligent chatbot ImplementationArtificially Intelligent chatbot Implementation
Artificially Intelligent chatbot Implementation
 
Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16
 
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 Abstract
Chatbot AbstractChatbot Abstract
Chatbot Abstract
 
What is a chatbot?
What is a chatbot?What is a chatbot?
What is a chatbot?
 
Using Machine Learning and Chatbots to handle 1st line Technical Support
Using Machine Learning and Chatbots to handle 1st line Technical SupportUsing Machine Learning and Chatbots to handle 1st line Technical Support
Using Machine Learning and Chatbots to handle 1st line Technical Support
 
8 most important benefits of chatbots
8 most important benefits of chatbots8 most important benefits of chatbots
8 most important benefits of chatbots
 
AI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For EnterprisesAI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For Enterprises
 
Conversational AI with Rasa - PyData Workshop
Conversational AI with Rasa - PyData WorkshopConversational AI with Rasa - PyData Workshop
Conversational AI with Rasa - PyData Workshop
 
Dialogflow
DialogflowDialogflow
Dialogflow
 
Chatbots
ChatbotsChatbots
Chatbots
 
Chatbot_Presentation
Chatbot_PresentationChatbot_Presentation
Chatbot_Presentation
 
Student information chatbot final report
Student information chatbot  final report Student information chatbot  final report
Student information chatbot final report
 
Chatbot Artificial Intelligence
Chatbot Artificial IntelligenceChatbot Artificial Intelligence
Chatbot Artificial Intelligence
 
Chatbot FAQs – The Most Common Chatbot Questions Answered!
Chatbot FAQs – The Most Common Chatbot Questions Answered!Chatbot FAQs – The Most Common Chatbot Questions Answered!
Chatbot FAQs – The Most Common Chatbot Questions Answered!
 
Everything you need to know about chatbots
Everything you need to know about chatbotsEverything you need to know about chatbots
Everything you need to know about chatbots
 
How to build a Chatbot with Google's Dialogflow
How to build a Chatbot with Google's DialogflowHow to build a Chatbot with Google's Dialogflow
How to build a Chatbot with Google's Dialogflow
 

Ähnlich wie 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
 

Ähnlich wie 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
 
Chatbot ppt
Chatbot pptChatbot ppt
Chatbot ppt
 
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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Kürzlich hochgeladen (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

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