首页 > 解决方案 > 将对话框流与网站小部件 ui 集成

问题描述

我想将我制作的 dialogflow 机器人集成到网站并更改徽标并使其在单击按钮时显示并保持浮动我尝试查看 webdemo 的源代码并将其复制粘贴到我的网站并编辑了 img src但没有任何解决方案?

标签: webdialogflow-es

解决方案


您可以使用kommunicate.io Web API 在您的网站中使用您的 dialogflow 应用程序。

您只需在网页的 JavaScript 代码中添加您的通信凭据(APP_ID)即可根据需要显示小部件。

<script type="text/javascript">
(function(d, m){

/*---------------- Kommunicate settings start ----------------*/

 var kommunicateSettings = {
  "appId": "<APP_ID>",
  "conversationTitle":"<CONVERSATION_TITLE>",
  "automaticChatOpenOnNavigation": true,
  "popupWidget": true
  /*
  "onInit": function (){
    // paste your code here
  },
    "botIds":["<BOT_ID_1>","<BOT_ID_2>"]
  */
  };

/*----------------- Kommunicate settings end ------------------*/

 var s = document.createElement("script");
  s.type = "text/javascript";
  s.async = true;
  s.src = "https://widget.kommunicate.io/v2/kommunicate.app";
  var h = document.getElementsByTagName("head")[0];
  h.appendChild(s);
  window.kommunicate = m;
  m._globals = kommunicateSettings;
})(document, window.kommunicate || {});

使用指南集成 Dialogflow。

希望这可以帮助。


推荐阅读