Request input data on the web page

​Below is an example showing code (only showing the code in the form tag) needed to request input from the chatter (e.g. nickname, chatId, chatIssue, or queueKey) before launching the chat. This is to include input parameters in the chat without using the built-in form (that requests these inputs in the chat itself).

<form>
<span>Your name</span>
<input id="nickName" name="nickName" type="text" value="my name" /><br/>
<span>Your e-mail address</span>
<input id="chatId" name="chatId" type="text" value="" /><br/>
<span>Queue</span>
<input id="queueKey" name=" queueKey " type="text" value="Q_CHAT" /><br/>
<span>Customer Input</span>
<input id="customerInput" name="customerInput" type="text" value="" /><br/>
<button class="chatstarter" name="startChat">Start chat</button>
</form>
<div id="someID" class="intelecomchat"></div>

<script>
$(document).ready(function () {
$('#someID').intelecomChat({
customerKey: '12345',
showStarter: false,
onChatStart: function () {
$(this).intelecomChat('reloadOptions', {
nickName: document.getElementById('nickName').value,
chatId: document.getElementById('chatId').value,
queueKey: document.getElementById('queueKey').value,
variables: {
"customerInput":
document.getElementById('customerInput').value,
"url": window.location.href,
}
});
}
});
});
</script>

Published

Last updated

6
-3