$(document).ready(function initializeChat () { var chatConfig = { // Web chat application URL webchatAppUrl: "https://apps.usw2.pure.cloud/webchat",
// Web chat service URL webchatServiceUrl: "https://realtime.usw2.pure.cloud:443",
// organization GUID orgGuid: "54d634d6-6423-4ed8-8f11-175d35bb9936",
// Numeric organization ID orgId: "2162",
// Organization name. Replace with your org name. orgName: "acendas",
// Requested agent language skill (Agent must have this language skill to receive chat) language: "",
// Requested agent skills (Agent must have these skills to receive chat) skills: ['TrainingQ_Chat'], // OR //skills: [],
// Priority priority: 0,
// Queue Name queueName : "",
// Target agent email (OPTIONAL) agentEmail: 'alex.agent@example.com',
// Whether to show submit button or send message on Enter keypress showSubmitButton: true,
// Log level logLevel: 'DEBUG',
// Locale code locale: 'en',
// Whether to allow reconnects reconnectEnabled: true,
//Allowed reconnect origins reconnectOrigins: ['https://acendasvacations.com'],
// Logo used within the chat window companyLogoSmall: { width: 149, height: 149, url: 'https://dhqbrvplips7x.cloudfront.net/webchat/1.0.23/company-logo-small-9c9fe09b.png' }, // Fallback image used for agent if no agent image is defined in the agent's Genesys Cloud profile agentAvatar: { width: 462, height: 462, url: 'https://dhqbrvplips7x.cloudfront.net/webchat/1.0.23/agent-e202505f.png' },
// Text displayed with chat window is displayed welcomeMessage: 'Acendas Travel -- Your technology driven TMC.',
// CSS class applied to the chat window cssClass: 'webchat-frame',
// Custom style applied to the chat window css: { width: '100%', height: '100%' } }; var chatButton = document.getElementById('chat-button');
// Required if reconnects are enabled window.PURECLOUD_WEBCHAT_FRAME_CONFIG = { containerEl: 'chat-container' };
ININ.webchat.create(chatConfig) .then(function (webchat) { // Optionally use isAutoJoined if reconnects are enabled if (webchat.isAutoJoined()) { // Do something to disable chat button } else { chatButton.onclick = function () { var firstName = document.getElementById('first-name').value; var lastName = document.getElementById('last-name').value; var agentEmail = document.getElementById('agent-email').value;
// Use getConfig.setConfigProperty() for any web chat configuration property to dynamically set config values. webchat.getConfig().setData({ firstName: firstName, lastName: lastName, addressStreet: '64472 Brown Street', addressCity: 'Lindgrenmouth', addressPostalCode: '50163-2735', addressState: 'FL', phoneNumber: '1-916-892-2045 x293', email: 'willie.duit@myspace.com', phoneType: 'Cell', customerId: 59606 });
//Use the updateConfig function to update batches of properties by passing in a partially filled chatConfig object webchat.updateConfig({ agentEmail: 'debrah.agent@example.com', locale: 'en', welcomeMessage: 'Welcome to Example support', });
// Alternatively, call webchat.renderPopup here. Note that reconnects do not apply to popup chat. return webchat.renderFrame({ containerEl: 'chat-container' }); }; } }) .catch(function (err){ console.log(err); }); });