Hi All,
Let me start by explaining what I am trying to achieve:
- Search for a casenumber in the current page URL and transfer that to Genesys.
- Load this to Genesys immediately after clicking the "Message Us" button.
- I also included 1 attribute to just add the word "TEST", to confirm static data is transferred
Last week I tested this functionality and it seemed to work, however today I found it does not work flawlessly.
- Scenario 1:
- Main page has loaded, chat icon is visible on every page.
- Customer selects case page and opens a case
- Chat is initiated by clicking "Message Us".
- Result: no case number, however TEST was transferred.
- Scenario 2:
- The currrently opened case page is refreshed (F5)
- Chat is initiated by clicking "Message Us"
- Result: Case number and TEST were transferred
- Scenario 3
- The chat above was ended "using the bin icon"
- Chat is initiated by clicking "Message Us"
- Result: nothing is transferred. (this only works when hitting F5 again and restarting the chat).
How do I ensure the custom attributes always send the correct data to Genesys from this case page, as a requirement for my flows to work is that I already have the case number.
My current script looks like this:
<script type="text/javascript" charset="utf-8">
(function (g, e, n, es, ys) {
g['_genesysJs'] = e;
g[e] = g[e] || function () {
(g[e].q = g[e].q || []).push(arguments);
};
g[e].t = 1 * new Date();
g[e].c = es;
ys = document.createElement('script');
ys.async = 1;
ys.src = n;
ys.charset = 'utf-8';
document.head.appendChild(ys);
Genesys("subscribe", "Messenger.ready", function() {
var caseMatch = window.location.href.match(/\/case\/([A-Za-z0-9]+)/);
var caseNumber = caseMatch ? caseMatch[1] : null;
Genesys("command", "Messaging.open");
Genesys("command", "Database.set", {
messaging: {
customAttributes: {
SMX_caseNumber: caseNumber,
CustomAttribute: "TEST"
}
}
});
});
})(window, 'Genesys', 'https://apps.mypurecloud.de/genesys-bootstrap/genesys.min.js', {
environment: 'euc1',
deploymentId: 'xxxxxxxxxxxxxxxxx'
});
</script>
#Architect
#DataActions
#Scripts
#WebMessaging
------------------------------
Gerben Duijster
Senior Technical Support Specialist
------------------------------