Client Tokens for Web Chat Channels

Prev Next

In the Web Chat channel, MindBehind supports three types of authentication: anonymous, through a one-time code delivered to the client's mobile phone as an SMS message, or tokens if the client already signed in to your website. It is important to directly authenticate them when they use MindBehind's Web Chat installed on your website.

To generate a channel management token, follow the steps below:

  1. Navigate to your company profile page. 

  2. Go to the Channels tab and generate a token for the target Web Chat channel. 

  3. Copy the channel ID and management token. Keep them in a safe place.

  4. Call our endpoint to generate a token for your client with the following information:

Endpoint URL

https://app.mindbehind.com/external/v1/incoming/mbWebChat/token

HTTP Method

POST

Required Header

“apiToken” as the channel management token

Body

It should be in JSON format with the following schema:

  • clientID: This is your system client ID. It can be any string. You can also use your client's phone number if you want.

  • channelID: This is your channel ID. You will get this when you generate the management token.

  • tokenAge: This is an optional parameter. An integer number overrides the token age chosen in channel settings or the default token age, which is 24 hours.

  • properties: This is an optional parameter that maps additional properties for your user, such as name, email, etc.

Result

You will get a JSON payload as follows: { success: true, token: <The generate token as string> }

  1. After you get the token, you will need to inject the token and your client ID into the window object in JavaScript before putting the MindBehind web chat script as below:
    window.MB_TOKEN = "<The generated token>";
    window.MB_CLIENT = "<Your client id>";

After the end users open the web chat widget, they will be automatically authenticated with our system until the token expires.