Connect your user base using the RumbleTalk chat room Login SDK

RumbleTalk API Auto Login

If you have an existing user base and want to link it to your RumbleTalk Chat, you can set it up using these API instructions.

What can you do with the Login SDK?

  1. With the RumbleTalk's Login SDK, your users will be logged into your chat automatically.
  2. With the RumbleTalk's Login SDK, you can set that only registered users of your user base will be automatically logged into your chat room (with manual intervention).
  3. RumbleTalk RESTful API can be used, along the Login SDK, if more advanced integration is needed.
  4. WordPress website owners do not need to use these instructions. The RumbleTalk chat room plugin is integrated already. All you need to do is download the WordPress chat plugin and set it according to the instructions in the plug-in.

1. Administrator - prevent the regular login option

  1. Log-in to your administrator panel.
  2. Go to Settings > General & Logins.
  3. Click on the Login Options tab.
  4. At the bottom, check the "Automatic login (using your own users base) - removes the login interface" option.
Using RumbleTalk API - SDK to auto login to the chat

2. Administrator - set your user preferences

Make sure the usernames are exactly the same in both your user database and in RumbleTalk's user database.

After the first login, a cookie will be saved and you will log in automatically until manually logged out.

3. What to do on your end?

Add the following code to the page with the chat in your website, preferably (but not necessarily) at the <head> section.

<script>
(function(g, v, w, d, s, a, b) {
    w['rumbleTalkMessageQueueName'] = g;
    w[g] = w[g] ||
    function() {
    (w[g].q = w[g].q || []).push(arguments)
    };
    a = d.createElement(s);
    b = d.getElementsByTagName(s)[0];
    a.async = 1;
    a.src = 'https://d1pfint8izqszg.cloudfront.net/api/' + v + '/sdk.js';
    b.parentNode.insertBefore(a, b);
})('rtmq', 'v1.1.0', window, document, 'script');
</script>

4. Automatic login

Add the following code, along with the regular chat code, when a user has been authenticated by your system. This means you will need to dynamically populate this field from your users base.

<script>
rtmq(
    'login',
    {
        hash: 'YOUR_CHAT_HASH',
        username: 'USERNAME',
        password: 'PASSWORD', // [optional]
        image: 'IMAGE', // [optional]
        forceLogin: 'FORCE_LOGIN', // [optional]
        callback: 'CALLBACK_FUNCTION' // [optional]
    }
);
</script>
  1. YOUR_CHAT_HASH - 8 characters code, representing your chat (see the image above; it can be found in the dashboard)
  2. USERNAME - The username of the user. * This field should be changed based on the authenticated user and must NOT contain commas ","
  3. PASSWORD - [optional] The predefined password. Must NOT contain commas ","
    * If you're using the Guest option, this field should be ignored.
  4. IMAGE - [optional] An image URL to be used as the user avatar
    * Only used with the Guest option.
  5. FORCE_LOGIN - [optional] When set to true, will first log out the currently logged in user, and then execute the login command.
    This only affects the user of the browser that executed the command
  6. CALLBACK_FUNCTION - [optional] a callback function that will be called (with the result as the first parameter) when the login process is done.

You are done!


5. Advanced option: Logout

Chat owners can now logout users using the Login SDK. To do so, call the following function:

<script>
rtmq(
   'logout',
   {
      hash: 'YOUR_CHAT_HASH',
      userId: 'USER_ID', // [optional]
      username: 'USER_NAME' // [optional]
   }
);
</script>

The [optional] parameters "userId" and "username" are used for validation only;Ensuring that the correct user is logged out. They can be used separately or together. Excluding them will remove the connected user (who's browser called the function) regardless of their "user id" and\or "username"

6. Advanced option: Logout callback

The "CALLBACK_FUNCTION" will be called with a "reason" variable when the user logs out of the chat. An example of the callback function is such:

<script>
rtmq(
   'logoutCB',
   {
      hash: 'YOUR_CHAT_HASH',
      callback: CALLBACK_FUNCTION
   }
);
</script>

The "CALLBACK_FUNCTION" will be called with a "reason" variable when the user logs out of the chat. An example of the callback function is such:"

function (reason) {
    // code to execute on logout
}

currently, the following values are possible for the reason variable:

  • "button_clicked" - the user clicked on the logout button
  • "sdk_request" - the "logout" function of the SDK was called
  • "unknown" - the user disconnected from the chat for an unknown reason (such as network connectivity problems)

7. Advanced option: Open Private Chat

Chat owners can now open private chat using the Open Private Chat SDK. To do so, call the following function:

<script>
rtmq(
   'privateChat',
   {
      hash: 'YOUR_CHAT_HASH',
      userId: 'USER_ID', // [optional]
      username: 'USER_NAME' // [optional]
   }
);
</script>

The [optional] parameters "userId" and "username" are used for validation only; Ensuring that the correct private chat to the user is opened. Only one of the parameters userId and username can be used, if both were used, userId will be prioritized. If none were used, it will not open a private chat.

8. Troubleshooting

Q:

 All seems to be okay for windows users; but for mac users, none of the users are able to login.

A:

 Please make sure you are using the latest Login SDK version (update it in the code you added to < head> of your pages).


Q:

 If I open the window in multiple browsers, multiple user instances are created. What is the reason for this?

A:

 The most common reason why the automatic login is not working, is that the "Allow guest logins" option is disabled for the chat room you are setting up.


Q:

 I can't get the autologin to work using the RumbleTalk JS SDK.

A:

 If you use the "Allow RumbleTalk login" only, you'll need to do one of the following:

1. Use RumbleTalk's RESTful API to automate the creation/update of your users.

2. Manually add each of your users.

The second solution (Allow guest logins) is much more simple.


Q:

 I am using Chromium browser, it seems not to allow autologin.

A:

 We do not support Chromium browser. Sorry.


Q:

 Any way to show the corresponding avatar from the forced SDK?

A:

 The force SDK will use the default avatar. To use a custom avatar, you will need to use our RESTful API to create users with avatars.

RumbleTalk online group chat platform offers a free forever moderated group chat
and several paid plans with more features, and support.

GET A FREE CHAT NOW