Introduction
Microsoft Dynamics 365 Sales is an enterprise CRM solution that manages customer relationships through contacts, leads, opportunities, and activities. This integration enables inbound data flow from MoEngage to Microsoft Dynamics 365 Sales via Microsoft Power Automate.
Key Features/Functionality
With this integration, you can:
- Receive real-time campaign engagement events from MoEngage (email opens, clicks, form submissions, webinar attendance, etc.)
- Automatically update Lead, Contact, or Opportunity records in D365 Sales with the latest engagement data
- Maintain synchronized engagement history between MoEngage and D365 Sales
- Trigger D365 Sales workflows or business process flows based on MoEngage campaign interactions
- Track sales activity events and marketing attribution for closed-loop reporting
Use Cases
- Lead Scoring Based on Email Engagement: When a lead opens a marketing email in MoEngage, automatically increment their lead score in D365 Sales and update the "Last Engagement Date" field to help sales reps prioritize follow-ups.
- Opportunity Stage Progression: When a prospect attends a webinar or downloads a pricing guide tracked in MoEngage, automatically move their D365 Sales Opportunity to the "Qualified" or "Proposal" stage and assign a follow-up task to the account owner.
- Campaign Response Tracking: Capture all form submissions from MoEngage landing pages and create Marketing Response or Activity records in D365 Sales linked to the relevant Lead or Contact for comprehensive engagement history.
- Multi-Channel Engagement History: Build a complete timeline of customer interactions by syncing email, SMS, push notification, and in-app message events from MoEngage to D365 Sales activity records, giving sales teams full visibility into marketing touchpoints.
- Sales & Marketing Alignment: When a Contact engages with multiple campaign touches, automatically create a follow-up Call or Task for the assigned sales representative, ensuring timely outreach based on demonstrated interest.
Step-by-Step Integration Guide
| library_add_check |
Prerequisites
|
| info |
Accepted Entity Identifiers Microsoft Dataverse accepts the following primary identifiers for updating records:
For this integration, we recommend using the Primary Key (GUID) as it is guaranteed to be unique and immutable across all D365 environments. |
Step 1: Create the HTTP Request Trigger in Power Automate
- Open Power Automate
- Click Create > Automated Cloud Flow
- Name your flow:
MoEngage - Receive Events to D365 - Select trigger: When a HTTP request is received
- Click Create
Configure the HTTP Request Trigger
In the trigger configuration, define the Request Body JSON Schema. This tells Power Automate what structure to expect from MoEngage Streams.
Copy and paste this schema into the Request Body JSON Schema field:
{
"type": "object",
"properties": {
"app_name": {"type": "string"},
"source": {"type": "string"},
"moe_request_id": {"type": "string"},
"events": {
"type": "array",
"items": {
"type": "object",
"properties": {
"event_name": {"type": "string"},
"event_code": {"type": "string"},
"event_uuid": {"type": "string"},
"event_time": {"type": "integer"},
"event_type": {"type": "string"},
"event_source": {"type": "string"},
"email_id": {"type": "string"},
"uid": {"type": "string"},
"event_attributes": {
"type": "object",
"properties": {
"campaign_id" : {"type": "string"},
"campaign_name" : {"type": "string"},
"campaign_type" : {"type": "string"},
"campaign_channel": {"type": "string"}
}
},
"user_attributes": {
"type": "object",
"properties": {
"moengage_user_id" : {"type": "string"},
"d365_lead_id" : {"type": "string"},
"d365_contact_id" : {"type": "string"},
"d365_opportunity_id" : {"type": "string"},
"d365_custom_entity_id": {"type": "string"},
"external_identifier" : {"type": "string"}
}
},
"device_attributes": {
"type": "object",
"properties": { "moengage_device_id": {"type": "string"} }
}
},
"required": ["event_name", "event_time", "user_attributes"]
}
}
},
"required": ["app_name", "source", "events"]
}| check_circle |
Save and Get the URL After adding the schema, click Save. Power Automate will generate a unique HTTP POST URL. Copy this URL - you'll need it to configure MoEngage Streams later. |
Step 2: Apply to Each Event
Since MoEngage can send multiple events in a single request, add an Apply to each loop to process them individually.
- Click New Step
- Search for Control and select Apply to each (Control)
- In the Select an output from previous steps field, choose events from the JSON dynamic content
| info |
Note All subsequent actions will be added inside this "Apply to each" loop to process each event from the MoEngage payload. |
Step 3: Create Custom Table and Add Event Records
For this integration, we have created a custom table called "MoEngage Event" in Power Apps to store all engagement event data from MoEngage campaigns against Leads.
This approach allows you to maintain a complete historical record of all customer interactions, and you can configure this for your desired entities.
| info |
Creating Your Custom Table in Power Apps Before configuring the Power Automate action, create a custom table in Power Apps to store MoEngage event data. Create a table with the necessary columns (Event Name, Event Date, Campaign Name, Campaign Channel, Event Code, Event UUID) and add a lookup relationship to your desired entity (Lead, Contact, or Opportunity). Learn how to create custom tables and add relationships: |
Add Dataverse Action to Create Event Records
- Add a Microsoft Dataverse action (inside the Apply to each loop)
- Select Add a new row
- Table name: Select your custom table (e.g., MoEngage Events)
- Configure the field mappings as described below
Field Mapping Instructions
For each field in your MoEngage Events table, map data from the incoming MoEngage payload. Here's an example of how to map the Event Name field:
| Field Name | How to Map | Expression/Dynamic Content |
|---|---|---|
| Event Name | Click the field → Click / → Select from dynamic content list | Select event_name from the dynamic content picker |
| info |
Using Dynamic Content vs Expressions For most fields (Event Name, Campaign Name, Event Code, Event UUID, etc.):
For Lookup fields :
|
Step 4: Convert Unix Timestamp to DateTime
MoEngage sends event timestamps as Unix epoch time (e.g., 1731421200). You need to convert this to a D365-compatible datetime format when mapping to date/time fields.
- In the Inputs field, use this expression:
formatDateTime(addSeconds('1970-01-01', items('Apply_to_each')?['event_time']), 'yyyy-MM-dd HH:mm:ss')Step 5: Test the Integration
Test with Manual Trigger
- In Power Automate, click Test → Manually
- Click Test to start the flow in listening mode
- Use a tool like Postman or cURL to send a test payload to your webhook URL
Sample Test Payload
{
"app_name": "App Name",
"source": "MOENGAGE",
"moe_request_id": "test_request_12345",
"events": [
{
"event_name": "Email Opened",
"event_code": "37930333",
"event_uuid": "moe_unique_event_id_001",
"event_time": 1731421200,
"event_type": "CAMPAIGN_EVENT",
"event_source": "MOENGAGE",
"email_id": "test@example.com",
"uid": "moe_customer_123",
"event_attributes": {
"campaign_id": "q4_nurture_series_001",
"campaign_name": "Q4 Nurture Series",
"campaign_type": "General",
"campaign_channel": "Email"
},
"user_attributes": {
"moengage_user_id": "moe_internal_user_id",
"d365_lead_id": "<>"
},
"device_attributes": {
"moengage_device_id": "moe_internal_device_id"
}
}
]
}
Verification Steps
- Monitor the flow run in Power Automate
- Check for successful execution (green checkmarks on all actions)
- Open your custom MoEngage Events table in Power Apps or D365
- Verify that a new event record was created with all the mapped data
- Verify that the Lead lookup field correctly points to the Lead record
Step 7: Enable MoEngage Streams
Once you have successfully tested the integration, enable MoEngage Streams to start sending real-time event data to your Power Automate webhook.
| info |
Configure MoEngage Streams
|