Has anything changed with the API?
Below is our script on our site that we use for chat.
In our chat we created a new field called Date of Birth:
This is where the customer can enter their Date of Birth.
We have written some java script that will intercept that field and call to our API to replace the Date of birth with a URL. That way when an agent accepts the chat the Visitor Info will display (Secret) Dob with a link the agent can click on to get what the customer entered in the DOB field, and the Date of Birth field will be removed.
However as of July 24th. This does not work anymore.
Instead, the Visitor Info now displays the Date of Birth Field with the info the customer entered.
After the customer hits submit - The Visitor Info section
<script type="text/javascript">
var widgetCode = "<redacted for privacy>";
var $zoho=$zoho || {};
$zoho.salesiq = $zoho.salesiq || {widgetcode: widgetCode, values:{},ready:function(){}};
var d=document;
s=d.createElement("script");
s.type="text/javascript";
s.id="zsiqscript";
s.defer=true;
t=d.getElementsByTagName("script")[0];
t.parentNode.insertBefore(s,t);
// d.write("<div id='zsiqwidget'></div>");
$zoho.salesiq.afterReady = function(embedinfo) {
$zoho.salesiq.chat.waitime('600');
}
// Add custom DOB/Verification date field to zoho
$zoho.salesiq.ready = function(embedinfo) {
addZohoDobField();
}
// Hides the livesupport widget on the calltracking page
setInterval(function () {
var elem = document.getElementById('zsiq_float');
var hasHiddenClass = elem.className.match(/(?:^|\s)hide-livesupport(?!\S)/);
var calltrackingPage = window.location.href.toString().includes('calltracking');
if(calltrackingPage && !hasHiddenClass) {
// Add class if not already on element
elem.className += ' hide-livesupport';
} else if(!calltrackingPage && hasHiddenClass) {
// Remove class if on the element and it shouldn't be
elem.className = elem.className.replace(/(?:^|\s)hide-livesupport(?!\S)/g, '');
}
}, 500);
function createSecret(dob) {
// Regenerate the hashcash token
validate_token(new Fingerprint().get());
// Get the secret url for the dob
window.jQuery.ajax({
url: "/manage/api/v1.0/secrets",
type: "POST",
data: JSON.stringify({
paste: dob,
hashcash: window.hashcash
}),
contentType: "application/json",
dataType: "json",
success: function(data) {
$zoho.salesiq.visitor.info({"Date of Birth": ""});
$zoho.salesiq.visitor.info({"(Secret) DoB": data["url"]});
}
});
}
// Add custom date of birth fields to zoho
function addZohoDobField () {
$zoho.salesiq.customfield.add({
"name" :"DoB",
"hint" :"Date of Birth or Verification Date",
"type" :"label"
});
$zoho.salesiq.customfield.add({
"name":"Date of Birth",
"hint":"MM-DD-YYYY",
"required":"false",
"type":"text",
"visibility":"both",
"callback":function(value){
// Clear the date of birth field and create a new field with a
// secrets URL containing the birth date
$zoho.salesiq.customfield.clear(["Date of Birth"]);
$zoho.salesiq.customfield.clear(["DoB"]);
$zoho.salesiq.visitor.info({"Date of Birth": "Secretized"});
addZohoDobCreatedLabel();
createSecret(value);
}
});
}
// After the dob is saved, replace it with this label
function addZohoDobCreatedLabel() {
$zoho.salesiq.customfield.add({
"name": "DoB-Created",
"hint": "Date of Birth or Verification Date Saved!",
"type": "label"
})
}
</script>