Created
November 8, 2023 17:48
-
-
Save lveillard/73d60b443380ac619d48e2345fb5bedb to your computer and use it in GitHub Desktop.
Chatwoot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ChatwootWidget: React.FC<ChatwootWidgetProps> = () => { | |
useEffect(() => { | |
// Define a function to load the Chatwoot script | |
const loadChatwootScript = () => { | |
const BASE_URL = {TOUR CHATWOOT SELF HOSTED URL); | |
const WEBSITE_TOKEN = {YOUR WEBSITE TOKEN} | |
const script = document.createElement('script'); | |
script.src = `${BASE_URL}/packs/js/sdk.js`; | |
script.async = true; | |
script.onload = () => { | |
(window as any).chatwootSDK.run({ | |
websiteToken: WEBSITE_TOKEN, | |
baseUrl: BASE_URL, | |
}); | |
}; | |
document.body.appendChild(script); | |
}; | |
// Add Chatwoot Settings | |
(window as any).chatwootSettings = { | |
hideMessageBubble: false, | |
position: 'right', | |
locale: 'en', | |
type: 'standard', | |
}; | |
loadChatwootScript(); | |
}, []); | |
return null; | |
}; | |
export default ChatwootWidget; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment