User Management and Authentication

Modified on Fri, 28 Oct, 2022 at 2:33 PM

AtomChat does not have its own User management and Authentication System. It uses your website's user authentication mechanism to validate and add users.

How are your users added to AtomChat?

Like every communication tool, AtomChat has a Contacts tab. This is basically a list of your users from where they can chat with each other. 

This contact list gets populated when a user logs in to your website after AtomChat is added. 

User details like the username, profile image, user-role are all fetched from your website's authentication.  

So do your users need to create a separate account to chat? The answer is NO.

Let's dive in to see how your users are Sync with AtomChat! 

One-the-Fly Method

The code below is the basic code that has to be added to your site for AtomChat to fetch user details. 

NOTE: The variables in the code have to be dynamically assigned.

<!-- USER MANAGEMENT CODE -->

<script>
  var chat_name = 'John Doe';
  var chat_id = '1';
  var chat_avatar = 'https://www.yoursite.com/avatars/1.png';
  var chat_link = 'https://www.yoursite.com/john-doe';
</script>

<!-- LAUNCH ATOMCHAT CODE -->

<!-- Refer to Launch AtomChat page for this code -->

Variable

Description

Mandatory

chat_name

Display name of the logged-in user

Yes

chat_id

Unique ID of the logged-in user

Yes

chat_avatar

Avatar image URL of the logged-in user



chat_link

Profile page URL of the logged-in user




If you are using PHP, in most cases this information will be stored in your session variable after logging in the user. So your code will be similar to:

 <!-- USER MANAGEMENT CODE BELOW -->

<script>
var chat_name = '<?php echo $_SESSION['name'];?>';
var chat_id = '<?php echo $_SESSION['id'];?>';
var chat_avatar = '<?php echo $_SESSION['avatar'];?>';
var chat_link = '<?php echo $_SESSION['profile'];?>';
</script>

<!-- LAUNCH ATOMCHAT CODE BELOW -->

<!-- Refer to Launch AtomChat page for this code -->

Apart from the On-the-Fly method, users can also be added to AtomChat via our Restful API 

Via Restful API

You can use our createUser API to create users using your server code. Typically, you should create them when the user signs up.

<!-- USER MANAGEMENT CODE -->

<script>
var chat_id = '1';
</script>

<!-- LAUNCH ATOMCHAT CODE -->

<!-- Refer to Launch AtomChat page for this code -->


Via AtomChat's Admin Panel

 
If you do not want to sync your users with AtomChat when they login to your site, you can use our Admin Panel to manually manage your users. 

Go to your AtomChat Admin Panel -> Users -> Add New User to create a new user.

<!-- USER MANAGEMENT CODE -->

<script>
var chat_id = '1';
</script>

<!-- LAUNCH ATOMCHAT CODE -->

<!-- Refer to Launch AtomChat page for this code -->

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article