forked from API-Training-Team/webchat_webmessaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguestchatnewwindow.html
219 lines (172 loc) · 8.31 KB
/
guestchatnewwindow.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<p>GuestChat/WebChat test page with New Window</p>
<ul>
<li> <a href="index.html">Genesys Test Site Home Page</a> </li>
</ul>
<head lang="en">
<meta charset="UTF-8">
<title>Simple GuestChat/WebChat Example with New Window</title>
</head>
<body>
<h1>Simple GuestChat/WebChat Example with New Window</h1>
<form>
<label for="firstName">First Name</label>
<input type="text" id="firstName" size="20" value="Joe" />
<label for="lastName">Last Name</label>
<input type="text" id="lastName" size="20" value="Customer" />
<br>
<label for="agentAddress">Address</label>
<input type="text" id="agentAddress" size="20" value="7601 Interactive Way" />
<label for="agentCity">City</label>
<input type="text" id="agentCity" size="10" value="Indianapolis" />
<label for="agentState">State</label>
<input type="text" id="agentState" size="5" value="IN" />
<label for="agentZIP">ZIP</label>
<input type="text" id="agentZIP" size="5" value="46278" />
</br>
<br>
<label for="agentPhone">Phone</label>
<input type="text" id="agentPhone" size="20" value="5558675309" />
<label for="agentLocale">Locale</label>
<input type="text" id="agentLocale" size="5" value="en" />
<label for="agentWelcomeMessage">Welcome Message</label>
<input type="text" id="agentWelcomeMessage" size="40" value="Thanks for chatting using the dev tools chat page." />
</br>
<br>
<label for="agentCustomField1Label">customField1Label</label>
<input type="text" id="agentCustomField1Label" size="40" value="Label1" />
<label for="agentCustomField1">customField1</label>
<input type="text" id="agentCustomField1" size="40" value="Field1" />
</br>
<br>
<label for="agentCustomField2Label">customField2Label</label>
<input type="text" id="agentCustomField2Label" size="40" value="Label2" />
<label for="agentCustomField2">customField2</label>
<input type="text" id="agentCustomField2" size="40" value="Field2" />
</br>
<br>
<label for="agentCustomField3Label">customField3Label</label>
<input type="text" id="agentCustomField3Label" size="40" value="Label3" />
<label for="agentCustomField3">customField3</label>
<input type="text" id="agentCustomField3" size="40" value="Field3" />
</br>
<br>
<label for="agentEmail">Email</label>
<input type="text" id="agentEmail" size="40" value="eps@genesys.com" />
<label for="agentAttributeName">attributeName</label>
<input type="text" id="agentAttributeName" size="40" value="attributeName" />
<label for="agentAttributeValue">attributeValue</label>
<input type="text" id="agentAttributeValue" size="40" value="attributeValue" />
</br>
<br>
<button type="button" id="start-chat" onclick="genesysWebchat.startEmbeddedChat()">Open Chat in New Window</button>
</br>
</form>
<div id="chatContainer" style="height:600px"></div>
<!-- Replace mypurecloud.com with the hostname for your PureCloud region -->
<script src="https://apps.mypurecloud.ie/webchat/jsapi-v1.js" type="text/javascript"></script>
<script
id="purecloud-webchat-js"
type="text/javascript"
src="https://apps.mypurecloud.ie/webchat/jsapi-v1.js"
region="eu-west-1"
org-guid="88d80579-963b-422c-a692-26dbfa84b446"
deployment-key="3d0ce0f3-9ce6-4624-9e6c-1ade96b98b7a"
></script>
<!-- deployment-key above is for general chat deployment-key NOT the deployment-key for co-browse -->
<script type="text/javascript">
let genesysWebchat = (function() {
function createChatConfig(){
let firstName = document.getElementById('firstName').value;
let lastName = document.getElementById('lastName').value;
let agentAddress = document.getElementById('agentAddress').value;
let agentCity = document.getElementById('agentCity').value;
let agentState = document.getElementById('agentState').value;
let agentZIP = document.getElementById('agentZIP').value;
let agentPhone = document.getElementById('agentPhone').value;
let agentLocale = document.getElementById('agentLocale').value;
let agentWelcomeMessage = document.getElementById('agentWelcomeMessage').value;
let agentCustomField1Label = document.getElementById('agentCustomField1Label').value;
let agentCustomField1 = document.getElementById('agentCustomField1').value;
let agentCustomField2Label = document.getElementById('agentCustomField2Label').value;
let agentCustomField2 = document.getElementById('agentCustomField2').value;
let agentCustomField3Label = document.getElementById('agentCustomField3Label').value;
let agentCustomField3 = document.getElementById('agentCustomField3').value;
let agentEmail = document.getElementById('agentEmail').value;
let agentAttributeName = document.getElementById('agentAttributeName').value;
let agentAttributeValue = document.getElementById('agentAttributeValue').value;
// For additional web chat config options, see web chat documentation. This example excludes some of the optional values.
return {
// Web chat application URL
"webchatAppUrl": "https://apps.mypurecloud.ie/webchat",
// Web chat service URL
"webchatServiceUrl": "https://realtime.mypurecloud.ie:443",
// Numeric organization ID
"orgId": 16555,
// Organization name
"orgName": "msantosdev",
// Target agent email (OPTIONAL)
//"agentEmail": agentEmail,
// Queue Name
"queueName": 'Technical Support',
// Log level
"logLevel": "DEBUG",
// Locale code
"locale": "en",
// Logo used at the top of the chat window
"companyLogo": {
"width": 600,
"height": 149,
"url": "https://d3a63qt71m2kua.cloudfront.net/developer-tools/1275/assets/images/PC-blue-nomark.png"
},
// Logo used within the chat window
"companyLogoSmall": {
"width": 149,
"height": 149,
"url": "https://d3a63qt71m2kua.cloudfront.net/developer-tools/1275/assets/images/companylogo.png"
},
// Image used for agent
"agentAvatar": {
"width": 462,
"height": 462,
"url": "https://d3a63qt71m2kua.cloudfront.net/developer-tools/1275/assets/images/agent.jpg"
},
// Text displayed when the chat window opens
"welcomeMessage": "Thanks for chatting.",
// CSS class applied to the chat window
"cssClass": "webchat-frame",
// Custom style applied to the chat window
"css": {
"width": "100%",
"height": "100%"
},
};
}
return {
startEmbeddedChat: function() {
let chatConfig = createChatConfig();
ININ.webchat.create(chatConfig, function(err, webchat) {
if (err) {
console.error('Unable to share page', (err.stack || err));
return;
}
webchat.renderPopup({
width: 400,
height: 400,
title: 'Chat'
});
});
}
}
})();
</script>
<script>
(function(a,t,c,l,o,u,d){a['_genesysJourneySdk']=o;a[o]=a[o]||function(){
(a[o].q=a[o].q||[]).push(arguments)},a[o].l=1*new Date();u=t.createElement(c),
d=t.getElementsByTagName(c)[0];u.async=1;u.src=l;u.charset='utf-8';d.parentNode.insertBefore(u,d)
})(window, document, 'script', 'https://apps.usw2.pure.cloud/journey/sdk/js/web/v1/ac.js', 'ac');
ac('init', '57e75942-3d28-4327-b87a-2f3ea9980fa5', { region: 'usw2' });
ac('pageview');
</script>
</body>
</html>