# People  
Connect to the Infobip customer data platform, [People](https://www.infobip.com/docs/people), to retrieve and update information about end users. In People, this information is stored in Person profiles.
  
You can do the following:
  
- When end users interact with your chatbot, you can capture relevant information from the conversations and store this information in the Person profiles.
- You can retrieve information about end users from their Person profiles.
  
People is enabled by default when you enable Answers.
  
The People features that are available in Answers depends on your Answers [plan](https://www.infobip.com/docs/answers#plans).
  
|  |
|  |
| Basic functionalities of People, such as profiles, file upload, tags, segments, and custom fields | Supported | Supported | Supported | Supported |
| Advanced functionalities of People, such as custom events, profile scoring, and calculated fields | Supported | Unsupported | Supported | Supported |
  
## Attributes  
  
Use attributes to add or retrieve information about end users from People. Use this information to personalize your responses to end users.
  
The attribute types are as follows:
  
- [Standard](https://www.infobip.com/docs/people/manage-data#standard-attributes): Information in standard fields. Example: Contact information
- [Custom](https://www.infobip.com/docs/people/manage-data#custom-attributes): Customized information that is not available as a standard field. Example: End date for a subscription
- [Computed](https://www.infobip.com/docs/people/manage-data#computed-attributes): Information obtained through custom formulae, profile scoring, and event aggregation. Use these attributes to do the following:
    - Customize your messages to end users. Example: If the end user has purchased a product in the last 7 days, you can ask them "*Are you contacting us regarding your recent order?*"
    - If the end user's profile score is high, you can prioritize their requests
  
You can only retrieve computed attributes from People and cannot update them.
  
### Attribute Mapping [#attribute-mapping-attributes]
  
Use custom mapping to map an attribute in Answers with an attribute in People. Example: In Answers, you can store the location of the end user in the Location_City attribute and map it to the City attribute in People.
  
Make sure that the attribute type in Answers is compatible with that in People. Example: If the attribute type in Answers is Boolean, you cannot map it with a Text attribute in People.
  
When you use the **Get information** action (People to Answers), you can map attributes as follows:
  
| Attribute type in People | Attribute type in Answers |
| --- | --- |
| TextGender | Text |
| Decimal numberWhole number | Number |
| True/False | Boolean |
| DateDate Time | Date |
| List of objects | List |
  
When you use the **Create or update person profile** action (Answers to People), you can map attributes as follows:
  
| Attribute type in Answers | Attribute type in People |
| --- | --- |
| TextPhone numberLocationURLEmail | Text |
| NERMO | Text |
| Boolean | True/False |
| List | List of objects |
  
## Custom Events
  
When an end user interacts with your chatbot and performs an action, you can pass this event to People. The event is saved as a [custom event](https://www.infobip.com/docs/people/events#custom-events) in People. You can then use this information when the end user interacts with your chatbot again or use it in other Infobip solutions.
  
Example: An end user purchases a product during a session with your chatbot. Save this event as a custom event in People. You can then do the following:
  
- Use the event as context in Answers and Conversations: The end user contacts your business again after 3 days. The chatbot or agent can mention the purchase in the initial message. "*How can I help? Are you contacting us regarding your recent purchase?*"
- Follow up with the end user through a Flow campaign in Moments: "*Based on your recent purchase, here are some products that you may like.*"
- Use the event properties to populate [computed attributes](https://www.infobip.com/docs/people/manage-data#computed-attributes) in People. You can use computed attributes for use cases such as populating total lifetime spend, average spend, most common request, and last answers dialog. You can then use these attributes to personalize your communication in Answers or to improve segmentation in Moments.
- Mark the Person profile as high priority: The next time the end user contacts your business, you can prioritize them.
  
### Process [#process-custom-events]
  
The process is as follows:
  
1. In Answers, an end user performs an action, such as saving a product to the cart.
2. Save each relevant property of this event in Answers attributes. Example: successful addition of a product to cart; and identifier, name, and price of the product.
3. Pass these attributes to People, where you can save them in a [custom event](https://www.infobip.com/docs/people/events#custom-events) in the end user's Person profile.
  
Follow the instructions in each section.
  
#### Create a Custom Event in People [#create-a-custom-event-in-people-custom-events]
  
1. Log on to the Infobip [web interface](https://portal.infobip.com//).
2. Go to **People** > **Events** > **Custom Events**.
3. Select **Create event**.
4. Add the **Event Name** and **Description**. Example: To save the event of an end user adding a product to cart, create the event, AddedToCart.
5. Select **Add event property**.
6. Enter the event **Property Name**. Create as many properties as required. Example: To save the event of adding a product to cart, you can create properties for successful addition of the product to cart (addedCart), identifier of the product (productID), name of the product (productName), and the price of the product (productPrice).
7. Click **Save**.
  
#### Send a Custom Event to People [#send-a-custom-event-to-people-custom-events]
  
1. Go to **Answers** > **Chatbots** and open your chatbot.
2. In the **Attributes** tab, do the following:
		1. Create the attributes in which you want to save the event properties. Example: To save the event of adding a product to cart, you can create attributes for successful addition of the product to cart (addedCart), identifier of the product (productID), name of the product (productName), and the price of the product (productPrice).
		For each attribute, make sure that you create equivalent event properties in People. Also, make sure that the attribute type is [compatible](https://www.infobip.com/docs/people#attribute-mapping-attributes) with the event property, which you created for the event in People.
		2. (Optional) Create an attribute to identify the Person profile. Example: customerContact.
  
3. Create a dialog to send the event from Answers to People. Example: Added to Cart.  
4. Drag the **People custom event** element.
5. Configure the element as described in the [People custom event](https://www.infobip.com/docs/answers/chatbot-elements/core-elements#people-custom-event) documentation.
6. In the **People custom event** element, find the Person profile in which you want to save the event. Do the following:
		1. In the **Contact information attribute** field, enter the Answers attribute that contains customer contact information. Example: customerContact.
		2. In the **Contact information attribute type** field, select the attribute type. Make sure this field matches the data type of the attribute that you selected in the **Contact information attribute** field.
7. In the **Custom event configuration** section, specify the event that will be saved against the Person profile. To do so, use the attribute in which the event is saved.
		1. Click **Add custom event**.
		2. Choose the event that you created in People. Example: AddedToCart.
8. (Optional) Add properties to the event.
		1. Click **Add attribute mappings**.
		2. Choose one or more Answers attributes that contain the event properties. Example: addedCart, productID, productName, and productPrice.
		3. For each Answers attribute, choose an equivalent event property, which you created for the event in People. Example: addedCart, productID, productName, and productPrice. Make sure that the Answers attribute type and People event property are [compatible](https://www.infobip.com/docs/people#attribute-mapping-attributes).
				Answers does not support **dateTime** property. If you want to pass a dateTime value into an event, save the value in a Text attribute in Answers and map the attribute to a Text property type.
9. Click **Add**.
10. (Optional) Check whether the event was saved successfully to the Person profile. Add a [ **Conditions**](https://www.infobip.com/docs/answers/chatbot-elements/core-elements#conditions) element. Configure the element as follows:
		1. In the attribute field, choose the predefined attribute **lastPeopleStatusCode**.
		2. Set the operator to **is**.
		3. Specify the status - **Success**.
		4. Branch the chatbot flow as required.
    
The event, along with its properties, is saved in the end user's Person profile in People.
  
## Product events
  
Save Answers [product events](https://www.infobip.com/docs/people/events#product-events-standard-events) such as the start or end of a chatbot session to [Person profiles](https://www.infobip.com/docs/people/get-started#person-profile) in People. When an end user starts a session with your chatbot, the following happens.
  
- If a profile exists for the end user, the events are added to the profile.
- If a profile does not exist, a new profile of type Customer is automatically created in People. The product events are then added to this profile.
  
Note
To use this functionality, you must [enable the relevant Product events](https://www.infobip.com/docs/people/events#enable-disable-standard-events) for Answers in People.
  
## Tags  
  
Use the [People tags](https://www.infobip.com/docs/answers/chatbot-elements/core-elements#people-tags) element in Answers to update tags in People. You can do the following:
  
- **Add or create tags**: Add one or more existing tags to a profile or create new tags.
- **Get tags**: Verify whether the specified tags are present in a profile.
- **Remove tags**: Remove one or more tags from a profile.
  
## Create a People chatbot  
  
This section shows how to build a basic chatbot that connects with People. Follow these steps:
  
1. In the chatbot editor, drag and drop the [People profile](https://www.infobip.com/docs/answers/chatbot-elements/core-elements#people-profile) element into a dialog.
2. Click the **People profile** element that you added.
3. In the **Select action** field, specify the required action to perform. You can either get information from People or post information (create/update) to People. For this example, choose **Create or update person profile**.
4. In the **Contact information attribute** field, specify the attribute that you want to use. You can either use a standard channel-specific attribute stored in People, or a custom attribute in Answers. By default, this value is set to **endUserDestination**.
5. For custom attributes, click **Add attribute mapping** to map the attributes in People and Answers. Refer to the guidelines in the [Attributes](https://www.infobip.com/docs/integrations#attributes-people) > Attribute Mapping section.
6. Check whether the event was saved successfully to the Person profile. Add a **Conditions** element. Configure the element as follows:
		- In the attribute field, choose the predefined attribute **lastPeopleStatusCode**.
		- Set the operator to **is**.
		- Specify the status - **Success**.
		- Branch the chatbot flow as required.
  
If you use List attributes, the list values are added to the list. If you want to overwrite list values instead of adding the values to the list, use the overwrite option when you map attributes. You can overwrite the list only when creating or updating profiles.