All LibraryPricingDemo
Resources
Webflow ComponentsWebflow DOM ElementsCovert 10,000+ SVG to DOM. ChatGPT Prompts for Webflow
LoginLogout
LogoutLoginSign up

Inapp Chat Feature using Memberstack

A short guide to learn how to add chat feature from CometChat to your site in less than 10mins to any sites using memberstack.
Watch Tutorial
Get Library
View Demo
Required Script*
Copy this <script> and paste into the Head or Body of your Page

<script defer src="https://widget-js.cometchat.io/v3/cometchatwidget.js">
</script>

Make Scenerios*
Download this Scenerios and upload them to make
Create CometChat User after member sign up on Memberstack.
Download
Add Friend scenerio.
Download
Set up Commet Chat*
Copy this <script> and paste into the Head or Body of your Page
Replace every ID's Value to yours.
<script>
window.addEventListener('DOMContentLoaded', (event) => {
function logout() {
  CometChatWidget.logout().then(
    () => {
      console.log("Logout Successful");
    },
    (error) => {
      if (error.code === 'USER_NOT_LOGED_IN') {
        console.log('User already logged out');
      } else {
        console.log("Logout failed with error:", error);
      }
    }
  );
}

CometChatWidget.init({
  "appID": "YOUR_ID",
  "appRegion": "YOUR_APP_REGION",
  "authKey": "YOUR_AUTH_KEY"
}).then(response => {
  console.log("Initialization completed successfully");
  // You can now call login function.
  let storedMemberID = localStorage.getItem('_ms-mem');
  if (storedMemberID) {
    const memberId = JSON.parse(storedMemberID).id; // Parse the stored data to get the member ID
    console.log('Using Member ID from local storage:', memberId);

    // Login with the member ID
    CometChatWidget.login({
      "uid": memberId
    }).then(response => {
      CometChatWidget.launch({
        "widgetID": "YOUR_WIDGET_ID",
        "target": "#TARGET_DIV",
        "roundedCorners": "true",
        "defaultID": "", // default UID (user) or GUID (group) to show,
        "defaultType": 'user' // user or group
      });
    }, error => {
      console.log("User login failed with error:", error);
      // Check the reason for error and take appropriate action.
    });
  } else {
    console.log('No Member ID found in local storage');
    // If user is not found, log them out
    logout();
  }
}, error => {
  console.log("Initialization failed with error:", error);
  // Check the reason for error and take appropriate action.
});
});
</script>
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Add Functionalites to Webflow without code. ✊🏽
Be the first to try out new libraries and updates.
Subscribe
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Links
All LibrariesWebflow ComponentsMulti-step FormsChatGPT Prompts for Webflow
Flowscriipts ©2024. All rights reserved.
Made forWebflow