Creating and managing a login webview using Sunshine Conversations

What's my plan?

Add-on | AI agents - Advanced

Collecting data from authenticated users to determine what information can be shared and not asking the user to provide these details through AI agent messages is a great user experience.

In most cases, we find that users that have an account are already logged in, but for those instances when they are not and reach a flow that would require the user to be authenticated, what is the best way to handle it?

The easiest way to handle this is to either hide the widget behind a log-in wall or prompt people to log-in before starting the chat, but in terms of user experience, being able to do it within the flow and not adding barriers to entry for support is the preferred method.

Understanding the Sunshine Set-up

Sunshine Conversations supports the JSON web token (JWT) authentication method where all conversations are assigned an external ID. Known users can have the ID you have in your own directory, but anonymous (non-signed-in users) will be assigned an ID.

Documentation on how to set this up on Sunshine Conversations or Zendesk can be found here

When setting up the script for authentication there are two types of calls you can make init() or login(). If you are allowing users to use the chat without logging in, you will want to use the init() method. Find out more here.

Creating the Webview

Creating Templates, including Webviews are available directly within AI agents - Advanced. They are webpages that can be embedded within the chat so the user can do tasks without leaving the page. Simply give the webview a name, define what the text should say as a message and the button and then the URLs that should be used to initialize the authentication.

Building the Dialogue Flow

Conditional Blocks are going to be our friends in this process.

Check if the user is logged in - we do this by looking for the ID you are using for authentication, such as the external ID. If the user is logged in they can continue on as intended.

If the external ID is empty, we can then send the webview shorthand that was created in the previous step within the templates view.

Merge the users that were created?