Developer Platform
  • Home
  • Getting Started
    • General Information
    • Features Overview
    • Security
  • APPs
    • Public Apps
      • Shopify
      • Salesforce
      • Zendesk
      • Google Analytics
    • Build your App
      • Getting started
      • My Apps
      • App information
      • App Parameters
      • App Plugins
      • Add Webhooks
      • Submit your Apps
      • App security
      • Developer Policy
  • Use Cases
    • Copilots
      • Product Catalog sync through API
      • FAQ sync through API
    • Visitor experience
      • Integrating custom buttons into your site
      • Check availability before escalating to iAdvize
      • Authenticated Messaging
        • Introduction
        • Web client-side implementation
          • Authenticated Messaging overview
          • Brief timeline of the integration process
          • How to enable authenticated mode in the administration portal?
          • How to implement the customer authentication backend (token provider)?
          • How to authenticate with iAdvize in client's website?
          • How to deal with activation success or failure?
          • How to logout?
          • Compatibility with Mobile SDK
          • FAQ
        • Web backend implementation
          • Important information and recommendations
          • Signature and Encryption Detailed Process
          • Technical backend implementation
          • FAQ
      • Cross-domain Conversation Continuity
      • Customize replies with Markdown
    • Agent workspace
      • Custom App example and step-by-step tutorial
        • Get Started
        • Work with the Desk
        • Intent / Trigger
        • JWT
        • References
    • Administration
      • Users
        • SAML SSO Authentication - Implementation Guide
        • Create, update and delete users via API
        • Manage the availability of your users with the iAdvize API
        • Integrate the iAdvize conversation panel into an existing tool
    • Data & Analytics
      • Anonymize a conversation or visitor data
      • Create a custom dashboard
      • Find contact data using GraphQL
      • Retrieve conversations data
      • Retrieve messages exchanged within a conversation
  • Technologies
    • GraphQL API
      • Terminology
      • Reference
      • Authentication
      • Schema lifecycle
      • Error Management
      • Pagination
    • REST API (deprecated)
      • Statistic (deprecated)
      • Group (deprecated)
      • Call meeting (deprecated)
      • Operator (deprecated)
      • Skill (deprecated)
      • Transaction (deprecated)
      • Visitor (deprecated)
    • Webhooks
      • Reference
      • Guides
    • Desk events
      • Reference
    • Web & Mobile SDK
      • Javascript Web SDK
        • Reference
      • Javascript Callbacks
        • Reference
        • Guides
      • Mobile SDK
        • Fourme (latest)
        • Epoisses
        • Dauphin
        • Cantal
        • 🤝Support Policy
        • 🤔Frequently Asked Questions
    • Custom App
    • External Bot
      • Implementation
        • Configuration flow
        • Conversation flow
        • Conversation objects
      • Configuration
      • FAQ
      • Best practices
Powered by GitBook
On this page
  • Include the tag
  • Activate the tag with an identity
  • Provide an identity after an anonymous activation
  • What happens to an ongoing anonymous conversation when the visitor signs in?
  • Conversation scenarios

Was this helpful?

  1. Use Cases
  2. Visitor experience
  3. Authenticated Messaging
  4. Web client-side implementation

How to authenticate with iAdvize in client's website?

PreviousHow to implement the customer authentication backend (token provider)?NextHow to deal with activation success or failure?

Last updated 1 year ago

Was this helpful?

To enforce a proper secured visitor authentication, the authentication mode needs to be activated. Therefore, the iAdvize tag will wait for an “authentication” instruction before loading and engaging the visitor in a conversation. It differs from the standard non-authenticated mode.

However, it is also possible to let the visitor chat in an anonymous way with authenticated mode on. Details are provided below.

Include the tag

You can dispatch the authentication instruction before the tag is included, or after. Either way, you will need to include the main iAdvize tag this way:

<script> 
window.iAdvizeInterface = window.iAdvizeInterface || []; 
iAdvizeInterface.config = { 
        sid: '<YOUR-SITE-ID>' 
} 
</script> 
<script async src="//<YOUR-PLATFORM>.iadvize.com/iadvize.js"></script>

Activate the tag with an identity

When the authenticated mode is on, the tag won’t activate until an authentication instruction is dispatched.

  • Case A - if the visitor needs a real signed in identity from the client server needs, the system waits for a token,

  • Case B - if the visitor can chat without a real identity, use an anonymous authentication. If the visitor later signs in (see next section), the conversation will continue - either with the content of the previous signed in conversation (if it exists), or with the content of the previously anonymous conversation.

