Programmatically accessing data from Dynamics Marketing Insights

insightsRecently I got a question from one of the customers on how to extract data from Dynamics Marketing Insights as there is no export functionality so far. They just wanted to extract data as CSV or Excel and send this data to some other people for analysis. In this article, we will go through some undocumented Dynamics Marketing APIs, which can help you with this task.

Disclaimer: Some of the APIs provided in this article are not officially supported so that they might be changed without prior notice. Please use them on your own risk.

First of all, there are some public APIs which you can easily access. Currently, you can retrieve interactions from the contact point of view. Check the following article for more information: Retrieve interactions for a contact using code

In this article, I would like to focus on Insights from e-mail point of view. As you know, we have several types of widgets. The first type is the widget with just some values.


The second type is a widget of type grid. Here is how it looks like:


Both widgets are accessible through different APIs. Let’s focus on the lists as usually, these reports provide the most crucial information. To get information from the widget of the type grid, you should call msdyncrm_ListWidgetData organizational request. Of course, there are a bunch of parameters available which can help you to configure the request. Let’s check one request to get information about delivered e-mails. Example of that grid you can see in the picture below:


Now let’s check the code which can extract data from this grid.

OrganizationRequest request = new OrganizationRequest("msdyncrm_ListWidgetData"); request.Parameters.Add("WidgetRequest", 
    "{\"WidgetId\":" +
     "\"MessageEmailDeliveredByContactList\"," +
     "\"Top\":25," +
     "\"SkipToken\":\"\"," +
     "\"LanguageId\":\"1033\"," +
     "\"OffsetFromUtcInMinutes\":120," +
     "\"Filter\":" +
     	" {\"DateFrom\":\"2019-07-25T09:57:39.486Z\"," +
     	" \"DateTo\":\"2019-08-25T09:57:39.486Z\"," +
         " \"Properties\":[{\"Name\":\"MessageId\"," +
         " \"Value\":\"47bd8737-f67a-e911-a972-000d3aba0352\"}]}}");

 var response = _service.Execute(request);

As you see, we have a parameter called WidgetId. This parameter is used to define which widget should be applied. We have plenty of different widgets which you might use. Here are some of the available:

  • MessageEmailClickedByContactList
  • MessageEmailDeliveredByContactList
  • MessageEmailForwardedByContactList
  • MessageEmailOpenedByContactList
  • MessageEmailSendingFailedByContactList
  • MessageEmailSentByContactList
  • MessageEmailBlockedByContactList
  • MessageEmailSoftBouncedByContactList
  • MessageEmailHardBouncedByContactList
  • MessageEmailFeedbackLoopList
  • MessageEmailSubscriptionSubmitList
  • LinkAnalysisList

Here is how response for LinkAnalysisList might look like:


In case of questions please don’t hesitate to contact me.

Leave a Reply

Your email address will not be published. Required fields are marked *