Condividi tramite


Testare il canale di messaggistica personalizzato

Omnichannel for Customer Service consente di implementare un connettore per integrare canali di messaggistica personalizzati. Il codice di esempio completo illustra come creare un connettore personalizzato che si integra con Omnichannel for Customer Service usando il bot Direct Line.

Codice di esempio per testare il canale di messaggistica personalizzato

È possibile usare il codice di esempio seguente per testare il canale di messaggistica personalizzato che si vuole inserire in Omnichannel for Customer Service. È possibile modificare il codice di esempio in base alle esigenze dell'organizzazione.

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

Passaggi successivi

Concetti chiave nell'API Direct Line 3.0

Bring your own custom channel using Direct Line
Configurare il canale di messaggistica personalizzato