Skip to content

Instantly share code, notes, and snippets.

@nikkanetiya
Created July 2, 2020 13:47
Show Gist options
  • Save nikkanetiya/907b800fdf889e949456f83433e1d67f to your computer and use it in GitHub Desktop.
Save nikkanetiya/907b800fdf889e949456f83433e1d67f to your computer and use it in GitHub Desktop.
How to use freshchat script inside GHL
const freshChatToken = "<token-here>"; // Please update your token here
function clientInitFreshChat() {
window.fcWidget.init({
token: freshChatToken,
host: 'https://wchat.freshchat.com',
config: {
headerProperty: {
hideChatButton: true
}
}
})
// Set this incase you need
// window.fcWidget.setExternalId(userData.id)
// window.fcWidget.user.setFirstName(userData.name)
// window.fcWidget.user.setEmail(userData.email)
}
function clientFreshchatInitialize(i: any, t: any) {
var e
i.getElementById(t)
? initFreshChat()
: (((e = i.createElement('script')).id = t),
(e.async = !0),
(e.src = 'https://wchat.freshchat.com/js/widget.js'),
(e.onload = clientInitFreshChat),
i.head.appendChild(e))
}
clientFreshchatInitialize(document, 'freshchat-js-sdk')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment