Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.




Html
<div class="fb-like" data-href="#" data-layout="button_count" data-action="recommend" data-size="large" data-show-faces="true" data-share="true"></div>

...

Html
 <div class="lang-box-pdf">
	<div>
		<div class="google-lang">
			<div id="google_translate_element">
			</div>
			<script type="text/javascript">
					function googleTranslateElementInit() {
						new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'de,es,fr,it,nl', autoDisplay: false}, 'google_translate_element');
						}
			</script>
			<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
		</div>
		
		<div class="pdf-button">
			<a href="https://confluence.wildix.com/spaces/flyingpdf/pdfpageexport.action?pageId=85164544" alt="Convert to .pdf" title="Convert to .pdf"><img src="https://confluence.wildix.com/download/attachments/14549012/pdf-button-download-wildix-documentation.png"></a>
		</div>
	</div>
</div>


Info

This document explains how to install WebRTC Kite Chatbot

Created: February 2021

Permalink: https://confluence.wildix.com/x/AIITBQ

Min. WMS version: WMS 5.02

Table of Contents

Description

Wildix WebRTC Kite bot SDK is a sample bot. Web developers can work on it to customize it to different scenarios. 

The current implementation can be used out of the box for the following use cases:

  • Provide an automated response to external WebRTC Kite users in case no agent is available during working hours (e.g. "All agents are busy at the moment, please try again later") 
  • Provide an automated response to external WebRTC Kite uses in case they contacted the call group outside of the working hours (e.g. "Our offices are closed, please try again during the working hours: Monday through Friday from 9 AM till 6 PM").

Web developers can extend the behavior of the bot to use it in more complicated scenarios, for example, provide predefined options to the WebRTC Kite users from which they can choose, etc.

Web developers can find all the necessary information here: https://github.com/Wildix/kite-xmpp-bot 

This document explains the expected behavior and use cases of the basic implementation (out of the box) and the information on how to install the SDK.

Current implementation

The sample bot has the following behavior:

  • A new user is created on the PBX (Business license required); this user acts as a chatbot
  • The chatbot user can be added to one or more call groups
  • In case no agent replies within the specified timeout (1 minute by default) during working hours, the chatbot provides a certain predefined response; in case no agent replies within the same timeout during non-working hours, the chatbot provides a different predefined response
  • It's possible to modify the static files in the SDK directory to specify the working hours/ non-working hours and the response messages from the chatbot 

...

  • WMS version: starting from WMS 5.02.20210127
  • Business license or higher (assigned to the chatbox user)
  • Last stable version of Node.js 

...

Code Block
'use strict';

const fs = require('fs');

class Responder {

    constructor(config) {
        this._workinghours = config.workinghours;
        this._nonworkinghours = config.nonworkinghours;
        this._address = config.address;
        this._events = config.events;
    }

    hello(id, userdata) {
        return this._processHello(userdata);
    }

    say(id, message) {
        return this._processSay(message);
    }

    bye(id) {
    }

    _processHello(userdata) {
        const filename = this._workingHours() ? this._workinghours : this._nonworkinghours;
        const content = fs.readFileSync(filename).toString();
        return this._processTemplate(userdata, content);
    }
    
    _processSay(message) {
        const address = this._address;
        const events = this._events;
        let content;

        if (message == 'address') {

       const content = fs.readFileSync(address).toString();
        }
        
        else if (message == 'events') {
    
       const content = fs.readFileSync(events).toString();
        }
        else {
   
        const content = "sorry, I did not understand you";
        }
            return content;
        }

    _processTemplate(userdata, content) {
        let result = content.replace(/\$username/g, userdata.name);
        if(userdata.email) {
            result = result.replace(/\$useremail/g, userdata.email);
        }
     
  return result;     }

    _workingHours() {
        const now = new Date();
        const day = now.getDay();
        const hour = now.getHours();
        return (day < 6) && (hour > 8 && hour < 18);
    }

}

module.exports = Responder;

...