カスタム メッセージング チャネルをテストする

Customer Service 用オムニチャネルを使用すると、カスタム メッセージング チャネルを統合するコネクタを実装できます。 完全な サンプル コード は、Direct Line ボットを使用して Customer Service 用オムニチャネルと統合する独自のコネクタを作成する方法を表しています。

カスタム メッセージ チャネルをテストするサンプル コード

以下のサンプル コードを使用して、Customer Service 用オムニチャネルに取り込むカスタム メッセージング チャネルをテストできます。 サンプル コードは組織のニーズに合わせて変更可能です。

<!DOCTYPE html>
<html lang="en-US">
<head>
    <title>Web Chat: Full-featured bundle</title>

    <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>

    <style>
    html, body { height: 100% }
    body {
      margin: 0;
      background-color: paleturquoise;
    }
    #webchat {
      height: 100%;
      width: 100%;
    }
  </style>
</head>
<body>
       <div id="webchat" role="main"></div>
    <script>
    (async function () {
        const res = await fetch('https://directline.botframework.com/v3/directline/conversations', 
{ method: 'POST', headers: { Authorization: 'Bearer ***************Insert Direct Line Secret here *******************' }});

      const { token } = await res.json();

      (async function () {
	window.WebChat.renderWebChat({
      directLine: window.WebChat.createDirectLine({ token }),
      styleOptions: {
        rootHeight: '100%',
        rootWidth: '50%',
		bubbleMaxWidth: 1200,               
        botAvatarInitials: 'C',                
        userAvatarInitials: 'A',  
      }
    }, document.getElementById('webchat'));
    })()
    })().catch(err => console.error(err));
   </script>
</body>
</html>

次の手順

Direct Line API 3.0 の重要な概念

参照

Direct Line を使用して独自のカスタム チャネルを導入する
カスタム メッセージング チャネルを構成する