When you've deployed your bots, your customers and site visitors will start interacting with them. However, when you deploy your bots on your website or support portal, you can offer a better experience based on who they are: customers (signed in) or visitors (not signed in). You can do this with a condition to check if their email address is present or blank.

  1. Create two bot flows, one for your customers (who have logged in) and one for your site visitors (those who haven't logged in), and optimize their experience accordingly.

  2. Make the first flow private. You'll use this flow only to check if any email address is passed from the portal/website to the bot flow. This doesn't have to be visible to your customers.

  3. Now, we can check if the customer is logged in by setting up a condition to check the email address. This will populate the email address in the bot script if they are logged in to the bot script.

  4. Open the conditions panel by clicking on the conditions icon of any dialog > + New condition > Insert > Properties > Customer email. Configure a condition in the private flow we created earlier with the default property for the customer email.
    Note: You can also use other default user properties like customer name, phone number, etc, to verify the user details.

  5. Here we are checking if the customer email value is present or not. We can set up conditions to trigger the right bot flow. For example, based on this
    • If an email is present (the property is not equal to a blank value), then it's an existing customer since they have logged in. They can be directed to the flow designed for existing customers, and in our case, that would be the flow with Dialog 3.1.

    • If the customer email is not present (equal to a blank value), then they have not logged in, which means that they are a new visitor to the page and can be redirected to the flow designed for new visitors, and in our case, that would be the flow with Dialog 4.1.

  6. We must ensure that the bot receives the customer's name and email to use the conditional flows we set up. Let's set up the bot script for this.

  7. Navigate to Deploy > Self-service widget > and toggle the Name property and the Email ID property > Save.

  8. Add the variables you use on your website & portal for the customer's name and email address. For example, if you use the variable {{name-variable}} and {{email-variable}} for their name and email address, respectively, this is how it will look.

Here's what happens sequentially:

  1. Your customer's name and email are stored in the variables on your website.

  2. These variables and values are passed to your bot. This works as the same variables are used in the bot script for the name and email properties.

  3. If the bot detects non-empty name and email fields, it will understand that this is a logged-in customer and redirect them to the bot flow for customers.

  4. If the bot script detects empty name and email fields, it will understand that this is a logged-out visitor, and redirect them to the bot flow for visitors.