{"id":3357,"date":"2016-11-16T14:29:25","date_gmt":"2016-11-16T13:29:25","guid":{"rendered":"http:\/\/iamwcew.fr.oracle.com\/blog\/?p=3357"},"modified":"2017-12-08T12:23:02","modified_gmt":"2017-12-08T11:23:02","slug":"les-robots-arrivent","status":"publish","type":"post","link":"https:\/\/gpmfactory.com\/index.php\/2016\/11\/16\/les-robots-arrivent\/","title":{"rendered":"Les Robots arrivent !"},"content":{"rendered":"<h3>Objet<\/h3>\n<p>Voici quelques liens et du mat\u00e9riel pour cr\u00e9er un ChatBot bas\u00e9 sur Oracle Application Container Cloud et\u00a0destin\u00e9 \u00e0 Facebook Messenger.<\/p>\n<p>J\u2019ai mis en attachement un code que j\u2019ai adapt\u00e9 pour node.js, qui s\u2019inspire du projet Git \u00a0avec quelques ajouts pour exploiter la position GPS. Il faut cr\u00e9er auparavant une page dans FB ainsi qu\u2019une app pour Messenger.<\/p>\n<p>Le ficher .zip peut directement \u00eatre instanci\u00e9 dans Oracle Container Cloud (node.js). Penser \u00e0 ajouter une variable syst\u00e8me (au niveau du setting de node.js) \u00a0qui contiendra la valeur du token de page. Je l\u2019ai appel\u00e9e\u00a0: FB_PAGE_ACCESS_TOKEN<\/p>\n<p>Ce chatbot n\u2019est utilis\u00e9 pour l\u2019instant qu\u2019en mode d\u00e9veloppement car il est n\u00e9cessaire de soumettre le bot \u00e0 FB <a href=\"https:\/\/developers.facebook.com\/docs\/messenger-platform\/app-review\">avant que celui-ci ne soit rendu public<\/a>.<!--more--><\/p>\n<h3>Pour d\u00e9marrer<\/h3>\n<h4>Un bon article \u00e0 lire en premier<\/h4>\n<p><a href=\"https:\/\/github.com\/jw84\/messenger-bot-tutorial\">https:\/\/github.com\/jw84\/messenger-bot-tutorial<\/a><\/p>\n<p>(attention\u00a0: les instructions <strong>let<\/strong> ne passent pas avec la version de node.js (0.12.15). Il faut les remplacer par <strong>var <\/strong>dans ce cas, sinon upgrade vers 6.x)<br \/>\nLa mention \u00e0 Heroku peut \u00eatre ignor\u00e9e. Il s&rsquo;agit de la plateforme de SalesForce qui herberge des micro-services.<\/p>\n<h4>Reconnaissance de langage naturel<\/h4>\n<p><a href=\"https:\/\/wit.ai\">https:\/\/wit.ai<br \/>\n<\/a>Des extensions sont donc possibles ! La phrase pourra \u00eatre transmise \u00e0 ce service qui en retour donnera des indications sur <a href=\"https:\/\/wit.ai\/docs\/recipes#categorize-the-user-intent\">l&rsquo;intention de l&rsquo;utilisateur<\/a>.<\/p>\n<h4>Facebook Developer<\/h4>\n<p><a href=\"https:\/\/developers.facebook.com\/\">https:\/\/developers.facebook.com\/<\/a><\/p>\n<h3>Echantillons de dialogue<\/h3>\n<p>Quelques mots ou actions sont compris:<\/p>\n<ul>\n<li><em>bonjour<\/em><\/li>\n<li><em>lunettes<\/em><\/li>\n<li><em>toilettes<\/em><\/li>\n<li><em>couleur<\/em><\/li>\n<li>&lt;Ajout d&rsquo;un Like&gt;<\/li>\n<\/ul>\n<p>Note: Lors d&rsquo;une d\u00e9mo, c&rsquo;est plus sympa d&rsquo;utiliser la reconnaissance vocale !<\/p>\n<p>Le premier illustre une r\u00e9ponse simple de type <em>text<\/em>. Les trois autres montrent que l&rsquo;on peut utiliser des \u00ab\u00a0<em>templates<\/em>\u00a0\u00bb (carrousel de produits par exemple)<\/p>\n<p><em>toilettes<\/em> montre un dialogue \u00ab\u00a0soutenu\u00a0\u00bb avec deux \u00e9changes. Le robot interroge la <a href=\"https:\/\/opendata.paris.fr\/page\/home\/\">base OpenData de la mairie de Paris<\/a> qui indique les sanisettes proches de la position.<\/p>\n<p><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1560.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3361\" src=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1560-169x300.png\" alt=\"IMG_1560\" width=\"169\" height=\"300\" \/><\/a><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1561.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3362\" src=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1561-169x300.png\" alt=\"IMG_1561\" width=\"169\" height=\"300\" \/><\/a><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1562.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3363\" src=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1562-169x300.png\" alt=\"IMG_1562\" width=\"169\" height=\"300\" \/><\/a><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1563.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3364\" src=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1563-169x300.png\" alt=\"IMG_1563\" width=\"169\" height=\"300\" \/><\/a><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1565.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3366\" src=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1565-169x300.png\" alt=\"IMG_1565\" width=\"169\" height=\"300\" \/><\/a><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1566.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3367\" src=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1566-169x300.png\" alt=\"IMG_1566\" width=\"169\" height=\"300\" \/><\/a><a href=\"https:\/\/github.com\/jw84\/messenger-bot-tutorial\"><br \/>\n<\/a><\/p>\n<h3>Exemple complet avec un Syndic d&rsquo;immeubles<\/h3>\n<p>Le chatbot Vision Immo illustre la plupart des possibilit\u00e9s que peut offrir un agent conversationnel de type Facebook Messenger.<\/p>\n<p>Pour le r\u00e9aliser, il suffit d&rsquo;utiliser un service node.js, par exemple, de type Oracle Application Container (ACCS). En principe, c&rsquo;est Oracle MCS qui jouera ce r\u00f4le tr\u00e8s prochainement, ou du moins, une combinaison de MCS avec ACCS.<\/p>\n<h3>Materiel<\/h3>\n<h4>Ajout de menu et message de pr\u00e9sentation<\/h4>\n<p>Il est possible d&rsquo;ajouter une message de bienvenue\u00a0\u00e0 un Chatbot qui sera affich\u00e9 lors du tout premier usage, ou bien apres une suppression de la conversation. Il est \u00e9galement possible d&rsquo;ajouter un menu qui se pr\u00e9sente sous la forme d&rsquo;un pictogramme en bas \u00e0 gauche. Ces actions d&rsquo;enrichissement sont effectu\u00e9es par des appels REST.<\/p>\n<p><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1564.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3365\" src=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/IMG_1564-169x300.png\" alt=\"IMG_1564\" width=\"169\" height=\"300\" \/><\/a><\/p>\n<h4>Menu persistent<\/h4>\n<pre>curl -X POST -H \"Content-Type: application\/json\" -d '{\r\n \"setting_type\" : \"call_to_actions\",\r\n \"thread_state\" : \"existing_thread\",\r\n \"call_to_actions\":[\r\n {\r\n \"type\":\"postback\",\r\n \"title\":\"Help\",\r\n \"payload\":\"DEVELOPER_DEFINED_PAYLOAD_FOR_HELP\"\r\n },\r\n {\r\n \"type\":\"postback\",\r\n \"title\":\"Start a New Order\",\r\n \"payload\":\"DEVELOPER_DEFINED_PAYLOAD_FOR_START_ORDER\"\r\n },\r\n {\r\n \"type\":\"web_url\",\r\n \"title\":\"Checkout\",\r\n \"url\":\"http:\/\/petersapparel.parseapp.com\/checkout\",\r\n \"webview_height_ratio\": \"full\",\r\n \"messenger_extensions\": true\r\n },\r\n {\r\n \"type\":\"web_url\",\r\n \"title\":\"View Website\",\r\n \"url\":\"http:\/\/petersapparel.parseapp.com\/\"\r\n }\r\n ]\r\n}' \"https:\/\/graph.facebook.com\/v2.6\/me\/thread_settings?access_token=PAGE_ACCESS_TOKEN\"<\/pre>\n<h4>Message bienvenue<\/h4>\n<pre>curl -X POST -H \"Content-Type: application\/json\" -d '{\r\n \"setting_type\":\"greeting\",\r\n \"greeting\":{\r\n \"text\":\"Bonjour {{user_first_name}}, je suis un ChatBot \u00e0 votre service. Comment puis-je vous aider ? \"\r\n }\r\n}' \"https:\/\/graph.facebook.com\/v2.6\/me\/thread_settings?access_token=PAGE_ACCESS_TOKEN\"<\/pre>\n<h4>Code source Javascript pour Node.js<\/h4>\n<p><a href=\"http:\/\/iamwcew.fr.oracle.com\/blog\/wp-content\/uploads\/2016\/11\/VisionChatbot.zip\">VisionChatbot<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Objet Voici quelques liens et du mat\u00e9riel pour cr\u00e9er un ChatBot bas\u00e9 sur Oracle Application Container Cloud et\u00a0destin\u00e9 \u00e0 Facebook Messenger. J\u2019ai mis en&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7,22,10],"tags":[],"ppma_author":[150],"class_list":["post-3357","post","type-post","status-publish","format-standard","hentry","category-demo-2","category-dev","category-francais","category-notes"],"authors":[{"term_id":150,"user_id":1,"is_guest":0,"slug":"admin8700","display_name":"Patrick","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/209d5ed69b74d288390621ab4c1d3773?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts\/3357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/comments?post=3357"}],"version-history":[{"count":2,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts\/3357\/revisions"}],"predecessor-version":[{"id":4046,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts\/3357\/revisions\/4046"}],"wp:attachment":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/media?parent=3357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/categories?post=3357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/tags?post=3357"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/ppma_author?post=3357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}