SlideShare a Scribd company logo
Ram Murat Sharma, @rammrms
rammurat.rms.sharma0@gmail.com
Agenda
 Introduction
 Bots
 Facebook bots
 Prerequisite
 Demo
 CNN
 Installations
 Facebook page
 Ngrok (Secure tunnels to
localhost)
 Node server
 Facebook presentation layer
(Structured Messages)
 Facebook templates
 Do we need a framework
 Framework design
 Framework application
flow
 File structure
 WIT API
 Firebase database
 Future of bots
 Framework source code
Introduction to chat bots
 Bots are simple artificial intelligence systems that you interact with via
text. Those interactions can be straight forward, like asking a bot to give
you a weather report, or more complex, like having one troubleshoot a
problem with your internet service.
 Short for chat robot, a computer program that simulates human
conversation, or chat, through artificial intelligence.
 Chat bots are used in applications such as ecommerce customer service,
call centers and Internet gaming. Chat bots used for these purposes are
typically limited to conversations regarding a specialized purpose and not
for the entire range of human communication.
Introduction to FB Bots
 The Messenger Platform gives you the ability to have conversations with people on
Messenger. We've added new tools for you to build and promote your bot so you can
create a custom experience for your unique audience.
 Why Facebook bot?
 Web plugins - Using plugins, codes and links people can discover your bot and start
conversations.
 Customer Matching - Customer matching allows you to reach people in Messenger if
you have their phone number and their consent to be contacted by you.
 Structured Templates - You can format your messages in a variety of ways. Send
simple text and images, or use our structured templates to customize your message
bubbles.
 User Controls - Provides people with even more ways to control the conversation and
make sure they can reach the businesses they care about.
Prerequisite
 Good JavaScript knowledge
 Ngrok installed(Secure tunnels to localhost)
 Facebook page
 Node server running
 WIT account (NLP)
 Firebase account (Google database)
 Browser
