Skip to main content

Notifications

Announcements

No record found.

LinkedIn Lead Sync Integration with Dynamics 365 Customer Insights – Journeys

Microsoft previously announced the removal of LinkedIn Lead Gen capabilities from outbound marketing in Customer Insights – Journeys.

Once LinkedIn Lead Gen capabilities are removed, Customer Insights – Journeys will stop receiving data from LinkedIn forms. You won't be able to sign up for new LinkedIn accounts or reauthenticate existing accounts. You'll still be able to access existing data (it won't be removed) and campaigns in LinkedIn will continue unaffected.

This guide provides a solution for customers to develop their own custom integration for LinkedIn lead management within CIJ (both Outbound and Real-time), enabling continued lead capture and processing from LinkedIn. The guide outlines the steps required to create a potential solution. This potential solution will require:
  1. Create a LinkedIn Developer App
  2. Generate Authentication Token
  3. Create Azure function for Webhook
  4. Create Power Automate Flow to create lead in CIJ
Prerequisites
Before beginning, you'll need access to:
  • A LinkedIn account to access LinkedIn’s developer tool
  • Azure Functions for webhook creation
  • Dynamics 365 Customer Insights - Journeys instance

Step 1: Creating a LinkedIn Developer App
To set up the integration, you need to create a LinkedIn Developer App. This app will provide the necessary credentials to access LinkedIn’s APIs and will enable data synchronization from LinkedIn Lead Gen forms to your system.

  1. Create the LinkedIn Developer App:
    • Go to LinkedIn’s Create and Manage LinkedIn Apps page to create the app. Register the app with a unique name, configure the redirect URLs, and assign the required permissions. More details can be found here
  2. Apply for Access to LinkedIn’s Lead Sync API:
    • After creating your app, you’ll need to request access to LinkedIn’s Lead Sync APIto enable the app to retrieve lead form submissions directly from LinkedIn. This step is essential for connecting LinkedIn leads with your system. To learn more about the approval process and requirements for Lead Sync API access, please review LinkedIn’s guide here.
    • Upon completing these steps and receiving approval from LinkedIn, grant access to “r_marketing_leadgen_automation” in your app under the Auth tab as shown below.

    • You can then use the Client ID and Client Secret available under the Auth tab to generate an authentication token, which is used in API requests to retrieve lead data from LinkedIn.

Step 2: Generating an Authentication Token
Use the Client ID and Client Secret to generate an authentication token for API requests. This token is essential for securing API access and will be used in following steps.

  • Follow the steps mentioned here to generate Authentication Token.
  • You can generate the token via the Postman or a similar tool to send a HTTP POST request. Import the Leady Sync collection to your Postman and got to Authorization tab to generate the token. It should look as per below.
  • Click on Get New Access Token, this will open the popup window and show you Access Token. Take a note of Access Token

Step 3: Creating an Azure Function for the Webhook
To receive real-time lead notifications from LinkedIn, you’ll need to create an Azure Function that serves as a webhook. This function should be set up to accept both GET and POST requests, allowing LinkedIn to validate the webhook URL and send lead data when a form is submitted. You can find LinkedIn’s official guidance on registering a webhook in their documentation here.
Here’s a step-by-step guide to configuring the Azure Function:  
  1. Setup for LinkedIn’s Validation Request (GET)
    • When registering the webhook with LinkedIn, LinkedIn sends an initial validation request, requiring the function to calculate and return a challenge response. This serves as a GET request, and you’ll need to ensure the Azure Function is configured to handle this.
  2. Handling LinkedIn Lead Notifications (POST)
    • Once the webhook is validated, LinkedIn will use POST requests to send notifications each time someone submits a lead form. Each notification includes a LeadResponseId, which allows you to fetch the full lead response data from LinkedIn. Refer to LinkedIn’s API documentation on retrieving full lead response data here for additional information.
  3. Integrating with Power Automate to Create Leads in CIJ
    • In the example below, the Azure Function makes a call to a Power Automate flow, which retrieves the complete lead data using the LeadResponseId and creates a corresponding lead record in CIJ.
  4. Optional: Fetching Lead Data Directly in Azure Function
    • As an alternative to Power Automate, you could expand the Azure Function itself to call LinkedIn’s API directly to retrieve the full lead response data. In the code sample provided later in the document, uncomment the code segment starting with context.log('-----------------Get Form Response within Azure Function.-----------------'); to use this approach. This can be further extended to directly interact with Dataverse’s API to create lead records in Customer Insights Journeys. For more details, LinkedIn’s documentation on using the Dataverse API to create leads is available here.
You can download sample Azure Function code from GitHub.

Step 4: Creating Power Automate Flow to create Lead in CIJ
Below are the steps to configure Power Automate flow into your CIJ environment to create the lead. You can also download a sample Power Automate flow from here. You can also modify this flow based on your business need. You can add additional steps to create/update lead and/or contact.

  1. Trigger: "When an HTTP request is received"
    • Start by creating a new Power Automate flow and selecting the trigger "When an HTTP request is received". This allows the flow to be triggered by incoming HTTP requests, which will be sent from the Azure Function you've set up above. HTTP trigger will have a Request Body JSON Schema to get the LeadResponseId from Azure Function. It will look as per below
    • Note: Copy the generated URL and paste it into your Azure Function to allow it to call the Power Automate flow.
  2. Compose Action
    • Add a Compose action immediately after the trigger to store or manipulate the incoming data. You can use this action to log the received request for debugging or store the initial data before processing.
  3. HTTP Action: Get Form Response
    • Add an HTTP action to make an API call to LinkedIn to fetch detailed lead response data. Configure this action to use LinkedIn’s API endpoint, with the appropriate headers and authorization to retrieve lead information based on the LeadResponseId from the initial webhook request. Fow configuration looks below. In the header put Authorization token you have generated from step 3 above.


  1. Parse JSON Action
    • Add the Parse JSON action to interpret the LinkedIn lead data returned by the HTTP action. This step will allow you to define a schema that maps out key fields, such as First Name, Last Name, and Email Address, etc. enabling you to extract and use these values in subsequent steps.
    • To create the schema, start by obtaining a sample JSON response from LinkedIn. You can retrieve this by referring to the LinkedIn API documentation or using Postman to test the API request for full lead data.
    • In your Power Automate flow, locate the Parse JSON action and add it below the HTTP request step.
    • Select Use sample payload to generate schema within the Parse JSON action.
    • Paste the JSON response you copied from LinkedIn into the dialog and click Done. Power Automate will automatically generate a schema based on this sample data, making it easy to access each field for use in your flow.

  2. Variable Setup for Question IDs and Lead Data Fields
    • For each lead field you want to capture (e.g., First Name, Last Name, Email Address), create two sets of variables:
      • Question ID Variables: to store the question IDs for each lead field.
      • Answer Variables: to store the responses to each question.
    • This setup allows you to dynamically match each question ID with the associated answer, enabling seamless integration of the lead data into CIJ.
  3. Apply to Each Loop for Capturing Question IDs
    • Use the first Apply to each loop to iterate through the questions array from the parsed JSON.
    • Inside this loop, create conditionals to identify each question based on its name (e.g., "First name," "Last name," "Email address"):
      • For each question of interest, set the corresponding Question ID Variable to the questionId value.
    • This step ensures that each field’s question ID is stored in a variable, allowing accurate matching with answers.
  4. Apply to Each Loop for Matching Answers
    • Use a second Apply to each loop to iterate through the answers array from the parsed JSON.
    • In this loop, add conditionals to check if the questionId in each answer matches any of the previously defined Question ID Variables:
      • If a match is found for a specific question ID, store the answer in the corresponding Answer Variable (e.g., set the First Name answer to the textQuestionAnswer.answer field if the question ID matches FirstNameQuestionId).
  5. Add a New Row Action
    • At the end of the flow, use the Add a New Row action to add the lead data to your Dynamics 365 Customer Insights - Journeys (CIJ) instance.
    • Map each field from your variables (or from the parsed JSON data) to the corresponding fields in the CIJ Leads table, such as:
      • First Name
      • Last Name
      • Email Address
      • Any other fields that are relevant to your lead records.
  6. Testing and Publishing

Incorporating this integration with Dynamics 365 CIJ provides seamless lead management and data synchronization, ensuring your marketing and sales teams can follow up on LinkedIn leads instantly and efficiently.

Important Note:
This guide presents one approach for integrating LinkedIn Lead Gen with Dynamics 365 Customer Insights - Journeys. It’s intended as a sample solution to help customers be familiar with the technical components need to integrate LinkedIn data with Customer Insights Journeys. The code is provided as-is to provide a starting point customers who are encouraged to adapt and refine the code and Power Automate Flow to suit their requirements, data volumes and operational environments.


Comments