Engati - User Guide
...
Deploying the bot
Website
Custom buttons and Deep linking
2min
deep linking deep linking we have exposed a few functions that customers can use directly on their websites to stimulate some actions window\ engtchat open() → open the bot window\ engtchat close() → minimize the bot window\ engtchat sendquery('any string here') → open the chat widget and trigger a path when a user clicks a specific button on the website to enable the deep linking feature without needing to call the above functions, we need to add a custom script for the customer’s bot from ma under display settings the custom script window\ addeventlistener("hashchange", (event) => { const locationhash = location hash; if (locationhash) { const query = location hash substring(1); const prefix = query split(" "); if (prefix\[0] === "engt") { if (locationhash === "#engt chat open") { window\ engtchat open(); } else if (locationhash === "#engt chat close") { window\ engtchat close(); } else { const \[, message] = prefix; const elements = array from( document queryselectorall(`\[href="${locationhash}"]`) ); if (elements? length) { if (elements\[0]? getattribute("data engthashlistener") !== "true") { elements map((el, i) => { if (i === 0) el setattribute("data engthashlistener", "true"); el addeventlistener("click", () => { window\ engtchat sendquery(message join(" ")); }); }); window\ engtchat sendquery(message join(" ")); } } else { window\ engtchat sendquery(message join(" ")); } } } } }); now, customers can simply have anchor tags on their page with an href equal to one of the following to trigger certain things shopify customers can just add these href values to any element from their shopify portal itself \#engt chat open clicking on an element with this href will open the bot \#engt chat close clicking on an element with this href will close the bot \#engt \<any faq here> clicking on an element with this href will trigger an faq on the bot for example, if the href is #engt about us, the message “about us” will be sent to the bot and it will execute any faq matching this query, so now customers can directly trigger any path in the bot by clicking on buttons/elements on their website by simply setting up an faq for the path and attaching the same faq to the href of any element on their website in this format #engt \<faq>