Sure, please check the information below....
Version Used : 9.0.017.09
In Index.html
<script src="https://apps.mypurecloud.com/widgets/9.0.017.09/cxbus.min.js" onload="javascript:CXBus.configure({debug:false,pluginsPath:'https://apps.mypurecloud.com/widgets/9.0.017.09/plugins/'});
CXBus.loadFile('./assets/global/scripts/geneConfig.js').done(function()
{CXBus.loadPlugin('widgets-core')});"></script>
Created local config file with the name of "geneConfig.js", attached the code below
if(!window._genesys)window._genesys = {};
if(!window._gt)window._gt = [];
window._genesys = {
widgets: {
main: {
debug: false,
theme: "light",
lang: "en",
customStylesheetID: "genesys_widgets_custom",
preload: ['webchat'],
// OR define the JSON object inline
i18n: {
"en": {
"webchat": {
"ChatTitle": "Chat with us",
"InviteBody": "Let us know if we can help out.",
"InviteTitle": "Need help?",
}
}
}
},
webchat: {
userData: {},
emojis: true,
cometD: {
enabled: false
},
autoInvite: {
enabled: false,
timeToInviteSeconds: 5,
inviteTimeoutSeconds: 30
},
chatButton: {
enabled: true,
'template': '<div class="cx-widget cx-webchat-chat-button cx-side-button" id="geneChatButton" onclick="myChatButton()" role="button" tabindex="0" data-message="ChatButton" data-gcb-service-node="true"><span class="cx-icon" data-icon="chat"></span><span class="i18n cx-chat-button-label" data-message="ChatButton"></span></div>',
openDelay: 3000,
effectDuration: 300,
hideDuringInvite: true
},
form: {
wrapper: "<table></table>",
},
uploadsEnabled: true,
enableCustomHeader: true,
transport: {
dataURL: "...",
type: "...",
endpoint: "...",
headers: {
"x-api-key": "....."
},
stream: "..."
}
},
onReady: function(){
console.log('ready go');
}
}
};
(function(o){
var f = function(){
var d = o.location;
o.aTags = o.aTags || [];
for(var i=0;i<o.aTags.length;i++){
var oTag = o.aTags[i];
var fs = d.getElementsByTagName(oTag.type)[0], e;
if(d.getElementById(oTag.id)) return; e = d.createElement(oTag.type); e.id = oTag.id;
if(oTag.type == "script"){e.src = oTag.path;}
else{e.type = 'text/css';e.rel = 'stylesheet';e.href = oTag.path;}
if(fs){fs.parentNode.insertBefore(e, fs);}else{d.head.appendChild(e);}
}},ol = window.onload;
if(o.onload){typeof window.onload != "function"?window.onload=f:window.onload=function(){ol();f();}}else f();
})({location: document,
onload: false,
aTags: [{type:"script", id:"genesys-cx-widget-script", path:"https://apps.mypurecloud.com/widgets/9.0.017.09/widgets.min.js"},
{type:"link", id:"genesys-cx-widget-styles", path:"https://apps.mypurecloud.com/widgets/9.0.017.09/widgets.min.css"}]});
CXBus.loadPlugin("widgets-core");
var oPlugin = CXBus.registerPlugin("myPlugin");
oPlugin.before("WebChat.open", function(options){
if(options.formJSON)options.formJSON['inputs'].push({name:'email',label:'Email',placeholder:'Required'});
return options;
});