Connect your user base using the RumbleTalk chat room Login SDK


If you have your own users base and wish to connect it to your RumbleTalk Chat,
you can use the these API instructions to set it up.

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.


Administrator - prevent the regular login option


  1. Log-in to your administrator panel
  2. Go to your chat Settings
  3. Click on the Settings 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


Administrator - set your user preferences

login Type: You will need to choose, at least, one type of login option to make the auto login work.

  • Guest (anonymous) - Using your user base's username only
  • RumbleTalk (Members and admins) - Using your user base's combined with predefined users in RumbleTalk.

Moderator: creating an administrator for your chat is recommended.

  1. How to create your own chat administrator (moderator)?
    Create a chat room moderator in RumbleTalk's users base.
    Make sure the exact username is defined both in your user base and in RumbleTalk's
  2. When the system will try to log you, using the Login SDK, into your chat room, you will be prompt to enter a password.
    * After the first login a cookie will be saved and you will log in automatically until manually logged out

Extra: two options that you should know

  • Allow Guests Login - If your users are not imported into the RumbleTalk's users base, make sure that the "Allow Guests Login" is checked.
  • View the conversation - If you want that everyone will be able to see the conversation while only registered users will be able to chat, make sure that the "Allow Viewers" checkbox is checked as well.

What to do on your end?

First, add the following code to the page with the chat in your website. Preferably (but not necessary) at the <head> section.

<script type="text/javascript">
(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','v0.4',window,document,'script');
</script>


Secondly, get your chat hash code as shown in the image below (highlighted in yellow)

RumbleTalk hash code for integrating with SDK


Then 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 fields from your users base.

<script type="text/javascript">
rtmq(
    'login',
    {
        hash: 'YOUR_CHAT_HASH',
        username: 'USERNAME',
        password: 'PASSWORD',
        callback: 'CALLBACK_FUNCTION'
    }
);
</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.
  3. PASSWORD [optional] - The predefined password.
    * If you're using the "Guest" option, this field should be ignored.
  4. 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!




Advanced option: Logout

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

<script type="text/javascript">
rtmq(
    'logout',
    {
        userId: 'USERS_ID', // [optional]
        username: 'USERS_NAME' // [optional]
    }
);
</script>

The [optional] parameters "USERS_ID" and "USERS_ID" are used only to validate that the correct user is being 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"

Advanced option: Logout callback

Chat owners can now also listen to the event of a user logout. To do so, call the following function:

<script type="text/javascript">
// necessary settings for callback function
rtmq(
    'config',
    {
        usePostMessage: true
    }
);

// set the callback function
rtmq(
    'logoutCB',
    {
        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) {
    console.log(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)


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: This is an intended behavior. This is the way the Guest login option works.
You can switch to the RumbleTalk login option that uses username and password, which is also more secure. It uses RumbleTalk's RESTful API to create and manage your users in RumbleTalk's user base as well. This option requires programming, but creates a much more controllable and secure chat.


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

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.

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.