Tap into the interaction data generated by Dynamics 365 Marketing
One of the many strong points of Dynamics 365 Marketing is the separation of the Dynamics 365 environment and the Marketing services (see “Elements in a Marketing environment“)
This separation has a lot of advantages – including performance. However, the data in the Marketing services aren’t directly accessible to users
So what if you will want to tap into those interaction data? What if you are looking for a way to fire up an action card (or an email) to sellers if one of the contacts they own does something interesting, e.g. clicks a “learn more” link in a marketing email, or something similar?
Sure you can handle this in a customer journey, but what if you need logic for all emails in all customer journeys? Then you’ll need to tap into the interaction data in the Marketing Service.
Scenario
Julian receives an email via a Customer Journey in Dynamics 365 Marketing. On top of opening the email he clicks one of the links in the email.
The click could be an indication of potential deeper level of interest. This interaction might be interesting for Julians account manager, Karen. Let’s make sure Karen is aware of the fact that Julian just clicked the link
Prerequisites
The first thing you need is to have your Dynamics 365 Marketing connected to Azure Blob Storage
- Create a container in your storage account and right-click the container in Microsoft Azure Storage Explorer (1)
- Click Get Shared Access Signature (2)
- Copy the URL (3)
- Create a marketing analytics configuration in Dynamics 365 Marketing > Settings > Advanced Settings > Marketing analytics configuration (4)
- Paste the URL into the Export to blob storage URL text box (5)
- Save and close – Dynamics 365 Marketing will start the marketing analytics connector and and export the interaction data to containers in your Azure Blob Storage
You can open the content of a blob from Microsoft Azure Storage Explorer in e.g. Notepad or Excel.
In this example the blob content is “emailclicked” (link clicked in email). Somewhere in the seemingly endless sequence of characters in the blob content, the URL of the link the contact clicked is found
If you open the blob in Excel you can use the ‘Text to columns’ feature to format the content into rows and columns. This will make it easy to locate the value of the OriginalLink.
We wont be using Excel, but an automated Power Automate flow to extract the link and put it into an action card.
When working with the blob in Power Automate we will imitate the Excel transformation using the built-in Split function
The Split function
The Split function breaks a text string into a table of substrings. Below you’ll see a function that will return the value of OriginalLink in the blob content
If you start from the bottom of the picture you see how the final function is constructed.
This Split function is used twice in the Flow, to extract ContactId and Original URL.
The Flow
The high-level Flow looks like this
Lets go over selected elements.
The trigger is the When a blob is added or modified trigger from the Azure Blob Storage connector. This operation triggers a flow when one or more blobs are added or modified in a container.
You can use this trigger if Dynamics 365 Marketing is connected to a Azure Blob storage.
In this example, when a link in an Dynamics 365 Marketing email is clicked, a blob is added to the container “Emailclicked” and the trigger is fired
The Get blob content action retrieves blob contents using id
As mentioned above, the output of this action (binary) needs a bit of post-processing to fit our purpose (see later)
Using the built-in action Initialize Variable you can convert the blob content to a string variable
Then use the same built-in action with the Split function (see above) to split the resulting text string into a table of substrings and get values from the second row of the table
Finally use the Create card for Assistant action to display an action card to the owner of the contact – in the Assistant widget on the dashboard
Conclusion
If you call upon Azure Blob Storage and Power Automate you can tap into the otherwise inaccessible interaction data in the Marketing Service, and start building great solutions for your Dynamics 365 users.
Thank you Tino for the invaluable help with the blob content
This was originally posted here.
*This post is locked for comments