Custom channel activity create interaction
Note
On September 1, 2023, Dynamics 365 Marketing and Dynamics 365 Customer Insights will be sold together under a single product SKU called Dynamics 365 Customer Insights. The individual applications will be renamed Dynamics 365 Customer Insights - Journeys and Dynamics 365 Customer Insights - Data, respectively. For more information, see Dynamics 365 Customer Insights FAQs
Additionally, on September 1, 2023, new Customer Insights - Journeys customers will receive real-time journeys features only. For more information, see Default real-time journeys installation. Many documentation pages currently refer to outbound features that may not be available or may work differently in real-time journeys. The documentation content is being updated to note whether it applies to real-time journeys or outbound marketing.
Important
This article only applies to outbound marketing.
The following table describes the input parameters required by the msdyncrm_CustomChannelActivityCreateInteraction
action:
Input parameter | Type | Description |
---|---|---|
ActivityId | String | The msdyncrm_activityid attribute value of the msdyncrm_customerjourneycustomchannelactivity entity containing custom channel Activity Id. |
CustomerJourney | EntityReference | The msdyncrm_customerjourney attribute value of the msdyncrm_customerjourneycustomchannelactivity entity containing Entity Reference to customer journey originating the call. |
CustomerJourneyIteration | EntityReference | The msdyncrm_customerjourneyiteration attribute value of the msdyncrm_customerjourneycustomchannelactivity entity containing Entity Reference to customer journey iteration. |
Contact | EntityReference | The msdyncrm_contact attribute value of the msdyncrm_customerjourneycustomchannelactivity entity containing Entity Reference to processed contact. |
EntityType | String | The msdyncrm_entitytype attribute value of the msdyncrm_customerjourneycustomchannelactivity entity containing the string representing the entity type of custom entity created in step1 and defined in the custom channel tile definition. |
EntityId | String | The msdyncrm_entityid attribute value of the msdyncrm_customerjourneycustomchannelactivity record id of the custom entity created in step1 and defined by the EntityType element in the custom channel tile definition. |
ResponseType | String | Id of one of the response types defined in the custom channel tile definition. |
TriggerKeyword | String | (Optional) Keyword for custom response type defined in the custom tile definition. |
The XML below shows the section of the custom channel tile definition. This section defines three types of responses. The first two, sent
and delivered
, are the standard response types. The third one, keyword
allows passing additional textual value to the interaction.
<ResponseTypes>
<ResponseType id="sent">
<Labels>
<!-- Labels should always have a Label for 1033 -->
<Label locId="1033">Sent</Label>
<Label locId="1031">[Sent]</Label>
</Labels>
</ResponseType>
<ResponseType id="delivered">
<Labels>
<!-- Labels should always have a Label for 1033 -->
<Label locId="1033">Delivered</Label>
<Label locId="1031">[Delivered]</Label>
</Labels>
</ResponseType>
<ResponseType id="keyword" custom="True">
<!-- there should be only one response type with attribute custom=true -->
<Labels>
<!-- Labels should always have a Label for 1033 -->
<Label locId="1033">Keyword match</Label>
<Label locId="1031">[Keyword match]</Label>
</Labels>
</ResponseType>
</ResponseTypes>
Emit custom Channel Activity Create Interaction
The following code shows how to emit Custom Channel Activity Create Interaction programmatically. In this example, reference activity is defined in the custom channel activity record. We emit the interaction with ResponseType = keyword
and TriggerKeyword = interested
.
var orgServiceFactory = serviceProvider.GetService(typeof(IOrganizationServiceFactory)) as IOrganizationServiceFactory;
IOrganizationService orgService = orgServiceFactory.CreateOrganizationService(context.UserId);
//Id of msdyncrm_customerjourneycustomchannelactivity entity
Guid Id = "<Record Guid>";
//Get response from your service or use predefined response type for keyword based responses.
string responseType = "keyword";
//Get keyword response from your service (Optional)
string triggerKeyWord = "interested";
//Note: if you emmiting interaction on creation of msdyncrm_customerjourneycustomchannelactivity entity instance, there is no need to retrieve it, you can use Target
Entity customChannelRecord = orgService.Retrieve( "msdyncrm_customerjourneycustomchannelactivity",Id,new Microsoft.Xrm.Sdk.Query.ColumnSet(true));
var emitInteractionRequest = new OrganizationRequest("msdyncrm_CustomChannelActivityCreateInteraction");
emitInteractionRequest.Parameters.Add("ActivityId", customChannelRecord.GetAttributeValue<string>("msdyncrm_activityid"));
emitInteractionRequest.Parameters.Add("CustomerJourney", customChannelRecord.GetAttributeValue<EntityReference>("msdyncrm_customerjourney"));
emitInteractionRequest.Parameters.Add("CustomerJourneyIteration", customChannelRecord.GetAttributeValue<EntityReference>("msdyncrm_customerjourneyiteration"));
emitInteractionRequest.Parameters.Add("Contact", customChannelRecord.GetAttributeValue<EntityReference>("msdyncrm_contact"));
emitInteractionRequest.Parameters.Add("EntityId", customChannelRecord.GetAttributeValue<string>("msdyncrm_entityid"));
emitInteractionRequest.Parameters.Add("EntityType", customChannelRecord.GetAttributeValue<string>("msdyncrm_entitytype"));
emitInteractionRequest.Parameters.Add("ResponseType", responseType);
//Needed if response type has “custom” attribute set to “True”
emitInteractionRequest.Parameters.Add("TriggerKeyword", triggerKeyWord);
//Emit interaction
orgService.Execute(emitInteractionRequest);