-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from T-Rahul-prabhu-38/main
Feat: chatbot has been added #340
- Loading branch information
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import{ useEffect } from 'react'; | ||
|
||
const Chatbot = () => { | ||
useEffect(() => { | ||
// Set the chatbot config | ||
window.embeddedChatbotConfig = { | ||
chatbotId: "rL36bLvnKl-LBrT-vmYpR", | ||
domain: "www.chatbase.co", | ||
}; | ||
|
||
// Create the script element to load the chatbot | ||
const script = document.createElement('script'); | ||
script.src = "https://www.chatbase.co/embed.min.js"; | ||
script.setAttribute("chatbotId", "rL36bLvnKl-LBrT-vmYpR"); | ||
script.setAttribute("domain", "www.chatbase.co"); | ||
script.defer = true; | ||
|
||
// Append the script to the document body | ||
document.body.appendChild(script); | ||
|
||
// Cleanup the script when the component unmounts | ||
return () => { | ||
document.body.removeChild(script); | ||
}; | ||
}, []); | ||
|
||
return <div id="chatbot" />; | ||
}; | ||
|
||
export default Chatbot; |
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