User authentication using events API in outbound marketing

Note

Dynamics 365 Marketing and Dynamics 365 Customer Insights are now Customer Insights - Journeys and Customer Insights - Data. For more information, see Dynamics 365 Customer Insights FAQs

New Customer Insights - Journeys customers receive real-time journeys features only. For more information, see Default real-time journeys installation.

Note

Azure Active Directory is now Microsoft Entra ID. Learn more

Important

This article only applies to outbound marketing.

The events API supports user authentication with Microsoft Entra ID. To link the events API to your Microsoft Entra ID, you need to add your Microsoft Entra ID Client ID and Microsoft Entra ID Metadata Endpoint to your web application setting. More information: Creating a Microsoft Entra ID tenant and adding a web application to the tenant

To authenticate the user against the API, you need to add the Authorization header containing the token_id bearer to each API request.

This token_id can be retrieved by authenticating the user against Microsoft Entra ID.

Request

curl -X GET \ 
  'https:// b7c1ad1ab7fa4a7482b16315d94a26af.svc-tip.dynamics.com/EvtMgmt/api/v2.0/events/published?emApplicationtoken=VZsLZhx251OM9uJa..' \ 
  -H 'Authorization: Bearer eyJ0eXAiOiJK…\ 
  -H 'Origin: https://localhost:4200' 

Contact matching strategy

The events API will automatically try to link contacts from Microsoft Entra ID to the contacts in Dynamics 365 Customer Insights - Journeys.

To do so, it uses a contact matching strategy that can be configured in the event administration settings. By default, first name, last name, and email are used as the contact matching strategy. More information: Event administration

In case no matching contact is found, a new contact is created automatically.

Note

Linked contact entities contain an attribute called msevtmgt_aadobjectid that stores the object ID of the user in Microsoft Entra ID.

Retrieving information of authenticated user

The events API provides an endpoint that returns the information and contact ID of the authenticated user.

Request

curl -X GET \
  'https:// b7c1ad1ab7fa4a7482b16315d94a26af.svc-tip.dynamics.com/EvtMgmt/api/v2.0/users/authenticated?emApplicationtoken=VZsLZhx251OM9uJa..' \
  -H 'Authorization: Bearer eyJ0eXAiOiJK…\ 
  -H 'Origin: https://localhost:4200'

Response

{
   "id":"05ef77de-b882-e911-a970-000d3a4e9aa0",
   "firstName":"John",
   "lastName":"Doe",
   "email":"joe.doe@contoso.com",
   "isAnonymous":false
}