{"id":7953,"date":"2017-05-09T15:27:46","date_gmt":"2017-05-09T09:57:46","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=7953"},"modified":"2017-05-09T15:27:46","modified_gmt":"2017-05-09T09:57:46","slug":"create-facebook-messenger-bot-guide","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/create-facebook-messenger-bot-guide\/","title":{"rendered":"How to Create a Facebook Messenger Bot (Guide)"},"content":{"rendered":"<p>There are lot of\u00a0awesome bots\u00a0already exist in Facebook\u2019s. \u201cMessenger bots\u201d feature is nothing new. However, the resources\u00a0regarding exactly how to build your very own bot are unusual, and lacking in explanation for people who are beginner to the Facebook\u00a0Graph API. Messenger bots now also require you to use a SSL secured webhook callback URL, and setting up SSL is not for everyone, and also costs money.<\/p>\n[ad type=&#8221;square&#8221;]\n<p>Let\u2019s see a clear explanation about the entire process of creating a simple Facebook messenger bot, because Facebook\u2019s own documents are not clearly explained. We will set up a cloud app that uses <strong>https<\/strong> protocol, code the bot in\u00a0<strong>Node.js<\/strong> (which is a\u00a0javascript, server-side language), use git to push the code to the cloud application, and test it out on Facebook Messenger.<\/p>\n<h4 id=\"setup-bot\"><span style=\"color: #993300;\"><strong>Setup\u00a0Bot<\/strong><\/span><\/h4>\n<p>You will need Node\u00a0installed on your laptop. If you don\u2019t, go to the\u00a0<a href=\"https:\/\/nodejs.org\/en\/\" target=\"_blank\" rel=\"noopener\">Node website<\/a>\u00a0to download and install it.<\/p>\n<p>Once you are done, you can continue with the setup for the bot. Follow the steps below:<\/p>\n<ol>\n<li>Launch Terminal.<\/li>\n<li>You need a separate directory for holding your code.<\/li>\n<\/ol>\n<ul>\n<li>Make a new directory<br \/>\nmkdir\u00a0testbot<\/li>\n<li>Change your working directory to the directory you just created<br \/>\ncd testbot<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"size-full wp-image-7976\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/1-33.png\" alt=\"\" width=\"640\" height=\"34\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/1-33.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/1-33-300x16.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<ol start=\"3\">\n<li>Next, initialise the Node application.<br \/>\nnpm init<\/li>\n<\/ol>\n<ul>\n<li>You will be asked to enter information about your application, just use the defaults by pressing Enter for everything.<\/li>\n<\/ul>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-7977 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/2-37.png\" alt=\"\" width=\"640\" height=\"636\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/2-37.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/2-37-150x150.png 150w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/2-37-300x298.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<ol start=\"4\">\n<li>Install\u00a0packages<br \/>\nnpm\u00a0install express body-parser request &#8211;save<\/li>\n<\/ol>\n<ul>\n<li>The command will run, and give some warnings; ignore them.<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"size-full wp-image-7978 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/3-28.png\" alt=\"\" width=\"640\" height=\"798\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/3-28.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/3-28-241x300.png 241w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n[ad type=&#8221;banner&#8221;]\n<ol start=\"5\">\n<li>In Finder, open the directory \u201c<strong>testbot<\/strong>\u201d that you created, and find the file named \u201c<strong>package.json<\/strong>\u201c; open this in an editor like Sublime Text.<\/li>\n<li>In this file, we need to add a line<br \/>\n&#8220;start&#8221;: &#8220;node index.js&#8221;<\/li>\n<\/ol>\n<ul>\n<li>Don\u2019t forget to append a<strong>\u201c,\u201d<\/strong>\u00a0at the end of the previous line.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7979 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/4-28.png\" alt=\"\" width=\"640\" height=\"353\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/4-28.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/4-28-300x165.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<ol start=\"7\">\n<li>Next, create a new file in Sublime Text, and put in the following code inside it:<\/li>\n<\/ol>\n<blockquote><p>var express = require(&#8216;express&#8217;);<\/p>\n<p>var bodyParser = require(&#8216;body-parser&#8217;);<\/p>\n<p>var request = require(&#8216;request&#8217;);<\/p>\n<p>var app = express();<\/p>\n<p>app.use(bodyParser.urlencoded({extended: false}));<\/p>\n<p>app.use(bodyParser.json());<\/p>\n<p>app.listen((process.env.PORT || 3000));<\/p>\n<p>app.get(&#8216;\/&#8217;, function (req, res) {<\/p>\n<p>res.send(&#8216;This is TestBot Server&#8217;);<\/p>\n<p>});<\/p>\n<p>app.get(&#8216;\/webhook&#8217;, function (req, res) {<\/p>\n<p>if (req.query[&#8216;hub.verify_token&#8217;] === &#8216;testbot_verify_token&#8217;) {<\/p>\n<p>res.send(req.query[&#8216;hub.challenge&#8217;]);<\/p>\n<p>} else {<\/p>\n<p>res.send(&#8216;Invalid verify token&#8217;);<\/p>\n<p>}<\/p>\n<p>});<\/p><\/blockquote>\n<p>Save this file as\u00a0<strong>index.js<\/strong><\/p>\n<p><strong>Note:<\/strong><strong>\u00a0<\/strong>In Line 13, the value of \u2018hub.verify_token\u2019 is set as \u2018<strong>testbot_verify_token\u2019<\/strong>, remember this value as it will be used when creating the webhook in\u00a0Facebook.<\/p>\n<h4 id=\"create-git-repository\"><span style=\"color: #ff6600;\"><strong>Create Git Repository<\/strong><\/span><\/h4>\n<p>Now that we have set up our bot\u2019s callback handling, we need to push the code to\u00a0Heroku. For that, we need to create a git repository in our directory.<\/p>\n<p><strong>Note:\u00a0<\/strong>\u201cgit\u201d is a version control system for\u00a0files and software code. You can read more about it on\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Git_(software)\" target=\"_blank\" rel=\"noopener\">Wikipedia<\/a>.<\/p>\n<p>Creating a git repository is easy, and only takes a couple of Terminal commands.<\/p>\n<p><strong>Note:\u00a0<\/strong>Make sure you are inside the \u201c<strong>testbot<\/strong>\u201d directory in the Terminal. You can do this by typing the command\u00a0pwd\u00a0into the Terminal.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7981 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/5-23.png\" alt=\"\" width=\"640\" height=\"38\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/5-23.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/5-23-300x18.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Follow these steps to\u00a0create a git repository:<\/p>\n<blockquote>\n<ol>\n<li>git init<\/li>\n<li>git add .<\/li>\n<li>git commit -m &#8220;Register Facebook Webhook&#8221;<\/li>\n<\/ol>\n<\/blockquote>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7982 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/6-24.png\" alt=\"\" width=\"640\" height=\"65\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/6-24.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/6-24-300x30.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h4 id=\"setup-heroku\"><span style=\"color: #99cc00;\"><strong>Setup Heroku<\/strong><\/span><\/h4>\n<p>Before we even go into Facebook\u2019s developer pages, we need a callback URL that Facebook can talk to. This URL needs to use the\u00a0<strong>https protocol<\/strong>, which means we need to install an SSL certificate on our website; but, this is a beginner\u2019s guide to Facebook messenger bots, so let\u2019s not complicate things. We\u2019ll use Heroku to deploy our code. Heroku gives you https URLs for your applications and has a free plan which meets our (very basic) demands.<\/p>\n<p>Go to the\u00a0<a href=\"http:\/\/heroku.com\/\" target=\"_blank\" rel=\"noopener\">Heroku website<\/a>\u00a0and register yourself.<\/p>\n<p><strong>Note:\u00a0<\/strong>In the field that says \u201cPick Your Primary Development Language\u201d, use \u201cI use another Language\u201d.<\/p>\n<p>Once you\u2019re done with that, install the\u00a0<a href=\"https:\/\/toolbelt.heroku.com\/\" target=\"_blank\" rel=\"noopener\">Heroku toolbelt<\/a>\u00a0for your OS (Mac, for me), and install it. This will give you access to\u00a0Heroku on your Terminal (or command prompt, on Windows).<\/p>\n<p>Next, we will create an app on Heroku, which will hold the entire code for our bot. Follow the steps below:<\/p>\n<ol>\n<li>Launch Terminal<\/li>\n<li>Typeheroku login<\/li>\n<\/ol>\n<ul>\n<li>You will be asked to enter your email and password.<\/li>\n<li>Type your email, hit Enter; then, type your password, hit Enter.<\/li>\n<li>You will be logged in to heroku<\/li>\n<\/ul>\n<ol start=\"3\">\n<li>Typeheroku create<\/li>\n<\/ol>\n<ul>\n<li>This will create an app on Heroku and provide you with a hyperlink. Note that the link is using the https protocol. Easy, right?<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7983 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/7-23.png\" alt=\"\" width=\"640\" height=\"64\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/7-23.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/7-23-300x30.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n[ad type=&#8221;banner&#8221;]\n<ol start=\"4\">\n<li>Now you can push your app code to Heroku<br \/>\ngit push heroku master<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7984 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/8-19.png\" alt=\"\" width=\"640\" height=\"194\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/8-19.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/8-19-300x91.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>5.Once this is done, your app is basically live, and you can visit the link in your browser to check that everything is \u00a0 \u00a0 \u00a0 \u00a0 working fine. It should open a webpage saying \u201c<strong>This is TestBot Server<\/strong>\u201c.<\/p>\n<h4 id=\"facebook-setup\"><span style=\"color: #993300;\"><strong>Facebook Setup<\/strong><\/span><\/h4>\n<p>It\u2019s time to connect our bot to Facebook! You will need to create a new Facebook Page or use an existing one that you own. I\u2019ll show you how to proceed by creating a new Facebook Page.<\/p>\n<p>1.Go to Facebook and\u00a0<a href=\"https:\/\/www.facebook.com\/pages\/create\/?ref_type=logout_gear\" target=\"_blank\" rel=\"noopener\">create a new page<\/a>.<\/p>\n<ul>\n<li>You can create a page in whichever category you want. I\u2019m opting for Company\/Organisation, for no particular reason.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7985 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/9-18.png\" alt=\"\" width=\"640\" height=\"475\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/9-18.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/9-18-300x223.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>2.The next steps that Facebook shows are optional, and can be skipped.<\/p>\n<p>3.Next, head over to the\u00a0<a href=\"https:\/\/developers.facebook.com\/\" target=\"_blank\" rel=\"noopener\">Facebook Developers\u2019 Website<\/a>.<\/p>\n<ul>\n<li>On the top-right,\u00a0hover your mouse on \u201c<strong>My Apps<\/strong>\u201d and then click on \u201c<strong>Add a New App<\/strong>\u201d from the drop-down menu.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7986 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/10-16.png\" alt=\"\" width=\"640\" height=\"433\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/10-16.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/10-16-300x203.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<ul>\n<li>Click on \u201c<strong>basic setup<\/strong>\u201d when Facebook prompts you to choose a platform.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7987 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/11-8.png\" alt=\"\" width=\"640\" height=\"353\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/11-8.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/11-8-300x165.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>4.Fill up the details for your App Name and contact email address.<\/p>\n<ul>\n<li>Select \u201c<strong>Apps for Pages<\/strong>\u201d in the Category.<\/li>\n<li>Click on \u201c<strong>Create App ID<\/strong>\u201c.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7989 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/12-6.png\" alt=\"\" width=\"640\" height=\"364\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/12-6.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/12-6-300x171.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>5.You will be taken to the dashboard for your app. On the sidebar, navigate to \u201c<strong>+Add Products<\/strong>\u201d and select \u201c<strong>Messenger<\/strong>\u201d by clicking on the \u201c<strong>Get Started<\/strong>\u201d button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7990 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/13-2.png\" alt=\"\" width=\"640\" height=\"397\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/13-2.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/13-2-300x186.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>6.Select \u201c<strong>Setup Webhooks<\/strong>\u201c.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7991 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/14-1.png\" alt=\"\" width=\"640\" height=\"469\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/14-1.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/14-1-300x220.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n[ad type=&#8221;banner&#8221;]\n<p>7.Fill up the required fields, replacing the \u201cCallback URL\u201d with the URL of the Heroku app, Verify Token with the token used in the index.js file, and select the\u00a0following Subscription Fields:<\/p>\n<ul>\n<li>message_deliveries<\/li>\n<li>messages<\/li>\n<li>message_optins<\/li>\n<li>messaging_post backs<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7992 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/15-1.png\" alt=\"\" width=\"640\" height=\"297\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/15-1.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/15-1-300x139.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Note:\u00a0<\/strong>Make sure you append \u201c<strong>\/webhook<\/strong>\u201d to the Callback URL so that index.js executes the required function when Facebook tries to ping the URL, it can verify the \u201cVerify Token\u201d.<\/p>\n<p>8.Click on \u201c<strong>Verify and Save<\/strong>\u201c.<\/p>\n<p>9.In the \u201c<strong>Token Generation<\/strong>\u201d section, click on \u201c<strong>Select a Page<\/strong>\u201d and select the page you created earlier.<\/p>\n<p>This will generate a \u201c<strong>Page Access Token<\/strong>\u201c, save it somewhere; you will need it later.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7993 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/16-1.png\" alt=\"\" width=\"640\" height=\"354\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/16-1.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/16-1-300x166.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>10.Next,\u00a0you will have to make a POST query to your app, using the Page Access Token generated in the last step. This can be easily done in the Terminal. Just run the following command,<strong>replacing PAGE_ACCESS_TOKEN with the Page Access Token you generated<\/strong>.<\/p>\n<p>curl\u00a0-X POST \u201chttps:\/\/graph.facebook.com\/v2.6\/me\/subscribed_apps?access_token=PAGE_ACCESS_TOKEN\u201d<\/p>\n<p>You\u00a0should receive a \u201c<strong>success<\/strong>\u201d response in the Terminal.<\/p>\n<h4 id=\"more-heroku-setup\"><span style=\"color: #ff6600;\"><strong>More Heroku Setup<\/strong><\/span><\/h4>\n<p>Yeah, we\u2019re not done, yet. Not nearly.<\/p>\n<p>1.Go to the Heroku website and log in with your email ID.<\/p>\n<p>2.Locate your app in the \u201cdashboard\u201d and click on it.<\/p>\n<p>3.Navigate to the Settings tab.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7994 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/17-1.png\" alt=\"\" width=\"640\" height=\"463\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/17-1.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/17-1-300x217.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>4.Click on \u201c<strong>Reveal Config Vars<\/strong>\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7995 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/18-1.png\" alt=\"\" width=\"640\" height=\"182\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/18-1.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/18-1-300x85.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>5.Add the PAGE_ACCESS_TOKEN as a \u201c<strong>config var<\/strong>\u201c, and click \u201c<strong>Add<\/strong>\u201c.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7996 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/19.png\" alt=\"\" width=\"640\" height=\"199\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/19.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/19-300x93.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h4 id=\"coding-the-actual-bot\"><span style=\"color: #99cc00;\"><strong>Coding the Actual Bot<\/strong><\/span><\/h4>\n<p>Now that we\u2019re done with the grunt work, we can focus on what really matters: making\u00a0the bot respond to\u00a0messages. To start off, we\u2019ll just design a bot that simply echoes the messages it receives. As it turns out, this simple task requires a considerable bit of code to function.<\/p>\n<h4 id=\"1-coding-the-message-listener\"><span style=\"color: #993300;\"><strong>1.<\/strong><strong>\u00a0<\/strong><strong>Coding the Message Listener<\/strong><\/span><\/h4>\n<p>Before the bot can echo back the message, it needs to be able to listen for messages. Let\u2019s do that first.<\/p>\n<p>In the index.js file, add the following code:<\/p>\n<blockquote><p>app.post(&#8216;\/webhook&#8217;, function (req, res) {<\/p>\n<p>var events = req.body.entry[0].messaging;<\/p>\n<p>for (i = 0; i &lt; events.length; i++) {<\/p>\n<p>var event = events[i];<\/p>\n<p>if (event.message &amp;&amp; event.message.text) {<\/p>\n<p>sendMessage(event.sender.id, {text: &#8220;Echo: &#8221; + event.message.text});<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>res.sendStatus(200);<\/p>\n<p>});<\/p><\/blockquote>\n<p>What this function does, is it checks for received messages, and then checks if there is text in the message. If it finds text in the received message, it calls the sendMessage (shown later) function, passing the sender\u2019s ID and the text to send back. It\u2019s important to understand the following\u00a0values and what they mean:<\/p>\n<ul>\n<li>message.text is the text received in the message. For example, if someone sends the message \u201cHello\u201d to our bot, the value of event.message.text will be \u201cHello\u201d.<\/li>\n<li>sender.id is the id of the person who sent the message to the bot. This is required so that the bot knows whom to address the response to.<\/li>\n<\/ul>\n<h4 id=\"2-coding-the-sendmessage-function\"><span style=\"color: #ff6600;\"><strong>2.\u00a0Coding the sendMessage Function<\/strong><\/span><\/h4>\n<p>Lets code the \u201csendMessage\u201d function, now.<\/p>\n<blockquote><p>function sendMessage(recipientId, message) {<\/p>\n<p>request({<\/p>\n<p>url: &#8216;https:\/\/graph.facebook.com\/v2.6\/me\/messages&#8217;,<\/p>\n<p>qs: {access_token: process.env.PAGE_ACCESS_TOKEN},<\/p>\n<p>method: &#8216;POST&#8217;,<\/p>\n<p>json: {<\/p>\n<p>recipient: {id: recipientId},<\/p>\n<p>message: message,<\/p>\n<p>}<\/p>\n<p>}, function(error, response, body) {<\/p>\n<p>if (error) {<\/p>\n<p>console.log(&#8216;Error sending message: &#8216;, error);<\/p>\n<p>} else if (response.body.error) {<\/p>\n<p>console.log(&#8216;Error: &#8216;, response.body.error);<\/p>\n<p>}<\/p>\n<p>});<\/p>\n<p>};<\/p><\/blockquote>\n<p>The \u201csendMessage\u201d function takes two parameters:<\/p>\n<ul>\n<li>recipientId<\/li>\n<li>message<\/li>\n<\/ul>\n<p>The recipientId is required so that the message can be addressed to the correct user.<\/p>\n<p>The message is the actual text that is to be sent in the response.<\/p>\n<h4 id=\"3-pushing-the-changes-to-heroku\"><span style=\"color: #99cc00;\"><strong>3.\u00a0Pushing the Changes to Heroku<\/strong><\/span><\/h4>\n<p>If you have completed the steps above, your bot should be able to echo back the received text. But first, you have to push the changes to the application hosted on Heroku. To do this, follow the steps given below:<\/p>\n<ol>\n<li>Launch Terminal.<\/li>\n<li>Change directory to your testbot directory<br \/>\ncd testbot<\/li>\n<li>Do the following steps:<\/li>\n<\/ol>\n<ul>\n<li>git add .<\/li>\n<li><strong>Note:\u00a0<\/strong>There is a \u201c.\u201d at the end of \u201cgit add\u201d<\/li>\n<li>git commit -m \u201cFirst commit\u201d<\/li>\n<li>git push heroku master<\/li>\n<\/ul>\n<ol start=\"4\">\n<li>Now send a message to your page, and the bot will echo the message back to you.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7998 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/20.png\" alt=\"\" width=\"350\" height=\"621\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/20.png 350w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/20-169x300.png 169w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/p>\n<h4 id=\"conditional-responses-aka-making-the-bot-smarter\"><span style=\"color: #993300;\"><strong>Conditional Responses aka Making the Bot Smarter<\/strong><\/span><\/h4>\n<p>We can use text matching to allow our\u00a0Facebook messenger bot to respond according to certain special keywords.<\/p>\n<p>To achieve this, we need to add another function. I\u2019m naming it \u201cconditionalResponses\u201d, but you can choose whatever name you prefer.<\/p>\n<h4 id=\"1-coding-the-conditional-responses-function\"><span style=\"color: #ff6600;\"><strong>1.\u00a0Coding the conditional Responses Function<\/strong><\/span><\/h4>\n<blockquote><p>function conditionalResponses(recipientId, text) {<\/p>\n<p>text = text || &#8220;&#8221;;<\/p>\n<p>var what = text.match(\/what\/gi); \/\/check if text string contains the word &#8220;what&#8221;; ignore case<\/p>\n<p>var beebom = text.match(\/beebom\/gi); \/\/check if text string contains the word &#8220;beebom&#8221;; ignore case<\/p>\n<p>var who = text.match(\/who\/gi); \/\/check if text string contains the word &#8220;who&#8221;; ignore case<\/p>\n<p>var you = text.match(\/you\/gi); \/\/check if text string contains the word &#8220;you&#8221;; ignore case<\/p>\n<p>\/\/if text contains both &#8220;what&#8221; and &#8220;beebom&#8221;, do this:<\/p>\n<p>if(what != null &amp;&amp;; beebom != null) {<\/p>\n<p>message = {<\/p>\n<p>text: &#8220;Beebom is a website offering tech resources. Welcome.&#8221;<\/p>\n<p>}<\/p>\n<p>sendMessage(recipientId, message);<\/p>\n<p>return true;<\/p>\n<p>}<\/p>\n<p>\/\/if text contains both &#8220;who&#8221; and &#8220;you&#8221;, do this:<\/p>\n<p>if(who != null &amp;&amp; you != null) {<\/p>\n<p>message = {<\/p>\n<p>text: &#8220;I have been asked not to discuss my identity online.&#8221;<\/p>\n<p>}<\/p>\n<p>sendMessage(recipientId, message);<\/p>\n<p>return true;<\/p>\n<p>}<\/p>\n<p>\/\/if nothing matched, return false to continue execution of inner function.<\/p>\n<p>return false;<\/p>\n<p>};<\/p><\/blockquote>\n<p>In lines 4 to 7, we have defined variables depending on matching the received string against particular words. The best part about using \u201ctext.match()\u201d is that it uses Regular Expressions (usually called regex, read more\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Regular_expression\" target=\"_blank\" rel=\"noopener\">here<\/a>.). It is good for us, because this means that as long as even a part of a word in the received text matches with either of the words we mentioned in text.match(), the variable will\u00a0not be null. This means, that if the received message was \u201cWhat\u2019s Beebom?\u201d, \u201cvar what\u201d and \u201cvar beebom\u201d will not be null, because the word \u201cWhat\u2019s\u201d contains the word \u201cwhat\u201d. So we are saved from creating extra statements for every variation in which someone might say \u201cWhat\u201d.<\/p>\n[ad type=&#8221;banner&#8221;]\n<h4 id=\"2-editing-the-message-listener\"><span style=\"color: #99cc00;\"><strong>2.\u00a0Editing the Message Listener<\/strong><\/span><\/h4>\n<p>We also need to edit the Message Listener we coded, to ensure that it tries to match the received text with the \u201cconditionalResponses\u201d function as well.<\/p>\n<blockquote><p>app.post(&#8216;\/webhook&#8217;, function (req, res) {<\/p>\n<p>var events = req.body.entry[0].messaging;<\/p>\n<p>for (i = 0; i &lt; events.length; i++) {<\/p>\n<p>var event = events[i];<\/p>\n<p>if (event.message &amp;&amp; event.message.text) {<\/p>\n<p>\/\/first try to check whether received message qualifies for conditional response.<\/p>\n<p>if(!conditionalResponses(event.sender.id, event.message.text)) {<\/p>\n<p>\/\/if it doesn&#8217;t, simply echo the received message back to the sender.<\/p>\n<p>sendMessage(event.sender.id, {text: &#8220;Echo: &#8221; + event.message.text});<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>res.sendStatus(200);<\/p>\n<p>});<\/p><\/blockquote>\n<p>The changes\u00a0in the listener might not look very drastic, but their effects sure are. Now, the listener first tries to respond with conditional responses, and if there is no valid condition for the received message, it simply echoes the message back to the user.<\/p>\n<h4 id=\"3-pushing-the-changes-to-heroku-2\"><span style=\"color: #993300;\"><strong>3.\u00a0Pushing the Changes to Heroku<\/strong><\/span><\/h4>\n<p>Before you can try out the new features, you will have to push the updated code to the app hosted on Heroku. Follow the steps below to do this:<\/p>\n<ol>\n<li>Launch Terminal.<\/li>\n<li>Change directory to your testbot directory<br \/>\ncd testbot<\/li>\n<li>Do the following steps:<\/li>\n<\/ol>\n<ul>\n<li>git add .<\/li>\n<li><strong>Note:\u00a0<\/strong>There is a \u201c.\u201d at the end of \u201cgit add\u201d<\/li>\n<li>git commit -m \u201cAdding conditional capabilities\u201d<\/li>\n<li>git push heroku master<\/li>\n<\/ul>\n<ol start=\"4\">\n<li>Now send a message to your page, and the bot will echo the message back to you.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7999 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/21.png\" alt=\"\" width=\"350\" height=\"621\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/21.png 350w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/21-169x300.png 169w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/p>\n<h4 id=\"even-more-functionality\"><span style=\"color: #ff6600;\"><strong>Even More Functionality<\/strong><\/span><\/h4>\n<p>Our bot now responds to a small set of commands in nice, well structured responses. But it\u2019s still not very useful. Let\u2019s make some more changes to the code to make our bot a more \u201c<strong>functional<\/strong>\u201d piece of software. We\u2019ll be\u00a0<strong>revamping a lot of functions<\/strong>, and adding a couple more, so get excited.<\/p>\n<h4 id=\"1-editing-the-message-listener\"><span style=\"color: #99cc00;\"><strong>1.\u00a0Editing the Message Listener<\/strong><\/span><\/h4>\n<p>Our message listener, at this stage, works just ok. However, it\u2019s not very nicely formatted and if we were to keep increasing the nested if statements to add extra \u201c<strong>condition checks<\/strong>\u201c, it will quickly become\u00a0ugly to look at, difficult to understand and slower at execution. We don\u2019t want that, now, do we? Let\u2019s make some changes.<\/p>\n<p><strong>Note:\u00a0<\/strong>There\u2019s a line of code in the message listener that reads\u00a0<strong>\u201cres.sendStatus(200)\u201d<\/strong>, this line sends a status 200 code to Facebook, telling it that the function successfully executed. According to Facebook\u2019s documentation, Facebook waits for a maximum of 20 seconds to receive a 200 status, before it decides that the message didn\u2019t go through and stops execution of the code.<\/p>\n<p>Our new message listener looks like this. We use the \u201c<strong>res.sendStatus(200)<\/strong>\u201d command to stop execution of the function as soon as a condition is matched and executed.<\/p>\n<blockquote><p>app.post(&#8216;\/webhook&#8217;, function (req, res) {<\/p>\n<p>var events = req.body.entry[0].messaging;<\/p>\n<p>for (i = 0; i &lt; events.length; i++) {<\/p>\n<p>var event = events[i];<\/p>\n<p>if (event.message &amp;&amp; event.message.text) {<\/p>\n<p>\/\/first check message text against introResponse conditions<\/p>\n<p>if(introResponse(event.sender.id, event.message.text)) {<\/p>\n<p>res.sendStatus(200);<\/p>\n<p>}<\/p>\n<p>\/\/for lack of a better name, I called this newResponse :p; check this next<\/p>\n<p>else if(newResponse(event.sender.id, event.message.text)) {<\/p>\n<p>res.sendStatus(200);<\/p>\n<p>}<\/p>\n<p>\/\/else, just echo back the original message<\/p>\n<p>else {<\/p>\n<p>\/\/replace echo with valid command list<\/p>\n<p>sendMessage(event.sender.id, {text: &#8220;Echo: &#8221; + event.message.text});<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>res.sendStatus(200);<\/p>\n<p>});<\/p><\/blockquote>\n<h4 id=\"2-coding-the-newresponse-function\"><span style=\"color: #993300;\"><strong>2.\u00a0Coding the newResponse Function<\/strong><\/span><\/h4>\n<p>Our message listener now checks the message text against a set of conditions in\u00a0<strong>\u201cnewResponse\u201d<\/strong>\u00a0as well, but first, we need to code the newResponse function. We will be using this function to check if the user asked for<strong>\u00a0<\/strong><strong>article suggestions<\/strong>\u00a0from the Beebom website,\u00a0<strong>search the query<\/strong>\u00a0term on the website, and\u00a0<strong>present the link<\/strong>\u00a0to the user. Once again, we will use regular expressions to match text with specific keywords.<\/p>\n<blockquote><p>function newResponse(recipientId, text) {<\/p>\n<p>text = text || &#8220;&#8221;;<\/p>\n<p>var suggest = text.match(\/suggest\/gi);<\/p>\n<p>var random = text.match(\/random\/gi);<\/p>\n<p>var article = text.match(\/article\/gi);<\/p>\n<p>var iphone = text.match(\/iphone\/gi);<\/p>\n<p>var android = text.match(\/android\/gi);<\/p>\n<p>var mac = text.match(\/mac\/gi);<\/p>\n<p>var browser = text.match(\/browser\/gi);<\/p>\n<p>var vpn = text.match(\/vpn\/gi);<\/p>\n<p>\/\/check if user is asking for article suggestions at all<\/p>\n<p>if(suggest != null &amp;&amp; article != null) {<\/p>\n<p>var query = &#8220;&#8221;;<\/p>\n<p>\/\/if article suggestions are queried, check the topic the user is looking for<\/p>\n<p>if(android != null) {<\/p>\n<p>query = &#8220;Android&#8221;;<\/p>\n<p>} else if (mac != null) {<\/p>\n<p>query = &#8220;Mac&#8221;;<\/p>\n<p>} else if (iphone != null) {<\/p>\n<p>query = &#8220;iPhone&#8221;;<\/p>\n<p>} else if (browser != null) {<\/p>\n<p>query = &#8220;Browser&#8221;;<\/p>\n<p>} else if (vpn != null) {<\/p>\n<p>query = &#8220;VPN&#8221;;<\/p>\n<p>}<\/p>\n<p>sendButtonMessage(recipientId, query);<\/p>\n<p>return true<\/p>\n<p>}<\/p>\n<p>return false;<\/p>\n<p>};<\/p><\/blockquote>\n<p>We are using another custom function called\u00a0<strong>\u201csendButtonMessage\u201d\u00a0<\/strong>to send the message in case the user is asking for article suggestions. We will create this next.<\/p>\n<h4 id=\"3-coding-the-send-button-message-function\"><span style=\"color: #ff6600;\"><strong>3.\u00a0Coding the send Button Message Function<\/strong><\/span><\/h4>\n<p>The send Button Message function\u00a0takes two parameters, a\u00a0<strong>recipient ID<\/strong>\u00a0and a\u00a0<strong>query.\u00a0<\/strong>The recipient ID is used to identify the user to whom the message must be sent, and the query is used to identify the topic on which the user wants article suggestions.<\/p>\n<blockquote><p>function send Button Message(recipientId, query) {<\/p>\n<p>var messageData = {<\/p>\n<p>recipient: {<\/p>\n<p>id: recipientId<\/p>\n<p>},<\/p>\n<p>message: {<\/p>\n<p>attachment: {<\/p>\n<p>type: &#8220;template&#8221;,<\/p>\n<p>payload: {<\/p>\n<p>template_type: &#8220;button&#8221;,<\/p>\n<p>text: &#8220;This is what I found for &#8220;+query,<\/p>\n<p>buttons:[{<\/p>\n<p>type: &#8220;web_url&#8221;,<\/p>\n<p>url: &#8220;http:\/\/www.beebom.com\/?s=&#8221;+query,<\/p>\n<p>title: &#8220;Beebom: &#8221; + query<\/p>\n<p>}]\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>};<\/p>\n<p>callSendAPI(messageData);<\/p>\n<p>}<\/p><\/blockquote>\n<p>Once again, we are using a custom function; this time to send the final message, with the article links, to the user. The function is, in many ways, similar to the\u00a0<strong>\u201csendMessage\u201d\u00a0<\/strong>function we coded earlier, but is more generic in the way it takes the message data, which suits us, because our message data changes with the query that the user\u00a0makes.<\/p>\n<h4 id=\"4-coding-the-callsendapi-function\"><span style=\"color: #99cc00;\"><strong>4.\u00a0Coding the\u00a0callSendAPI\u00a0Function<\/strong><\/span><\/h4>\n<p>The\u00a0<strong>\u201ccallSendAPI\u201d\u00a0<\/strong>function takes a single parameter, the\u00a0<strong>\u201cmessageData\u201d<\/strong>. This parameter contains the entire message data, formatted\u00a0properly according to Facebook rules, so that the messenger can display it properly to the user.<\/p>\n<blockquote><p>function callSendAPI(messageData) {<\/p>\n<p>request({<\/p>\n<p>uri: &#8216;https:\/\/graph.facebook.com\/v2.6\/me\/messages&#8217;,<\/p>\n<p>qs: { access_token: process.env.PAGE_ACCESS_TOKEN },<\/p>\n<p>method: &#8216;POST&#8217;,<\/p>\n<p>json: messageData<\/p>\n<p>}, function (error, response, body) {<\/p>\n<p>if (!error &amp;amp;&amp;amp; response.statusCode == 200) {<\/p>\n<p>var recipientId = body.recipient_id;<\/p>\n<p>var messageId = body.message_id;<\/p>\n<p>console.log(&#8220;Successfully sent generic message with id %s to recipient %s&#8221;,<\/p>\n<p>messageId, recipientId);<\/p>\n<p>} else {<\/p>\n<p>console.error(&#8220;Unable to send message.&#8221;);<\/p>\n<p>console.error(response);<\/p>\n<p>console.error(error);<\/p>\n<p>}<\/p>\n<p>});<\/p>\n<p>}<\/p><\/blockquote>\n<h4 id=\"5-pushing-the-changes-to-heroku\"><span style=\"color: #993300;\"><strong>5.\u00a0Pushing the Changes to Heroku<\/strong><\/span><\/h4>\n<p>We\u2019re at the final step towards making our upgraded bot live. We just need to push all the code changes to Heroku. The process is the same as before, and is outlined below:<\/p>\n<ol>\n<li>Launch Terminal.<\/li>\n<li>Change directory to the\u00a0<strong>testbot\u00a0<\/strong>directory.<br \/>\ncd testbot<\/li>\n<li>Do the following:<\/li>\n<\/ol>\n<ul>\n<li>git add .<\/li>\n<li><strong>Note:\u00a0<\/strong>There is a\u00a0<strong>\u201c.\u201d\u00a0<\/strong>at the end of that command.<\/li>\n<li>git commit -m \u201cimproving condition checks and formatting\u201d<\/li>\n<li>git push heroku master<\/li>\n<\/ul>\n<ol start=\"4\">\n<li>Now send a message such as \u201cSuggest an article on Android\u201d, or \u201cBeebom, suggest me any article on the topic Android\u201d; and the bot will send a nicely formatted message with a link that you can tap on to open the articles related to your query.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8000 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/22.png\" alt=\"\" width=\"700\" height=\"621\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/22.png 700w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/22-300x266.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8001 aligncenter\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/23.png\" alt=\"\" width=\"700\" height=\"621\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/23.png 700w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/04\/23-300x266.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<h4 id=\"dig-deeper\"><span style=\"color: #ff6600;\"><strong>Dig Deeper<\/strong><\/span><\/h4>\n<p>Now that you know how to get started with developing Facebook messenger bots, go through the\u00a0<a href=\"https:\/\/developers.facebook.com\/docs\/messenger-platform\/quickstart\" target=\"_blank\" rel=\"noopener\">Facebook documentation<\/a>\u00a0on how to develop Facebook messenger bots. While the documentation is not good for beginners, you\u2019re not a beginner anymore. You should check out the official documentation and try to figure out how to make your bot even smarter. Teaser: You can send\u00a0messages with images and buttons as well! It\u2019s also possible to use services such as\u00a0<a href=\"https:\/\/wit.ai\/\" target=\"_blank\" rel=\"noopener\">Wit.ai<\/a>\u00a0and\u00a0<a href=\"https:\/\/api.ai\/\" target=\"_blank\" rel=\"noopener\">Api.ai<\/a>\u00a0to code your bot and then integrate it with Facebook, but in my feeble attempts to use those services, Wit.ai doesn\u2019t work too well, and Api.ai has\u00a0a sharp learning curve for\u00a0beginners.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Create a Facebook Messenger Bot (Guide) &#8211; Internet &#8211; Messenger bots now also require you to use a SSL secured webhook callback URL, and setting up <\/p>\n","protected":false},"author":2,"featured_media":10353,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18379],"tags":[23463,23462,23461,23459,23456,23458,23457,23452,23446,23447,23455,23442,23448,23466,23453,23438,23451,23454,23465,23450,23436,23441,23437,23435,23440,23439,23443,23445,23449,23464,23460,23444],"class_list":["post-7953","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-internet","tag-bot-facebook","tag-bot-for-facebook","tag-create-a-facebook-app-tutorial","tag-create-facebook-app-tutorial","tag-develop-facebook","tag-develop-facebook-app-tutorial","tag-facebook-app-creation-tutorial","tag-facebook-app-developer-tutorial","tag-facebook-app-development-tutorial","tag-facebook-app-tutorial","tag-facebook-bot","tag-facebook-bot-example","tag-facebook-bot-tutorial","tag-facebook-chat-bots","tag-facebook-chatbot","tag-facebook-chatbot-tutorial","tag-facebook-com-messenger","tag-facebook-developer-tutorial","tag-facebook-development-tutorial","tag-facebook-messenger-bot","tag-facebook-messenger-bot-example","tag-facebook-messenger-bot-github","tag-facebook-messenger-bot-python","tag-facebook-messenger-bot-tutorial","tag-facebook-messenger-templates","tag-facebook-messenger-webhook","tag-facebook-tutorial","tag-facebook-tutorial-2016","tag-facebook-tutorial-for-dummies","tag-m-basic-facebook","tag-simple-facebook","tag-tutorial-facebook"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/7953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=7953"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/7953\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media\/10353"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=7953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=7953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=7953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}