Skip to content

Instantly share code, notes, and snippets.

@socraticprogrammer
Last active October 4, 2024 14:34
Show Gist options
  • Save socraticprogrammer/38c1d3bdda7f252fd2967a8cae339c7a to your computer and use it in GitHub Desktop.
Save socraticprogrammer/38c1d3bdda7f252fd2967a8cae339c7a to your computer and use it in GitHub Desktop.
Implementation example of Web Messaging from Genesys Cloud.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
WebMessaging
</body>
<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);
})(
window,
"Genesys",
"https://apps.mypurecloud.com/genesys-bootstrap/genesys.min.js",
{
environment: "dev",
deploymentId: "",
}
);
Genesys("subscribe", "Database.ready", function () {
console.info("Database plugin is ready!");
Genesys(
"command",
"Database.set",
{
messaging: {
customAttributes: {
key: "value",
},
},
},
function (data) {
console.info(`${JSON.stringify(data)} setted!`);
},
function (err) {
console.error(err);
}
);
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment