Hyvor Talk Comments + Memberstack SSO Integration

This is a simple and quick guide on integrating Hyvor Talk commenting system on Memberstack applications using Single Sign-on (In simple terms, use Hyvor Talk for comments and moderation, and Memberstack for login).

  • No coding knowledge required
  • This uses Hyvor Talk’s Single Sign-on feature, which is only available in the 14-days trial period or the business plan of Hyvor Talk.

1. Setting up Hyvor Talk

First, go to the Hyvor Talk console. You’ll be asked to create a Hyvor account. After that, you will see the Add Website section. Here, fill in the data and register your website with Hyvor Talk.

Adding website to the Hyvor Talk console before Firebase configuration
Add Website to Hyvor Talk

Now, you will see the installation section and your new Website ID. We will need this website ID in the last step.

Copy the website ID
Your Website ID

2. Setting up Single Sign-on

Next, turn on Single Sign-on from the console. Make sure the SSO Type is stateless. You will need the Private Key in the next step.

Setting up Single Sign-on for membestack comments
Turn on Single Sign-on

3. Installing Hyvor Talk and Connecting with Memberstack

Add this code to the place where you need the comments section to load.

<div id="hyvor-talk-view"></div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
<script>
    var HYVOR_TALK_WEBSITE = YOUR_WEBSITE_ID;
    var HYVOR_TALK_CONFIG = {
            url: false,
            id: false
        };
    MemberStack.onReady.then(function(member) {
        var HYVOR_TALK_PRIVATE_KEY = 'YOUR_PRIVATE_KEY';
        var userData = member.loggedIn ? {
            id: member["id"],
            name: member["name"] || member["email"].replace(/@.+/, ''),
            email: member["email"]
        } : {}
        userData = btoa( JSON.stringify( userData ) )
        var hash = CryptoJS.HmacSHA1(userData, HYVOR_TALK_PRIVATE_KEY).toString();
        HYVOR_TALK_CONFIG.sso = {
            hash: hash,
            userData: userData,
            loginURL: "YOUR_LOGIN_URL"
        }
        var script = document.createElement("script");
        script.src = "//talk.hyvor.com/web-api/embed.js";
        script.async = true;
        document.body.appendChild(script);
    });
</script>

In this code, replace:

  • YOUR_WEBSITE_ID with the website ID you got in the first step. (Ex: var HYVOR_TALK_WEBSITE = 1234;
  • YOUR_PRIVATE_KEY with the private key you got in the second step (make sure to keep quotes as it is. For example, if your private key is abcd, the code should be var HYVOR_TALK_PRIVATE_KEY = 'abcd';.)
  • YOUR_LOGIN_URL with the URL of the login page of your website. (Keep the quotes)

Now, the Hyvor Talk comments section should appear on your website and will use Memberstack login. By default, there will also be a guest commenting option, which you can disable from the console if needed.

Security Note: Our SSO private keys and hashing are designed to be handled on the server-side. However, when you do not have access to a back-end, you will need to handle them in the front-end via Javascript. This way, accounts are secured by user IDs. Therefore, you have to make sure that the user IDs of your users are not shared publicly with anyone.

Conclusion

You have just completed setting up Hyvor Talk comments with Memberstack. Now, you can go through the console and change some appearance and community settings as needed. Hyvor Talk also supports an array of languages. You can also find more details in our documentation about customising and moderating.

If you have any questions, comment below or feel free to contact us.