# Interactions Listing

> Source: https://docs.recombee.com/reql/functions/interactions-listing

> For the complete documentation index, see [llms.txt](/llms.txt).

# Interactions Listing

Note

These functions are not enabled by default due to higher resource consumption. Contact [support@recombee.com](mailto:support@recombee.com) if you need to enable them, and please specify the types of interactions needed in your request.

| Name                                               | Description                                       | Example                                                      |
| -------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------ |
| [user\_interactions](#reql-func-user-interactions) | Returns list of interactions by a particular user | user\_interactions(context\_user\["userId"\], {"purchases"}) |

## User Interactions

Returns a list of interactions by a particular user.

These interactions are of given `interaction_types` and are ordered by timestamp from the oldest to the most recent.

Each interaction is a dictionary with the following fields:

```
{
  "userId": string,
  "itemId": string,
  "timestamp": timestamp,
  "type": string
}
```

### Definition

```
user_interactions(user_id, interaction_types, num_interactions)
```

| Argument           | Type                 | Meaning                                                        |
| ------------------ | -------------------- | -------------------------------------------------------------- |
| user\_id           | string               | Id of a user                                                   |
| interaction\_types | set                  | [Interaction types](/api/interactions) that should be returned |
| num\_interactions  | Non negative integer | _Optional._ Return only that number of latest interactions.    |

### Example

```
// Get IDs of items that the user purchased or viewed
map(lambda 'it': 'it'["itemId"], user_interactions(context_user["userId"], {"detail_views", "purchases"}))

// Returns true if the user consumed some content in French
exists(lambda 'it': item_values('it'["itemId"])["language"] == "FR",
			user_interactions(context_user["userId"], {"purchases"}))
```