Retrieve interactions for a contact using code

Applies to Dynamics 365 for Customer Engagement apps version 9.x

Use the msdyncrm_LoadInteractionsPublic action to programmatically retrieve interactions for a contact. This action is useful for responding to get-my-data requests in order to fulfill the General Data Protection Regulation (GDPR) compliance.

Tip

You can also generate request and response classes for this action to include in your application code. More information: Generate early-bound types for an action

Action parameters

The msdyncrm_LoadInteractionsPublic action expects the following input parameters:

Name Type Description
ContactId Edm.String ID of the contact record to retrieve the interactions for. Required.
DateFrom Edm.String Start date in the MM-DD-YYYY format from which you want to retrieve interactions. Optional.
DateTo Edm.String End date in the MM-DD-YYYY format until which you want to retrieve interactions. Optional.
InteractionType Edm.String Type of interaction to be retrieved. Required.
You can specify one of the following values:
  • ActivityContactBlocked
  • ActivityContactDispatched
  • ActivityContactProcessingFailed
  • CreateCrmActivityContactProcessed
  • CreateCustomChannelActivityContactProcessed
  • CustomChannelResponse
  • CustomerJourneyContactRecordUpdated
  • EmailBlockBounced
  • EmailBlocked
  • EmailClicked
  • EmailContainsBlacklistedLinks
  • EmailDelivered
  • EmailFeedbackLoop
  • EmailForwarded
  • EmailHardBounced
  • EmailOpened
  • EmailSendingFailed
  • EmailSent
  • EmailSoftBounced
  • EmailSubscriptionSubmit
  • EventCheckIn
  • EventRegistration
  • FormSubmitted
  • FormVisited
  • InvalidRecipientAddress
  • InvalidSenderAddress
  • LeadScoreBoost
  • OutOfEmailCredits
  • PassThroughActivityContactProcessed
  • RedirectLinkClicked
  • SchedulerActivityContactProcessed
  • SegmentRelationshipEdited
  • SegmentSubscribed
  • SegmentUnsubscribed
  • SplitterActivityContactProcessed
  • SurveyResponse
  • TriggerActivityContactProcessed
  • TriggerCrmWorkflowActivityContactProcessed
  • WebsiteClicked
  • WebsiteVisited
Top Edm.Int32 Optional. Non-negative integer that limits the number of interactions returned for a contact record. Optional.
SkipToken Edm.String Identifies a starting point in the collection of interactions returned for a contact record. Optional.

Action return type

The msdyncrm_LoadInteractionsPublic action returns the following value:

Name Type Description
msdyncrm_LoadInteractionsPublicResponse ComplexType Contains the response from msdyncrm_LoadInteractionsPublic action. It contains the following properties that contain the structured data of the type:
Name Type Description
Data Edm.String List of interactions as an escaped JSON array.
NextSkipToken Edm.String Identifies the next cursor or bookmark in the collection of interactions returned for a contact record.

Example

Request

POST [Organization URI]/api/data/v9.0/msdyncrm_LoadInteractionsPublic HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0
  
{
    "InteractionType": "WebsiteClicked",
    "ContactId": "0dbe0fa3-8e18-e811-a951-000d3a37caec",
}

Response

The response contains a JSON object with a Data property containing the full list of interactions.

HTTP/1.1 200 OK  
Content-Type: application/json; odata.metadata=minimal  
OData-Version: 4.0

{
    "@odata.context":"[Organization URI]/api/data/v9.0/$metadata#Microsoft.Dynamics.CRM.msdyncrm_LoadInteractionsPublicResponse",
    "Data":"[{\"InteractionId\":\"172C1E59A3CD4D85B392316DD76651CE\",\"InteractionType\":\"EmailSent\",\"Timestamp\":\"2018-02-23T13:10:48Z\",\"OrganizationId\":\"e47e99c2-20e3-4ef3-bbd4-288258bd6bf9\",\"EmailDomain\":\"microsoft.com\",\"ActivityId\":\"b6aeb700-f1c1-4cb1-e8f8-e883eac6bfbc\",\"SendingId\":\"5a019802-f763-3b72-fc91-0a9c95b67c5f\",\"ContactId\":\"0dbe0fa3-8e18-e811-a951-000d3a37caec\",\"MessageId\":\"5a2f3e76-9518-e811-a951-000d3a38caec\",\"CustomerJourneyId\":\"4c3846a1-9618-e811-a951-000d3a37cafc\",\"CustomerJourneyIterationId\":\"538825cf-fe1c-4fee-a671-7984eabb62eb\",\"UsageType\":\"CustomerJourney\",\"EmailAddressUsed\":\"sample@adventure-works.com\"}]",
    "NextSkipToken":null
}

See also

Data protection and the GDPR