// Secured authentication - case A 
iAdvizeInterface.push((iAdvize) => { 
        iAdvize.activate(async () => { 
                const visitor_token = await ... // your backend logic to generate a JWE 
                return { 
                        authenticationOption : { type: 'SECURED_AUTHENTICATION', token: visitor_token } 
                }; 
         }); 
}); 

// OR Anonymous authentication - case B 
iAdvizeInterface.push((iAdvize) => { 
        iAdvize.activate(() => ({ 
                authenticationOption: { type: 'ANONYMOUS' } 
        })); 
});

Provide an identity after an anonymous activation

A common scenario would be a visitor that arrives anonymously on your website, then signs in their authenticated space.

In this scenario, the Case B mentioned above for the activation has been chosen. Which means the tag has been activated anonymously, using this line:

iAdvizeInterface.push((iAdvize) => {
        iAdvize.activate(() => ({ authenticationOption: { type: 'ANONYMOUS' } }));
});

Now, after a successful sign-in, the client needs to feed the iAdvize tag with the token authenticating the visitor. This can be done by triggering the same "activate" method:

const afterLoginIadvizeIdentityCallback = () => { 
        iAdvizeInterface.push((iAdvize) => { 
                iAdvize.activate(async () => { 
                        const visitor_token = await ... // your backend logic to generate a JWE 
                        return { 
                            authenticationOption : { type: 'SECURED_AUTHENTICATION', token: visitor_token }; 
                        }; 
                 }); 
         }); 
}; // it is the brand responsibility to trigger such callback after sign-in

What happens to an ongoing anonymous conversation when the visitor signs in?

If the visitor was chatting anonymously, then signed in:

  • they will keep their ongoing conversation if they do not have an ongoing conversation in their authenticated space

  • they will get their previous conversation back if they chatted while authenticated before

Conversation scenarios

Conversation scenario

Scenario

1

Across multiple computers / browsers

  • Sarah visits the website on her personal mobile

  • Sarah starts a conversation as an anonymous visitor

  • Sarah authenticates in the customer space, and can continue her conversation

  • Sarah visits again the day after (whatever the delay) on her professional computer

  • Sarah authenticates in the customer space

  • Sarah sees her ongoing conversation again

2

  • Sarah visits the mobile site on her smartphone / tablet etc.

  • Sarah starts a conversation as an anonymous visitor

  • Sarah’s conversation is closed or not by an agent

  • Sarah visits the mobile app on her smartphone / tablet etc.

  • Sarah authenticates in the customer space

  • Sarah doesn’t see her ongoing conversation or closed conversation, she can just see the last authenticated conversation - Coming in v2.6 of the mobile SDK

3

Multiple on-going conversation

  • Sarah visits the mobile site on her smartphone / tablet etc.

  • Sarah authenticates in the customer space

  • Sarah starts a conversation, but leaves it open

  • Sarah visits again the day after (whatever the delay) on her computer

  • Sarah starts a conversation as an anonymous visitor

  • Sarah authenticates in her customer space

  • Sarah starts a conversation

  • Sarah sees the on-going conversation she created on her smartphone, and she can’t continue the anonymous conversation she just created. If she wants to get back at her anonymous conversation, she has to logout.

4

Expired Session

  • Sarah visits the mobile site on her smartphone / tablet etc.

  • Sarah authenticates in the customer space

  • Sarah starts a conversation, and leaves it open

  • Sarah leaves the site without logout, and visits again the day after (whatever the delay) on her smartphone / tablet etc. The session has expired, she’s not authenticated anymore. She can’t see anymore the conversation.

  • Sarah authenticates in the customer space

  • Sarah sees her ongoing conversation again

5

Multiple visitors

  • Sarah visits the website on her family computer

  • Sarah starts a conversation as an anonymous visitor

  • Sarah’s conversation is not closed by an agent

  • Sarah leave the website

  • Paul visits the website the day after (whatever the delay) on the same computer

  • Paul authenticates in the customer space

  • If Paul never had an authenticated conversation before, he sees Sarah’s on-going anonymous conversation. But if he already have one, then he sees his conversation and not Sarah’s.

You will need to replace `<YOUR-SITE-ID>` with your actual site ID, which can be found on the admin :

Across mobile site & mobile app of the brand using one device Only available Q3 2022

https://ha.iadvize.com/admin/site/current/code