How it works
The Get Contact block can be used to fetch the contact information associated with the current user. The example below shows a flow that identifies the user and takes different actions based on whether their contact details exist.
- When the chat starts, the
Get Contact
block is executed to check if a contact exists for the current user.We’re using theuser_id
variable to search for the associated contact. This is a system variable that contains the user’s unique ID. If this variable doesn’t exist in your builder, you can import it from the Variables menu. - If a contact is found, the information is stored in variables. For example, we’re storing the contact’s first name and email in the
first_name
andemail
variables. - Next, the Variable condition block is used to check if the
email
andfirst_name
variables are not empty.- If they’re not empty, it means the user is a returning user. In this case, we skip the form and greet the user by name.
- If they’re empty, it means the user is new. In this case, we show the form to collect the user’s name and email.