Documentation

Request User Details Component

Request User Details Component

The widget allows you to request user details, such as name and/or email. When this is configured, a form will be presented in the chat widget for the user to submit their information. Once the form is submitted, the user's details will be stored in the conversation object.

How to Request User Details

To request user details, you can use a standard form payload that includes name and email fields, along with an additional isRequestUserDetails property. Below is an example of the JSON payload:

{
  "type": "form",
  "payload": {
    "isRequestUserDetails": true,
    "fields": [
      {
        "name": "name",
        "type": "text",
        "label": "Name",
        "validation": {
          "required": {
            "value": true,
            "message": "Name is required"
          }
        },
        "placeholder": "Enter name"
      },
      {
        "name": "email",
        "type": "email",
        "label": "Email",
        "validation": {
          "pattern": {
            "value": "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$",
            "message": "Please provide a valid email"
          },
          "required": {
            "value": true,
            "message": "Email is required"
          }
        },
        "placeholder": "[email protected]"
      }
    ],
    "closeFormMessage": "",
    "closeButtonEnabled": false
  }
}