MemberStack.io

Group chat - Users to User Chat

Hi everyone. I’m glad to use Memberstack. I have found a user to user chat application that name is tlk.io

It allows communicating members with each other.
It is currently taking users with their user names and automatically registering them into the chat room which you created. So they don’t need to authenticate again. BUT!

In this case, I don’t know How do I use attributes that described on the tlk.io.

Does anyone know How can I use data-nickname with memberstack’s data attributes?

I’am feeling the solution but I cannot find

Thank you

1 Like

Hi @kaan_bingol. welcome to the community!

I can help with this. It will just require a tad bit of custom code.

Can you post the current embed you have for tlk? I’ll work with that.

1 Like

Sweet! This will get you to the code: https://tlk.io/#embed

I want to confirm that’s all he has. Sounds like he’s already added some attributes.

Thank you @belltyler, I added code of the tlk.io and it works.

But I don’t understand how can I setup custom nickname.

memberstack is using “ms-data” and tlk.io is using “data-nickname”

You understand the reference

1 Like

I cannot get usernames It’s working without usernames :frowning:

1 Like

What’s the value of the ms-data that needs to be set to data-nickname?

For example, is it ms-data=“nickname”?

1 Like

This code assumes that you have a custom field called “nickname” in MemberStack.

Step 1:
Remove the <script async src="http://tlk.io/embed.js" type="text/javascript"></script> portion of the embed code.
Don’t delete this portion <div id="tlkio" data-channel="hey" style="width:100%;height:400px;"></div>

Step 2:

Add this code to the footer of your site.

<script>
    MemberStack.onReady.then(function(member) {
        
        var nickname = member["nickname"]

        var tlkio = document.getElementById("tlkio")

        tlkio.setAttribute("data-nickname",nickname)

        var tlkio_script = document.createElement("script")
        tlkio_script.src = "http://tlk.io/embed.js"
        tlkio_script.async = true
        document.head.append(tlkio_script)

    })
</script>

let me know how it goes!

1 Like

Yep It’s working but I had to fix something. data-name to data-nickname

Thank you all @belltyler & @DuncanHamra

2 Likes