Demo (CNN - https://www.facebook.com/cnn/)
CNN was among the first publishers to launch a bot in April, which is available to its global
audience. CNN currently has a Facebook audience of 22 ML people, and CNN International has 12
ML. You can ask for news as per your interest by writing, for ex: “Latest on Donald Trump”
Let’s do some
installations first
Installation : Facebook page
 Go to your app dashboard page - https://developers.facebook.com/apps/
 Create new app by clicking messenger tab
 Generate your access token
 Subscribe your page for webhook
 Create your callback url after installing ngrok and set your token in config file
 Update your webhook details as shown below under webhook tab on Facebook
page
You must need a Facebook page to start with, which provides you complete
features including a button to start your chat.
Installation : Ngrok
You also need to setup a secure tunnel to your localhost server. Ngrok is a tool
that allows you to easily expose your localhost server to the outside world.
Make sure your firewall won’t block this.
 Download ngrok - https://ngrok.com/
 Open command prompt and run “ngrok http 80”
 Copy randomly generated domain name to link with Facebook
webhook, here it is “https://9d71cd26.ngrok.io”
Installation : Node server
You also need to setup a node server on your localhost, which is responsible to
handle and respond all the client/user requests. This server will act as a
webhook or callback handler to Facebook API.
 Download nodejs - https://nodejs.org/en/
 Download framework from github
 Go to synced folder
 Open command prompt and run “npm install”
 “/webhook/” with post request is implemented to handle all the
request.
Facebook
Messenger Platform
Facebook Presentation layer
Template types
 Text message
 Audio message
 Video message
 Option List
 Carousel
 Quick replies
 Persistent Menu
 Airlines templates
Facebook messenger platform provides presentation layer, which has all the
required templates. You don’t need to write any HTML or CSS for this.
Structured Messages :- Structured messages support multiple templates to enable
different kinds of use cases. The button and generic template can render buttons
that open a URL or make a back-end call to your webhook. And the receipt
template can be used to send the receipt.
Facebook Presentation layer
These templates contains Normal text, Option list, Quick replies and share location.
Facebook Presentation layer
These templates contains Order receipt, Dialog popup and Airlines design.
Do we need a Framework?
Imagine, you need to develop couple of chatbots which will
help you to book movie tickets, order food like pizza or burger
and book your table in some restaurant.
Problem : You need to setup server, client, configuration file,
define templates, structure your code, integrate your chatbots
with NPL processors/engines and store chat history somewhere
to cloud server.
Solution : This framework provides pre-designed Facebook
templates, built-in integration of system with WIT (NPL engine)
and cloud database (Google Firebase) with your application. All
you need is to put your questions in some JSON file, and load it
in JavaScript object and run your application. You can further
map your questions with WIT API as per your application flow.
The framework will automatically save the chat history on cloud
server i.e. firebase.
Facebook Templates
 Text message template
In this template all you need is “message” that you want to send and a 16
digit user’s Facebook id like “1100223344556677” to identify the user
 Option list template
The list template is a template that allows you to present a set of items
vertically. It can be rendered in two different ways. One list comes with action
buttons, for ex:- Add to cart, Buy now etc. while the other one comes with
normal list, with or without a product image
 Carousel list template
 Carousel list template is generic template and follows almost the same
structure of option list, but it displays it’s data in carousel instead.
 Receipt template
 Receipt templates are used to send order confirmation to the API, with the
transaction summary and description for each item.
Facebook Templates
Option List Template Receipt Template
Framework Design
 Presentation layer
Presentation layer is provided by Facebook
only, no need to create any html or style.
 Application Layer
Application layer plays the role of webhook
handler, means it handles all the postback
reply and direct text messages of user.
 WIT layer
WIT layer or API is used to process human
natural language
 Service Layer
Service layer is responsible to send messages
to the user, process user request and apply
specified template as per requirement.
 Data Layer
Data can be drive either from any static JSON
file or firebase, both methods are available
with the framework.
Framework Application Flow
Facebook Messenger Platform Framework
Framework files description
 Configuration file
This file is created to store all the configuration of framework including Facebook access token,
WIT API token, firebase option settings, server details like port, IP address and application flow
mapping.
 Chat response handler
This handler is the main handler which handles all the requests from Facebook including post-
back and direct text request. This handler also manages what could be the next question to ask.
 Template manager
Template manager contains all the pure functions and return templates as per Facebook
guidelines.
 Service handler
This handler is responsible to save user conversation, send messages, and map Facebook
templates.
 Data origin/load
Data can be provided to system either from static JSON file or any database like firebase. This
framework has an option to ingrate anyone of the these option.
 User class handler
User class is created to store user information and his/her activities after he/she start the chat
session.
Utterance (WIT.AI)
 Wit.ai makes it easy for developers to build applications and devices that you can talk or text to.
Wit.ai learns human language from every interaction. They have recently extends their previous
intent-oriented approach to story oriented approach.
 In Wit.ai we can use Entities, Intents, Context and Actions concepts that together form the model
based on Machine Learning, and statistics can be used for understanding the language.
Database(Google Firebase)
Firebase is a mobile platform that helps you quickly develop high-quality apps, grow your user
base, and earn more money. Firebase is made up of complementary features that you can mix-
and-match to fit your needs. The company was acquired by Google in October 2014, and added a
significant number of new features in by May 2016. Firebase can be the fastest and one of the
recommended option for chatbot applications, whenever you want to save your chat history.
Framework Source Code
For more information or quick documentation and source code, you can
check out the below link on GitHub.
https://github.com/rammurat/facebook-bot-framework
Thank You

More Related Content

PDF
Chat bots101 - practical insights on the business of bots
 
PDF
chatbot and messenger as a platform
PPTX
PPTX
Chatbot: What is it ?
PDF
Build your first messenger bot
PPTX
Microsoft bot framework
PPTX
Microsoft Botframework and LUIS
PDF
#BeBot Meetup - Chatbots & LUIS by Nick Trogh (Microsoft)
Chat bots101 - practical insights on the business of bots
 
chatbot and messenger as a platform
Chatbot: What is it ?
Build your first messenger bot
Microsoft bot framework
Microsoft Botframework and LUIS
#BeBot Meetup - Chatbots & LUIS by Nick Trogh (Microsoft)

What's hot (20)

PPTX
Bots presentation
PDF
Introduction to Chat Bots
PPTX
Building intelligent chat bot with microsoft bot framework
PPTX
Whats a Chat bot
PPTX
20160930 bot framework workshop
PPTX
An introduction to Microsoft Bot Framework
PPTX
Tokyo azure meetup #13 build bots with azure bot services
PPT
Instant Messenger Using Adobe Flash Lite
PPTX
Chatbot ppt
PPTX
Build a Great Conversationalist
PPTX
AI Machine vs Human
PDF
Dialogflow
PPTX
Build an Intelligent Bot (Node.js)
PPTX
Artificially Intelligent chatbot Implementation
PPT
What an RP Wants, Part 2
PPTX
Practical Microsoft Bot Framework for Office 365 developers
PDF
Developing Intelligent Chatbots using RASA, OW2con'19, June 12-13, 2019 in Paris
 
PPTX
Chatbot development with Microsoft Bot Framework
PDF
김영욱 - Microsoft Bot Framework [WSConf. Seoul 2017]
PPTX
ESPC Teams week Microsoft Teams & Bot Framework – a Developer’s Perspective
Bots presentation
Introduction to Chat Bots
Building intelligent chat bot with microsoft bot framework
Whats a Chat bot
20160930 bot framework workshop
An introduction to Microsoft Bot Framework
Tokyo azure meetup #13 build bots with azure bot services
Instant Messenger Using Adobe Flash Lite
Chatbot ppt
Build a Great Conversationalist
AI Machine vs Human
Dialogflow
Build an Intelligent Bot (Node.js)
Artificially Intelligent chatbot Implementation
What an RP Wants, Part 2
Practical Microsoft Bot Framework for Office 365 developers
Developing Intelligent Chatbots using RASA, OW2con'19, June 12-13, 2019 in Paris
 
Chatbot development with Microsoft Bot Framework
김영욱 - Microsoft Bot Framework [WSConf. Seoul 2017]
ESPC Teams week Microsoft Teams & Bot Framework – a Developer’s Perspective
Ad

Viewers also liked (20)

PDF
Microsoft Bot framework 概要
PDF
Office365とオンプレミス製品の共存(MVP Community Camp 2015)
PDF
Chatbot Meetup
PDF
Facebook Messenger: The Path to Monetization
PPTX
Dockerを使ってOSコマンドインジェクションが出来るSlack botを作った話
PDF
【Mobidays】KM-Report 2016年9月
PPTX
サンタBot説明
PPTX
Facebook bot(20160518)
PDF
LINE@ 新手帳號設定五步驟介紹
PDF
我が家を支えるChatOps
PDF
やるおがtriphone HMMを作るようです
PPTX
Slackとgoogle appsscript(js)で作る俺の秘書ハンズオン
PDF
Bot に家計を任せる
PPTX
Intro to Bot Framework
PDF
Bot mashup world LT Bot ✖️ HMM
PPTX
千里之行,始於足下:動手寫自己的App
PDF
DDoS対策の自動化
PDF
Botと対話する
PDF
Bots are the New Apps: Building with the Bot Framework & Language Understanding
PDF
[mobidays]KM-Report(韩国移动市场的最新潮流一目了然)
Microsoft Bot framework 概要
Office365とオンプレミス製品の共存(MVP Community Camp 2015)
Chatbot Meetup
Facebook Messenger: The Path to Monetization
Dockerを使ってOSコマンドインジェクションが出来るSlack botを作った話
【Mobidays】KM-Report 2016年9月
サンタBot説明
Facebook bot(20160518)
LINE@ 新手帳號設定五步驟介紹
我が家を支えるChatOps
やるおがtriphone HMMを作るようです
Slackとgoogle appsscript(js)で作る俺の秘書ハンズオン
Bot に家計を任せる
Intro to Bot Framework
Bot mashup world LT Bot ✖️ HMM
千里之行,始於足下:動手寫自己的App
DDoS対策の自動化
Botと対話する
Bots are the New Apps: Building with the Bot Framework & Language Understanding
[mobidays]KM-Report(韩国移动市场的最新潮流一目了然)
Ad

Similar to Facebook Messenger Platform Framework (20)

PPTX
Facebook Build day
PDF
Building chat bots using ai platforms (wit.ai or api.ai) in nodejs
PPTX
Chatbots
PPT
Facebook Technology Stack
PDF
Build a chatroom!
PPTX
Facebook thrift
PDF
Serverless Finland Meetup 16.11.2016: Messenger Bot Workshop
PDF
Introduction to Facebook Messenger, Conversational UI & NLP
PPTX
facebookthrift-151001153400-lva1-app6891.pptx
PDF
The future of bots and how to use them to drive sustainable growth
PDF
Frankly Chat Competitive Analysis
PDF
Build social apps for Facebook
PDF
Chatbots for Brand Representation in Comparison with Traditional Websites
PPT
Facebook API
PPT
Facebook api
PDF
Basic Introduction to Web Development
PPTX
Architecture of Facebook
DOCX
Saloni jaiswal mba-2nd semester_miniproject
PDF
14 Most Powerful Platforms to Build a Chatbot.pdf
PDF
14 Most Powerful Platforms to Build a Chatbot.pdf
Facebook Build day
Building chat bots using ai platforms (wit.ai or api.ai) in nodejs
Chatbots
Facebook Technology Stack
Build a chatroom!
Facebook thrift
Serverless Finland Meetup 16.11.2016: Messenger Bot Workshop
Introduction to Facebook Messenger, Conversational UI & NLP
facebookthrift-151001153400-lva1-app6891.pptx
The future of bots and how to use them to drive sustainable growth
Frankly Chat Competitive Analysis
Build social apps for Facebook
Chatbots for Brand Representation in Comparison with Traditional Websites
Facebook API
Facebook api
Basic Introduction to Web Development
Architecture of Facebook
Saloni jaiswal mba-2nd semester_miniproject
14 Most Powerful Platforms to Build a Chatbot.pdf
14 Most Powerful Platforms to Build a Chatbot.pdf

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
A Presentation on Artificial Intelligence
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A Presentation on Artificial Intelligence
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
NewMind AI Weekly Chronicles - August'25 Week I
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Modernizing your data center with Dell and AMD
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
CIFDAQ's Market Insight: SEC Turns Pro Crypto
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Electronic commerce courselecture one. Pdf

Facebook Messenger Platform Framework

  • 1. Ram Murat Sharma, @rammrms rammurat.rms.sharma0@gmail.com
  • 2. Agenda  Introduction  Bots  Facebook bots  Prerequisite  Demo  CNN  Installations  Facebook page  Ngrok (Secure tunnels to localhost)  Node server  Facebook presentation layer (Structured Messages)  Facebook templates  Do we need a framework  Framework design  Framework application flow  File structure  WIT API  Firebase database  Future of bots  Framework source code
  • 3. Introduction to chat bots  Bots are simple artificial intelligence systems that you interact with via text. Those interactions can be straight forward, like asking a bot to give you a weather report, or more complex, like having one troubleshoot a problem with your internet service.  Short for chat robot, a computer program that simulates human conversation, or chat, through artificial intelligence.  Chat bots are used in applications such as ecommerce customer service, call centers and Internet gaming. Chat bots used for these purposes are typically limited to conversations regarding a specialized purpose and not for the entire range of human communication.
  • 4. Introduction to FB Bots  The Messenger Platform gives you the ability to have conversations with people on Messenger. We've added new tools for you to build and promote your bot so you can create a custom experience for your unique audience.  Why Facebook bot?  Web plugins - Using plugins, codes and links people can discover your bot and start conversations.  Customer Matching - Customer matching allows you to reach people in Messenger if you have their phone number and their consent to be contacted by you.  Structured Templates - You can format your messages in a variety of ways. Send simple text and images, or use our structured templates to customize your message bubbles.  User Controls - Provides people with even more ways to control the conversation and make sure they can reach the businesses they care about.
  • 5. Prerequisite  Good JavaScript knowledge  Ngrok installed(Secure tunnels to localhost)  Facebook page  Node server running  WIT account (NLP)  Firebase account (Google database)  Browser
  • 6. Demo (CNN - https://www.facebook.com/cnn/) CNN was among the first publishers to launch a bot in April, which is available to its global audience. CNN currently has a Facebook audience of 22 ML people, and CNN International has 12 ML. You can ask for news as per your interest by writing, for ex: “Latest on Donald Trump”
  • 8. Installation : Facebook page  Go to your app dashboard page - https://developers.facebook.com/apps/  Create new app by clicking messenger tab  Generate your access token  Subscribe your page for webhook  Create your callback url after installing ngrok and set your token in config file  Update your webhook details as shown below under webhook tab on Facebook page You must need a Facebook page to start with, which provides you complete features including a button to start your chat.
  • 9. Installation : Ngrok You also need to setup a secure tunnel to your localhost server. Ngrok is a tool that allows you to easily expose your localhost server to the outside world. Make sure your firewall won’t block this.  Download ngrok - https://ngrok.com/  Open command prompt and run “ngrok http 80”  Copy randomly generated domain name to link with Facebook webhook, here it is “https://9d71cd26.ngrok.io”
  • 10. Installation : Node server You also need to setup a node server on your localhost, which is responsible to handle and respond all the client/user requests. This server will act as a webhook or callback handler to Facebook API.  Download nodejs - https://nodejs.org/en/  Download framework from github  Go to synced folder  Open command prompt and run “npm install”  “/webhook/” with post request is implemented to handle all the request.
  • 12. Facebook Presentation layer Template types  Text message  Audio message  Video message  Option List  Carousel  Quick replies  Persistent Menu  Airlines templates Facebook messenger platform provides presentation layer, which has all the required templates. You don’t need to write any HTML or CSS for this. Structured Messages :- Structured messages support multiple templates to enable different kinds of use cases. The button and generic template can render buttons that open a URL or make a back-end call to your webhook. And the receipt template can be used to send the receipt.
  • 13. Facebook Presentation layer These templates contains Normal text, Option list, Quick replies and share location.
  • 14. Facebook Presentation layer These templates contains Order receipt, Dialog popup and Airlines design.
  • 15. Do we need a Framework? Imagine, you need to develop couple of chatbots which will help you to book movie tickets, order food like pizza or burger and book your table in some restaurant. Problem : You need to setup server, client, configuration file, define templates, structure your code, integrate your chatbots with NPL processors/engines and store chat history somewhere to cloud server. Solution : This framework provides pre-designed Facebook templates, built-in integration of system with WIT (NPL engine) and cloud database (Google Firebase) with your application. All you need is to put your questions in some JSON file, and load it in JavaScript object and run your application. You can further map your questions with WIT API as per your application flow. The framework will automatically save the chat history on cloud server i.e. firebase.
  • 16. Facebook Templates  Text message template In this template all you need is “message” that you want to send and a 16 digit user’s Facebook id like “1100223344556677” to identify the user  Option list template The list template is a template that allows you to present a set of items vertically. It can be rendered in two different ways. One list comes with action buttons, for ex:- Add to cart, Buy now etc. while the other one comes with normal list, with or without a product image  Carousel list template  Carousel list template is generic template and follows almost the same structure of option list, but it displays it’s data in carousel instead.  Receipt template  Receipt templates are used to send order confirmation to the API, with the transaction summary and description for each item.
  • 17. Facebook Templates Option List Template Receipt Template
  • 18. Framework Design  Presentation layer Presentation layer is provided by Facebook only, no need to create any html or style.  Application Layer Application layer plays the role of webhook handler, means it handles all the postback reply and direct text messages of user.  WIT layer WIT layer or API is used to process human natural language  Service Layer Service layer is responsible to send messages to the user, process user request and apply specified template as per requirement.  Data Layer Data can be drive either from any static JSON file or firebase, both methods are available with the framework.
  • 21. Framework files description  Configuration file This file is created to store all the configuration of framework including Facebook access token, WIT API token, firebase option settings, server details like port, IP address and application flow mapping.  Chat response handler This handler is the main handler which handles all the requests from Facebook including post- back and direct text request. This handler also manages what could be the next question to ask.  Template manager Template manager contains all the pure functions and return templates as per Facebook guidelines.  Service handler This handler is responsible to save user conversation, send messages, and map Facebook templates.  Data origin/load Data can be provided to system either from static JSON file or any database like firebase. This framework has an option to ingrate anyone of the these option.  User class handler User class is created to store user information and his/her activities after he/she start the chat session.
  • 22. Utterance (WIT.AI)  Wit.ai makes it easy for developers to build applications and devices that you can talk or text to. Wit.ai learns human language from every interaction. They have recently extends their previous intent-oriented approach to story oriented approach.  In Wit.ai we can use Entities, Intents, Context and Actions concepts that together form the model based on Machine Learning, and statistics can be used for understanding the language.
  • 23. Database(Google Firebase) Firebase is a mobile platform that helps you quickly develop high-quality apps, grow your user base, and earn more money. Firebase is made up of complementary features that you can mix- and-match to fit your needs. The company was acquired by Google in October 2014, and added a significant number of new features in by May 2016. Firebase can be the fastest and one of the recommended option for chatbot applications, whenever you want to save your chat history.
  • 24. Framework Source Code For more information or quick documentation and source code, you can check out the below link on GitHub. https://github.com/rammurat/facebook-bot-framework