Get contact with interactions
Use RelatedInteractionsExpandOptions to specify the range of interactions and interaction facets that should be returned with each contact. In the following example, interactions from the last 10 days are returned with each contact, limited to a maximum of 30 interactions. The LocaleInfo facet is also returned for each interaction if it is present.
The following table describes how to use the RelatedInteractionsExpandOptions class:
|
Property |
Description |
|---|---|
|
|
Read-only property - passed in to the constructor as an array of strings and specifies which facets to return with each interaction |
|
|
The interaction start date/time must be equal to or greater than this value. Use DateTime.MinValue to get the earliest interactions. |
|
|
The interaction end date/time must be equal to or less than this value. Use DateTime.MaxValue to get the most recent interactions. |
|
|
The maximum number of interactions to return between the specified dates. |
The following example demonstrates how to use ContactExpandOptions and RelatedInteractionsExpandOptions together. Contacts are returned with the PersonalInformation facet and any interaction older than ten days, limited to 30 interactions.
Get all interactions
Get all interactions
Set the following minimum and maximum values to return all available interactions with each contact.
Filtering interactions
Filtering interactions
You may only want to work with a subset of a contact’s interactions, such as any interaction with the WebVisit facet. There are two ways to filter a contact’s interactions:
-
Return all available interactions using
RelatedInteractionsExpandOptionsand filter the collection in memory -
Search all interactions and filter by contact ID
In the following example, a contact and all available interactions for that contact are returned using the .Get<Contact>/.GetAsync method. The collection of interactions is then filtered down to a subset of interactions that have the WebVisit facet and at least one Outcome:
In the following example, interaction search is used to retrieve all interactions that have at least one Outcome and match a particular contact ID: