WebChat在sharepoint获得回发

时间:2018-03-13 06:31:46

标签: sharepoint botframework

分享点中的WebChat获得回发。在sharepoint中添加了Web部件并尝试实现网络聊天。

每当我点击“输入”或“发送”按钮时,它都会给出回发。当事件发生时我们如何避免回发(例如:点击按钮)?

<script type="text/javascript"
      src="https://code.jquery.com/jquery-3.3.1.js"
      integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
      crossorigin="anonymous"></script>
    <script src="https://unpkg.com/botframework-webchat/botchat.js"></script>


    <script type="text/javascript">

      var jq = $.noConflict();

      jq(document).ready(function () {

      try {

      BotChat.App({
      directLine: {
      secret: 'Qc--iFxcebI.cwA.poU.XfmiUiUHwK9AjLZXzUoA_ewI3s6fktbN447HI9qVqLE'
      },
      user: {
      id: _spPageContextInfo.userLoginName //_spPageContextInfo.userLoginName
      },
      bot: {
      id: 'botid'
      },
      sendTyping: true,
      resize: 'detect'
      }, document.getElementById("bot"));

      } catch (e) {
      console.log(e.message);
      }

      try {
      jq('.wc-header > span').html('Search Bot');
      jq(".wc-header").click(function () {
      jq(".botcontainer").toggleClass("height");
      });
      } catch (e) {
      debugger;
      console.log(e.message);
      }

      });
    </script>

    <div class="botcontainer ms-dialogHidden ms-fullWidth noindex" id="bot" ></div>

1 个答案:

答案 0 :(得分:0)

作为解决方法,在页面库中创建一个aspx页面,并在页面中添加HTML代码以实现网络聊天。然后在脚本编辑器Web部件中添加iframe。

<iframe id="botchat" src="/chatbot/Pages/chatbot.aspx?t=<directline secret>" width="320" height="500"></iframe>

类似线程: Using WebChat in SharePoint Script Editor