Redigera

Dela via


Retrieve outbound marketing interactions for a contact using code

Note

Dynamics 365 Marketing and Dynamics 365 Customer Insights are now Customer Insights - Journeys and Customer Insights - Data. For more information, see Dynamics 365 Customer Insights FAQs

New Customer Insights - Journeys customers receive real-time journeys features only. For more information, see Default real-time journeys installation.

Important

This article only applies to outbound marketing, which will be removed from the product on June 30, 2025. To avoid interruptions, transition to real-time journeys before this date. More information: Transition overview

Important

The method below to retrieve interactions has been deprecated and may not be available in the future.

To retrieve interaction data, the current recommended method is to set up Azure Blob storage and connect it to the Dynamics 365 Customer Insights - Journeys app. Learn more: Prepare for analytic reporting with Power BI

Use the msdyncrm_LoadInteractionsPublic action to programmatically retrieve interactions for a contact. This action is useful for responding to get-my-data requests to comply with various privacy laws and regulations.

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
  • EmailContainsBlockListedLinks
  • 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
}