How to: Integrate a community chat widget

The community chat widget is a customizable chat window for your website that enables real-time communication among users. With features like private messaging and moderation tools, it enhances engagement and fosters a positive community atmosphere.

Implement the community chat widget

  1. To make the chat appear on your site, you need to integrate the following script on your site to load the community chat widget :
    < script type = 'text/javascript' >
    window.toky_customVars = {
    productId: 'PRODUCT_ID_HERE'
    };
    (function () {
    var toky = document.createElement('script');
    toky.type = 'text/javascript';
    toky.async = true;
    toky.src = 'https://community.mywebsite.com/webview/embed.js';
    (document.getElementsByTagName('head')[0] ||
    document.getElementsByTagName('body')[0]).appendChild(toky);
    })();
    </script>
  2. Then, replace [community.mywebsite.com] with the subdomain chosen for your community platform
    👉 The productId variable is optional. It is used to display the product concerned by the question on the community platform so that members can consult it.
  3. The productId variable must have a value for product pages
    On pages other than products, you can :
    Delete : window.toky_customVars = { productId:'PRODUCT_ID_HERE' }
    Or replace it with : window.toky_customVars = {} ;
  4. Copy the code to the place where you want to install the module on your site:
    If you want the TokyWoky chat on all pages: on the template/layout of the site ⇒ Which we strongly recommend.
    If you want the TokyWoky chat on specific pages: before the body of each page

Open chat functions (optional)

These functions allow you to open the chat from a button to arrive on a specific tab.

  1. To open the chat directly the Ask tab you have to call the following function: toky.widget.openQuestions()
  2. To open the chat directly the Answer tab you have to call the following function: toky.widget.openAnswers()
  3. To open the chat directly the Inbox tab, call the following function: toky.widget.openInbox()
Was this article helpful?
0 out of 0 found this helpful