Yoann Boudou

sprnv.com + sprnv.io
We make hardware supply chain work in Shenzhen. + product development engineering + contract manufacturing + worldwide logistics

[✅] Talk.js + Memberstack

Hi guys 👋 

I am trying to integrate Talk.js to my website in order to enable user-to-user instant messaging communication. For obvious reasons, I'd like Talk.js to pull data from MS to make the conversation more personal.

The integration is fairly well documented and I've been able to add the widget with ease onto one of my CMS page.

In below demo code from Talk.js, I've been able to add custom field very easily to the "var other" variables since it only requires me to add custom field from Webflow CMS to the code (this var other refers to my CMS library).

However, for the "var me" variables, it does not refer to the CMS being used but instead to the user currently logged in (on MS). In other words, I can't use Webflow's custom field but have to pull the data from MS instead. I've tried adding ms-data="xxx" after each variable (id: ms-data="id") but with no success. Since I'm not a dev, I guess there is a simple "syntax" error that prevents me from pulling the data from MS here, hopefully there won't be a need for an API call and whatnot.

It's more of a general coding question but any help with this integration would be highly appreciated (and will benefit to a lot of people too I believe).

Cheers 🤙

Talk.ready.then(function() {
    var me = new Talk.User({
        id: "123456",
        name: "Alice",
        email: "alice@example.com",
        photoUrl: "https://demo.talkjs.com/img/alice.jpg",
        welcomeMessage: "Hey there! How are you? :-)"
    window.talkSession = new Talk.Session({
        appId: "YOUR_APP_ID",
        me: me
    var other = new Talk.User({
        id: "654321",
        name: "Sebastian",
        email: "Sebastian@example.com",
        photoUrl: "https://demo.talkjs.com/img/sebastian.jpg",
        welcomeMessage: "Hey, how can I help?"

    var conversation = talkSession.getOrCreateConversation(Talk.oneOnOneId(me, other))

    var inbox = talkSession.createInbox({selected: conversation});

Like Comment