For advanced usage including sending messages programmatically, see Send
message programmatically.
Interactive Example
Basic Usage Example
Simple button that opens the chat widgetMethod 1: Creating a Custom Button
Step 1: Insert the Button Code
Locate the section of your website where you want the button to be displayed. Insert the following HTML code:Step 2: Customize the Button
Feel free to personalize the appearance and text of the button. For instance, you can replace the “Chat with Molin AI” text with a label that better fits your brand. Additional CSS can be added to style the button according to your design preferences. Example using Tailwind CSS:
Method 2: Making an Existing Element Clickable
If you already have an element (such as an image, graphic, or text) on your website that you’d like to use for launching the Molin chat, follow these steps:Step 1: Wrap The Existing Element
Wrap the existing element in an <a> tag and insert the following snippet. Replace the ‘Insert your element here’ text with the HTML element you wish to make clickable:Testing
Regardless of the method you choose, remember to conduct thorough tests to ensure everything is functioning as intended. By following either of these methods, you can make it easy for visitors to open your Molin AI chat window directly from your website.Technical Note
- ‘molin-shop-ai’ is our web component that allows for interaction via JavaScript.
- ‘openChat’ and ‘closeChat’ are two publicly available methods on the web component for controlling the chat window.
Related Documentation
- Send message programmatically - Advanced API for sending messages programmatically
- Show/Hide Widget - Control widget visibility