Skip to main content

User identification flow


The User Identification flow in bot conversation is the process of identifying the user interacting with the bot. This is achieved by requesting the unique identifier from the user. It could be an email address, phone number or other identifier.


Date datatypes are not supported for the userId. It supports String, Number, email, and phone types.

Significance of identifying users

The user identification is an important aspect of bot conversation design, as it allows for a more personalized and engaging user experience. User identification helps in the following:

  • Personalized responses: When a user is identified, the bot can tailor its responses to the individual user's needs and preferences. This can lead to more relevant and helpful responses, which can improve the overall user experience.
  • Context maintenance: User identification allows the bot to maintain context throughout the conversation and across different channels. This means that the bot can use user data and the interaction with the user, and use that information to provide more accurate and useful responses in subsequent interactions.
  • Improved engagement: By providing personalized responses and maintaining context, the bot can create a more engaging conversation with the user. This can lead to increased user satisfaction and higher levels of engagement with the bot.
  • Better data collection: User identification also allows the bot to collect more detailed and accurate data on individual users. This can be used to improve the bot's performance over time, by providing insights into user behavior and preferences.

Understand how user identification flow works

The primary objective of the User Identification flow is to ensure that the userId is captured for users that interact with the bot on any channel.


If the userId is not captured before initiating a conversation, a blank user record is created without a userId with a user starts conversation. If capturing of userId is not managed properly, it may result in the creation of duplicate records for the same user, one with a userId and one without. This can also lead to the creation of multiple unidentified records for different sessions.

The following are the steps involved:

  1. You first need to define the user property that needs to considered as the userId. Whenever the selected property is updated, the userId will be automatically updated with the same value.

    For example, if you select the phone user property, each time a value is captured for the phone property, that same value will also be automatically copied and assigned to the userId field.

  2. At the beginning of every conversation, the bot verifies if the userId is known.

  3. If it is not known, the User identification flow is triggered to capture the userId.


For details on how user records are created through conversations and unified in User 360, see this article.

Setup user identification flow

To add the User identification flow to your bot, follow these steps:

  1. Navigate to Studio > Build > Conversation settings.

  1. On the pop-up screen that appears, click User identification.

  2. Select the relevant identification flow - Phone identification flow, Email identification flow or Custom property flow.

Phone identifier flow

Select this option if the phone user property serves as the unique identifier for your users. Make sure to collect the phone number and store it in the phone user property, which is already set by default for this identifier flow.

Email identifier flow

Select this option if email user property serves as the unique identifier for your users. Make sure to collect the email address and store it in the email user property, which is already set by default for this identifier flow.

Custom property identifier flow

Select this option if the unique identifier of your users is any property other than email or phone. In this case:

  1. Choose the custom property that serves as the unique identifier for your users. Please note that only String, Number, email, and phone data types are supported for the custom property.

  2. To create a new property and store it as userId, click on +Create new user property > Enter Property name and choose Property type > Click Add.

  3. Collect property value.

    1. To collect property values from user input

    Collect the selected user property using the Prompt node and use Save response in to map the variable to the user property.

    2. To capture property values from the bot script

    Use the syntax: data.variables.variableName

    For example, in the sample script below, to capture the phone number as the userId, use data.variables.phoneNumber:

    `<script type="text/javascript">`  
    window.ymConfig = {"bot":"x1673261303850","host":"[](", "payload":{"name":"Tom","phoneNumber":"9090000000","email":"[[email protected]](mailto:[email protected])"},};
    (function() {
    var w = window,
    ic = w.YellowMessenger;
    if ("function" === typeof ic) ic("reattach_activator"), ic("update", ymConfig);
    else {
    var d = document,
    i = function() {
    function l() {
    var e = d.createElement("script");
    e.type = "text/javascript", e.async = !0, e.src = "[](";
    var t = d.getElementsByTagName("script")[0];
    t.parentNode.insertBefore(e, t)
    i.q = [], i.c = function(e) {
    }, w.YellowMessenger = i, w.attachEvent ? w.attachEvent("onload", l) : w.addEventListener("load", l, !1)}

3. To capture property values from Function

You can use the Function node to capture and store the variable in the respective user property.

For instance, here returnId is the function name containing the provided code.

return new Promise(resolve => {
let payload = data.profile.payload
if (typeof (payload) === "string") {
payload = JSON.parse(payload);

Store the response returned by the Function in the corresponding variable, in this case, 'userId`.

4. To capture property values from payload

First, store the payload in an object variable.

Sample payload

"name": "Tom",
"email":"[email protected]"

To access a specific key value from the object variable, use the syntax: {{{variables.objVariableName.key}}}

For example:

  • {{{variables.userData.phoneNumber}}}
  • {{{}}}
  • You can also use SDK APIs to programmatically set user properties and the user ID.
  • You can also make use of Function to extract the required information from a payload.

What next?