Code-based Actions: Update profile attributes for an anonymous user
When a customer visits your page, it is expected that the user is logged through their personal account. In this case, you can pass that information into your bot by setting a custom originator. When the customer visits your page anonymously without a login option, you can still personalize the user experience for that user.
In the example below, we show you how to ask the user for information and add that to their profile. You will have a name added to the profile that you can use within your bot design or whenever there is a handoff to an agent. Follow the steps below to capture the user details and personalize the user experience.
-
Ask for user input: Ask the user for input. In this case, we want to know the name of the user so we ask “What is your name?”.
-
Modify profile attributes: To use the input we can use the Any Text trigger and then store the response as a parameter (or variable). When that value is available within a parameter we can use it later in our conversation and use it to change the profile attributes. To change those attributes we need to change the name of the parameter to any of the following:
- user.name
- user.firstName
- user.lastName
For the above example, we have set the attribute user.name to the user input.
- Follow up with a personalized experience: You can now follow up with a bot reply that uses that information or you can hand the conversation off to an agent that will immediately see the name of the user.
Updated about 1 year ago