I have a button on my website (click to open chatbot). Is it possible that I can link this to the AI chatbot, so when someone clicks on the chatbot button the AI chatbot automatically opens? Which code do I need to add to get this done?
2 Likes
I’ve checked your website and couldn’t find the button with this text there. Could you please send me a screenshot of this button?
You can find the button here: Service - Keuken op Wielen
1 Like
Thank you!
We’ve added this code to the Custom JS field on the General tab of your widget’s settings:
const triggerBtn = document.querySelector('.button.is-icon.keesicon');
triggerBtn?.addEventListener('click', (e) => {
e.preventDefault();
e.stopImmediatePropagation();
const chatWindow = document.querySelector(
'[class*="widget-window__MessagesContainer-sc"]'
);
if (!chatWindow) {
const openChatBtn = document.querySelector(
'[class*="eapps-ai-chatbot"] [class*="FloatingButtonContainer-sc"] button'
);
openChatBtn?.click();
}
});
Please check your website and let me know if you like how it works
1 Like
Thanks!! It works!
3 Likes
Great, you’re always welcome
1 Like