How to Create a Custom Channel in Dynamics 365 Customer Insights - Journeys – Complete Step-by-Step Guide
Introduction
Dynamics 365 Customer Insights - Journeys provides built-in communication channels such as Email, SMS, and Push Notifications. However, businesses often need to communicate with customers through additional platforms such as WhatsApp, third-party SMS gateways, custom notification providers, or their own communication services.
What happens when the communication provider you want to use isn't available as a native channel?
This is where Custom Channels in Dynamics 365 Customer Insights - Journeys become useful.
Custom Channels allow us to integrate external communication providers with Customer Insights - Journeys. We can define our own channel, configure its connection details, design message fields, and implement custom plugin logic to send messages through an external provider.
In this article, we'll walk through the complete process of creating a custom channel manually, starting from the Microsoft sample solution package and progressing through channel configuration, message creation, Custom API development, and journey integration.
By the end, we'll have a reusable custom channel that can support multiple message templates and can be used in Customer Insights - Journeys.
1. Understand the Custom Channel Architecture
Before starting the implementation, let's understand the main components involved in creating a custom channel.
A custom channel consists of several components that work together.
| Component | Purpose |
|---|---|
| Custom Channel Package | Contains the Dataverse solution components and plugin implementation |
| Channel Instance | Represents a configured sender or connection to the external provider |
| Channel Definition | Defines the custom channel and connects its configuration and APIs |
| Channel Message Part | Defines the fields available when creating a message |
| Custom Channel Message | Stores the actual message content and configuration |
| Custom Message Editor | Provides a customized interface for creating messages (optional) |
| Custom API | Provides the entry point for executing outbound plugin logic |
| Plugin | Processes the message payload and communicates with the external provider |
The overall flow looks like this:
Create and customize the custom channel solution package.
Import the solution into Dataverse.
Configure the extended Channel Instance entity.
Define the Channel Message Parts.
Define the Channel Definition.
Configure the outbound Custom API.
Create a Channel Instance in Customer Insights - Journeys.
Create custom channel messages with the required fields.
Process the message through the plugin.
Use the message in a customer journey.
The important thing to understand is that the Channel Definition describes the channel, whereas the Channel Instance represents a configured sender or connection.
For example, if we create a WhatsApp custom channel, the channel definition represents WhatsApp as a communication channel. A channel instance represents a particular WhatsApp sender or provider connection.
The channel can then be used to create and manage multiple message templates.
2. Download and Prepare the Custom Channel Package
The first step is to obtain Microsoft's sample custom channel solution.
Microsoft provides sample solutions containing the Dataverse solution structure and plugin projects required to implement a custom channel.
Official documentation:
Look for the SampleCustomChannel.zip package under the Sample solutions section.
2.1 Extract the Package
Download the SampleCustomChannel.zip file and extract it to your development machine.
The sample contains the solution project and plugin implementation.
Instead of directly importing the sample package, we'll customize it according to our own implementation requirements.
For example, we may want to change:
Publisher prefix.
Solution name.
Custom table names.
Custom table logical names.
Custom API names.
Plugin class names.
Message fields.
Channel display name and configuration.
2.2 Update the Solution Publisher Prefix
The Microsoft sample uses its own publisher prefix.
For this implementation, let's assume our publisher prefix is:
contoso
We want our custom components to follow a consistent naming convention.
For example:
| Component | Example logical name |
|---|---|
| Channel Instance Extended Entity | contoso_customchannelinstance |
| Message Configuration Entity | contoso_customchannelmessage |
| Message Text Field | contoso_text |
| Placeholders Field | contoso_placeholders |
Replace the sample publisher prefix with your own prefix wherever the sample references custom component names.
Important: Don't blindly replace every occurrence of the existing prefix in all files. Check the component type and references before modifying them.
Microsoft's existing platform components, such as msdyn_channeldefinition, msdyn_channelmessagepart, and msdyn_channelinstance, must retain their original names.
Only rename components that belong to your custom solution.
2.3 Update Custom Table Names
If you change the custom table names, update all references to those tables.
Pay particular attention to:
Entity logical names.
Relationship definitions.
Form definitions.
Channel definition metadata.
Plugin references.
Custom API configuration.
Solution component references.
The Channel Instance extended configuration entity must also follow Microsoft's naming requirements.
One important requirement is that its logical name must use lower camel case.
2.4 Rebuild and Package the Solution
After updating the solution:
Open the plugin project in Visual Studio.
Update the necessary namespaces and class references.
Build the plugin project.
Verify that the generated DLL is copied into the solution's PluginAssemblies folder.
Package the unmanaged solution using Power Platform CLI.
Microsoft recommends using Solution Packager to package the solution.
Example command:
pac solution pack --zipfile C:\Temp\CustomChannelSolution.zip -f C:\Source\CustomChannel\unmanaged --packagetype BothThe generated ZIP file is now ready to be imported into your Dataverse environment.
Tip: Maintain separate development and deployment packages, and verify that the final solution contains the plugin assembly and all required metadata components.
3. Create the Extended Configuration Entity for Channel Instance
After importing the custom channel solution, the next step is to configure the Channel Instance.
A Channel Instance represents a particular sender or provider connection.
For example, if we integrate a WhatsApp provider, the instance might contain:
Provider API URL.
API key.
Sender ID.
Account ID.
Authentication information.
Other provider-specific settings.
These configuration values should not be hardcoded in the plugin.
Instead, we'll create a custom Dataverse table to store the extended configuration.
3.1 Create a Custom Dataverse Table
Create a new table in your solution.
Example:
Table display name: Custom Channel Instance
Logical name: contoso_customchannelinstance
Add the configuration columns required by your provider.
Example:
| Column | Data type | Purpose |
|---|---|---|
| contoso_apiurl | Text | Provider API endpoint |
| contoso_apikey | Text | API authentication key |
| contoso_senderid | Text | Sender identification |
| contoso_accountid | Text | Provider account identifier |
These are example fields. Your actual configuration depends on the external communication provider.
3.2 Create the Relationship with Channel Instance
Creating the custom table alone is not sufficient.
We must establish the relationship between our extended configuration entity and the base Dataverse table:
msdyn_channelinstance
The relationship uses the base table's msdyn_extendedentityid attribute, which is a polymorphic lookup.
Microsoft documents a specific relationship configuration for this implementation.
Important: Microsoft explicitly warns that the relationship generated by the XRMToolBox Polymorphic Lookup Creator does not work for this scenario.
Instead, follow the relationship XML approach documented by Microsoft.
The required steps are:
Create the relationship XML using the correct custom table logical name.
Add the XML file under the unpacked solution's
Other\Relationshipsfolder.Create a file with the same name as the custom table.
Add the relationship name to
Other\Relationships.xml.Repackage the solution.
This relationship is essential because Customer Insights - Journeys needs to associate the custom configuration record with the corresponding Channel Instance.
3.3 Create the Configuration Form
Create a main form for the extended configuration table.
Add the configuration fields that an administrator needs to enter when creating a channel instance.
For example:
API URL
API Key
Sender ID
Account ID
This form will be displayed as part of the custom channel configuration experience.
3.4 Assign Required Security Privileges
There is another important configuration requirement.
Customer Insights - Journeys accesses the extended configuration entity during message submission.
Therefore, grant Read privileges for your extended configuration entity to the security role:
Cxp Channel Definitions Services User
Without the necessary privileges, the channel may fail when the platform attempts to access its configuration.
4. Create Channel Message Parts
Now that the channel instance configuration is ready, let's define the fields that users will see when creating custom channel messages.
This is where Channel Message Parts come into the picture.
A Channel Message Part defines the structure of a message.
For example, if we want to send a WhatsApp message, our message might contain:
Message Text
Template Name
Language
Image
Customer Reference
Each of these can be represented through a message part, depending on the supported message contract.
The message parts are stored in the standard Dataverse table:
msdyn_channelmessagepart
4.1 Supported Message Part Types
Microsoft provides several message part types.
| Type | Value | Description |
|---|---|---|
| Plaintext | 192350000 | Simple text |
| Media | 192350003 | File ID from msdyncrm_file |
| Image | 192350004 | Image ID from msdyncrm_file |
| Record | 192350005 | Record ID from an external entity |
| Number | 192350006 | Number represented as a string |
| Boolean | 192350007 | True or false |
| Options | 192350008 | Selection from predefined options |
| Date | 192350009 | Date without time |
| Datetime | 192350010 | Date and time |
For example, let's create the following message parts:
| Name | Display Name | Type | Required |
|---|---|---|---|
| text | Message Text | Plaintext | Yes |
| template | Template Name | Plaintext | Yes |
| language | Language | Plaintext | No |
| customer | Customer Reference | Record | No |
The customer field is an example of a record-type message part.
For record-type parts, we can configure the associated entity and view using:
msdyn_entitynamemsdyn_entityviewid
4.2 How Are Message Parts Created?
Message parts are defined as solution-aware components in the solution's customizations.xml file.
They are placed under:
ImportExportXml > msdyn_channelmessageparts
Each message part needs:
A unique GUID.
A channel definition ID.
A name.
A display name.
A description.
A message part type.
A required/optional setting.
An optional maximum length and order.
The msdyn_name attribute is especially important.
It acts as the key used to map message part information to the outbound message content.
For example, if the message part name is text, the outbound payload will contain a corresponding text key in its Message dictionary.
Important: Every custom channel must have at least one message part.
5. Create the Channel Definition
Now we have the extended configuration entity and message parts.
The next step is to connect everything through the Channel Definition.
The standard Dataverse table is:
msdyn_channeldefinition
The Channel Definition describes our custom communication channel and connects its configuration entity, outbound API, and message parts.
Some important attributes include:
| Attribute | Purpose |
|---|---|
| msdyn_displayname | Channel display name |
| msdyn_description | Channel description |
| msdyn_channeltype | Custom or SMS |
| msdyn_outboundendpointurltemplate | Outbound Custom API name |
| msdyn_hasinbound | Indicates inbound support |
| msdyn_hasdeliveryreceipt | Indicates delivery receipt support |
| msdyn_supportsaccount | Indicates account-level configuration support |
| msdyn_channeldefinitionexternalentity | Extended configuration entity logical name |
| msdyn_channeldefinitionexternalformid | Configuration form ID |
| msdyn_messageformid | Optional custom message editor form ID |
5.1 Configure the Channel Definition
Let's assume we are creating a custom notification channel.
Our Channel Definition should contain:
Display name: Custom Notification
Channel type: Custom
Outbound API: Our custom outbound API
Extended entity: contoso_customchannelinstance
External form ID: The form ID of our configuration form
Inbound support: No, if not implemented
Delivery receipt: Based on provider capabilities
The Channel Definition is also connected to the message parts using the Channel Definition ID.
5.2 Important Considerations
The Channel Definition is not something we create separately for every message.
It represents the channel itself.
For example, we can create one WhatsApp Channel Definition and use it to create multiple WhatsApp message templates.
This makes the implementation reusable and easier to maintain.
6. Create the Outbound Custom API
The outbound Custom API is one of the most important parts of the implementation.
It is the entry point that Customer Insights - Journeys calls when it needs to submit a message.
The Custom API connects the Customer Insights - Journeys runtime with our custom plugin logic.
Microsoft requires the outbound Custom API to implement a specific request and response contract.
6.1 Create the Custom API
Create an outbound Custom API in Dataverse.
Configure the plugin type and the request/response parameters according to Microsoft's documented contract.
The outbound Custom API should accept one input parameter:
payload
And return one output parameter:
response
The API name must match the name configured in the Channel Definition's msdyn_outboundendpointurltemplate attribute.
6.2 Understand the Incoming Payload
The incoming payload is serialized JSON.
It contains the following information:
| Property | Description |
|---|---|
| ChannelDefinitionId | Channel Definition GUID |
| RequestId | Unique request ID |
| IdempotencyId | Idempotency identifier |
| From | Sender or Channel Instance |
| To | Recipient |
| Message | Dictionary containing message parts |
| MarketingAppContext | Journey execution context |
The most important property for our implementation is Message.
For example, the message dictionary could contain:
{
"text": "Hello, your order has been shipped!",
"template": "order_shipped",
"language": "en"
}This means our plugin can access the values using the message part names defined earlier.
For example:
texttemplatelanguage
The names must match the message part names configured in the Channel Message Part entity.
6.3 How Do Custom Message Fields Reach the Plugin?
This is an important concept.
When we create a custom channel message, Customer Insights - Journeys uses the message parts defined in the Channel Definition to structure the message.
The values entered in the message editor are included in the outbound Custom API payload.
The plugin receives these values inside the Message dictionary.
For example, if we define a message part named text, the plugin can retrieve it from the dictionary using that key.
Similarly, if we define a record-type message part named customer, the corresponding record identifier is passed as a string value.
This allows us to pass different types of message configuration data to the plugin without creating a separate Custom API parameter for every message field.
Important: The outbound API contract represents message parts as a Dictionary<string, string>. Therefore, even record identifiers and numeric values are handled as string values in the message payload.
7. Develop the Plugin to Process the Message
Once the Custom API is configured, we can implement the plugin logic.
The plugin receives the payload, reads the message information, retrieves the Channel Instance configuration, and calls the external communication provider.
The basic processing flow is:
Receive the Custom API request.
Read the payload.
Deserialize the JSON.
Retrieve the Channel Definition ID.
Read the sender and recipient.
Read the Message dictionary.
Retrieve the corresponding Channel Instance configuration.
Call the external provider API.
Process the provider response.
Return the response in the required format.
7.1 Example Message Processing
Suppose we receive this message:
{
"From": "WhatsAppSender01",
"To": "+911234567890",
"Message": {
"text": "Your appointment is confirmed.",
"template": "appointment_confirmation",
"language": "en"
}
}Our plugin can read the message values using their respective keys.
Conceptually:
string messageText = message["text"];
string templateName = message["template"];
string language = message["language"];The plugin can then use these values to prepare the request for the external provider.
The actual implementation should also include validation, exception handling, authentication, logging, and appropriate response handling.
7.2 Retrieve Channel Instance Configuration
The provider configuration should be retrieved from the extended Channel Instance entity.
For example, the plugin may need:
API endpoint
Authentication key
Sender ID
These values allow the plugin to communicate with the correct provider account.
Remember that the Channel Instance represents the sender configuration, while the Channel Definition represents the channel itself.
7.3 Return the Required Response
After processing the provider request, the plugin must return a response using the documented Custom API contract.
The response contains:
ChannelDefinitionId
MessageId (optional)
RequestId
Status
Details (optional)
The supported submission statuses are:
| Status | Meaning |
|---|---|
| Sent | Provider accepted the submission |
| NotSent | Submission was rejected and cannot be retried |
One important consideration is that the custom channel execution has a maximum timeout of 20 seconds.
Therefore, keep the plugin execution efficient and avoid long-running operations.
8. Create the Custom Channel Instance
Once the solution is imported and configured, we can create the actual Channel Instance.
Open Dynamics 365 Customer Insights - Journeys.
Navigate to:
Settings → Custom channels
Then follow these steps:
Select + New channel.
Select the custom channel app that we installed.
Enter the required connection details.
Configure the sender information.
Review the configuration.
Complete the setup.
The extended configuration form created earlier will be used to capture the provider-specific settings.
For example, we can configure:
| Field | Example |
|---|---|
| API URL | Provider endpoint |
| API Key | Provider authentication key |
| Sender ID | WhatsApp sender |
| Account ID | Provider account |
After completing the configuration, we have a Channel Instance ready for use.
Important: A Channel Instance represents one configured sender. If the same channel needs multiple senders or provider connections, we can configure separate instances.
9. Create Custom Channel Messages
Now comes the most interesting part.
After creating the custom channel and its instance, we can create messages that will be used in customer journeys.
Navigate to:
Customer Insights - Journeys → Channels → More channels
Then:
Select + New message.
Select the custom channel.
Use the message editor to enter the message content.
Configure the available fields.
Save the message as a draft or select Ready to Send.
The message editor uses the message parts we defined earlier.
For example, our custom channel message may have the following fields:
| Field | Example value |
|---|---|
| Message Text | Your appointment is confirmed |
| Template Name | appointment_confirmation |
| Language | English |
| Customer Reference | Selected customer record |
When this message is submitted, the values are made available to our outbound Custom API through the message dictionary.
9.1 Create Multiple Messages for the Same Channel
One of the major benefits of custom channels is reusability.
We don't need to create a separate Channel Definition or Custom API for every message template.
For example, the same custom channel can support:
Order Confirmation
Order Shipped
Payment Reminder
Appointment Confirmation
Promotional Notification
Each message can contain different content while using the same channel infrastructure.
This keeps the solution modular and reduces duplicate development.
10. Use the Custom Channel in a Customer Journey
After creating and saving the custom channel message, we can use it in a customer journey.
Open Customer Insights - Journeys and create a new journey or edit an existing one.
On the journey canvas:
Select the + button.
Choose Send other types of messages.
Select the custom channel.
Select the relevant message.
Configure the remaining journey settings.
Validate and publish the journey.
When the journey reaches this action, Customer Insights - Journeys invokes the outbound Custom API.
Our plugin receives the message payload and processes the communication request.
This completes the end-to-end integration.
11. Important Implementation Considerations
Before deploying the custom channel to production, consider the following points.
11.1 Publisher Prefix Consistency
Use a consistent publisher prefix across all custom tables, columns, relationships, and components.
If the prefix or table names are changed in the sample package, make sure all references are updated.
11.2 Message Part Names Must Match
The message part name is used as the key in the outbound message dictionary.
For example, if the message part name is text, the plugin must retrieve text, not messageText.
11.3 Record-Type Message Parts
If a message part uses the Record type, configure the entity and view metadata correctly.
The record identifier is passed through the message contract as a string.
Don't assume that the outbound message dictionary will contain a fully populated Dataverse record.
11.4 Custom Message Editor Is Optional
A custom message editor is not mandatory.
Customer Insights - Journeys provides a generic editor for custom channels.
If the generic editor satisfies your requirements, there is no need to develop a separate editor.
A custom editor is useful when you need a specialized user experience or additional controls.
11.5 Secure Provider Credentials
Avoid exposing provider credentials in message templates.
Store provider configuration in the appropriate Channel Instance configuration and apply suitable Dataverse security.
11.6 Plugin Performance
The outbound Custom API has a maximum execution timeout of 20 seconds.
Make sure the plugin completes within this limit.
Implement appropriate error handling and ensure that retry scenarios do not unintentionally send duplicate messages.
11.7 Delivery Receipts
If the external provider supports delivery notifications, consider implementing a delivery report Custom API.
The provider can send delivery updates through your integration, and the implementation can call the platform's msdyn_D365ChannelsNotification API.
This allows delivery information to be reflected in Customer Insights - Journeys analytics.
No comments:
Post a Comment
Write us your comment.