We are trying to simulate a WebMessaging chat through tampermonkey but we are unable to use "Databese.set".
Follow below the script code that we are using:
(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);
setAtributo();
})(window, 'Genesys', 'https://apps.sae1.pure.cloud/genesys-bootstrap/genesys.min.js', {
environment: 'prod-sae1',
deploymentId: 'xxxx',
debug: true
});
/** Subscribe to Database.ready event before calling its command.**/
function setAtributo() {
// Set the data in the Database plugin. This data will automatically be included along when sending actual messages.
'Genesys'("command", "Database.set", {
messaging: {
customAttributes: {
nome: "testing",
cpf: "534423"
}
}
})
};
We already see some similar question in another topic but the answer was not posted. Thank you.
Several websites (I would add, several well-designed websites with advanced security protection) enforce content security policies to prevent execution of unexpected or potentially harmful scripts on that page. With these websites you will need more advanced response header manipulation to inject also your pure.cloud domain into CSP headers provided back to your browser. There are some Chrome & Firefox extensions for that, like ModHeader.