html [freshchat] #chat
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html [freshchat] #chat相关的知识,希望对你有一定的参考价值。
<!--
https://web.freshchat.com/settings/widget
-->
<script>
window.fcSettings = {
token: "b46bba8e-a848-473a-b52b-6f55d83a20dc",
host: "https://wchat.freshchat.com",
externalId: "john.doe1987", // user’s id unique to your system
onInit: function() {
window.fcWidget.on('widget:loaded', function() {
window.fcWidget.user.get().then(function(resp) {
var status = resp && resp.status,
data = resp && resp.data;
if (status === 200) {
if (data.restoreId) {
// Update restoreId in your database
}
}
}, function(error) { // User Not Created
window.fcWidget.user.setProperties({
firstName: "John", // user’s first name
lastName: "Doe", // user’s last name
email: "john.doe@gmail.com", // user’s email address
phone: "8668323090", // phone number without country code
phoneCountryCode: "+1", // phone’s country code
plan: "Estate", // user's meta property 1
status: "Active", // user's meta property 2
"Last Payment": "12th August" // user's meta property 3
});
window.fcWidget.on('user:created', function(resp) {
var status = resp && resp.status,
data = resp && resp.data;
if (status === 200) {
if (data.restoreId) {
// Update restoreId in your database
}
}
});
});
});
}
};
</script>
<script src="https://wchat.freshchat.com/js/widget.js" async></script>
以上是关于html [freshchat] #chat的主要内容,如果未能解决你的问题,请参考以下文章