Testiranje prilagođenog kanala za razmjenu poruka

Dynamics 365 Contact Center omogućuje vam implementaciju konektora za integraciju prilagođenih kanala za razmjenu poruka. Kompletan uzorak koda ilustrira kako možete stvoriti vlastiti konektor koji se integrira s Dynamics 365 Contact Center koristeći Direct Line Bot.

Primjer koda za testiranje prilagođenog kanala za razmjenu poruka

Možete koristiti sljedeći primjer koda za testiranje prilagođenog kanala poruka koji želite unijeti u Dynamics 365 Contact Center. Ogledni kôd možete izmijeniti kako bi odgovarao potrebama vaše tvrtke ili ustanove.

<!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>

Sljedeći koraci

Ključni pojmovi u Direct Line API-ju 3.0

Unesite vlastiti prilagođeni kanal pomoću Direct Linea
Konfiguriranje prilagođenog kanala za razmjenu poruka