Overview
This is an example of how the lead/behaviour data from users (User Data) captured on a Vepple-powered Virtual Experience can be synced with Microsoft Dynamic 365 using Power Automate.
Please note, this is based on the assumption that someone understands how Power Automate Works. Not all the steps are necessary. Once you poll the API, the steps that follow can be adjusted to your needs.
Access Vepple API Documentation
To access User Data captured within Vepple, you will need to authenticate with our API. The following API documentation provides instructions on how to authenticate with the service and an overview of the various endpoints and request formats available:
Structure within Power Automate
Microsoft Power Automate is the most popular way of establishing a connection between the Vepple API and Microsoft Dynamics 365, allowing you to configure how User Data is pulled and mapped. This is achieved through the creation of a Solution in Power Automate. A "Solution" serves as a container to organise and manage related resources. Into this Solution are added Flows. A "Flow" is a specific type of process created in Power Automate to automate tasks across one or more apps or services. In this particular case, a flow might be added when, for example, a lead is added to the Vepple database.
Flow Setup Example
Creating the flow
The best way to integrate with Vepple is to poll our API periodically. To do this, you need to create a scheduled flow.
Setting a schedule
- Set a schedule as to when you’d like to scan for changes i.e. interval and frequency e.g. you can set it to run once every night.
- Set the ‘base date’ which is a reference point used as a starting or anchor date for a particular operation. In this case, it is the date by the day, implying that when it runs, it picks up the previous day's records.
- The date from- Yesterday’s date
- The date to - today’s date
Initialisation
This involves declaring variables to store data such as access tokens, API endpoints, or any other information required to communicate with the Vepple API. For example, you might initialise a variable called apiaccessToken to store the access token needed to authenticate requests to the Vepple API.
- Others may include: accessToken VarData, VarDataString, Append to VarData head, VarErrors, VarErrorString, apiEmail, apiPassword, apiURL, apiRefreshToken e.t.c
- apiEmail, apiPassword, apiURL, apiRefreshToken : These are variables storing authentication and endpoint information for the Vepple API. apiEmail and apiPassword hold credentials for authentication, apiURL stores the base URL of the Vepple API, and apiRefreshToken is used for refreshing access tokens.
API Connection
- Next thing, get the data from the API hence the ‘Get data from API’ step.
- Add an 'HTTP' action to connect to the Vepple API.
- Specify the API endpoint for retrieving contacts and configure the action with the necessary authentication credentials, such as the client ID and secret.
Retrieve Vepple Data
- Once we've connected to the Vepple API, use the 'HTTP' action to send a GET request and retrieve the data. You need to include the parameters in the request URL to filter the results.
Handling Success and Failure
- Check the results of the access token retrieval. Continue if successful, quit the flow if it fails. This would tell you if there has been a problem.
- As shown above, the flow has been set up to first check the results obtained. It then parses these results and establishes the necessary variables. This step involves passing the API access token into the system which is used in the next step i.e. fetching leads.
Fetching Leads Data
- Retrieve leads registered on the previous day from the Vepple API. If you optimised for behaviour tracking, it would be ‘get users’ while for volume and engagement, it would be ‘get leads’
Handling Success and Failure
- Check the results of the get users result. Continue if successful, quit the flow if it fails. This would tell you if there has been a problem.
Setting Additional Variables for Dynamics Leads Table
- Define variables for different attributes in the leads table within Dynamics, such as campus, levels of study, subject areas, years of entry, and countries. These attributes are linked to referential tables. For example, some universities have different campuses, levels of study, subject areas and countries.
Reading Referential Tables
- Read and retrieve data from the referential tables for attributes such as campus, levels of study, subject areas, years of entry, and countries.
Optimising Data Retrieval
- Optimise data retrieval by fetching all records into an array instead of querying them directly each time for faster processing.
Looping Over Results
- Apply a loop over the results obtained from the API to process each record individually. Keep a counter to track each processed record. For example, it will be easy for you to know the ‘I am’ which in this case refers to I am a parent or student or teacher depending on the choices.
Handling Choice Fields and Lookup Tables
- Map choice fields in Dynamics, which are essentially IDs, by looking up the corresponding IDs based on the values received from Vepple.
- If the choice field contains parents, then we will know that the ID is 100000004 in the lead table.
- And in the contact table, it will be 1000000001
Handling Mapping Challenges
-
Addressing Country Mapping
- Handle discrepancies in country names between Vepple and Dynamics by implementing a country lookup mechanism. It will work for the majority of the countries however there may be differences. For example , South Korea Vs Republic of Korea, Côte d’Ivoire Vs Ivory Coast e.t.c
- If the country is not null, this is the point where the lookup process occurs for countries. It involves searching for the corresponding ID by matching the value in the array.
- Follow the same process for subject area, study level and year of entry
-
Subject areas
- There is a chance that the subject areas in Vepple don’t match the subject areas in your CRM. For example, a subject area may be Art and Design in Vepple while your CRM has Art and Design as two separate subject areas which may be a challenge for you to map them across.
-
Handling Marketing Preferences
- Adjust marketing preference values to match the format in Dynamics, ensuring consistency for example; if it is false in Vepple, it might be true in Dynamics. You need to adjust the logic to match your system.
-
Handling Date of Birth Validation
- Validate the date of birth received from Vepple to ensure it meets the system's requirements in Dynamics. For example; you may have to debug certain situations where a record fails because a user has put the date of birth as 11/11/1111 which is not compatible with Dynamics.
- You can set the system to check the dates after 1900. Otherwise, there will be an error.
Append to VarData
- This step involves saving all the results in a comma-separated list. This will allow you to debug it at the end. If you have saved it as a CSV file in case of a problem, you won’t be able to see where it is.
Create Dynamics Records
- After mapping the fields, add a 'Create a new record' action to our flow to create new leads in Dynamics. We'll specify the entity type as 'Leads' and map the relevant fields from Vepple to Dynamics, such as 'Email' and 'Phone
- You may want to tag each record with an Origin i.e. Vepple such that you know where that lead came from.
Process contact record
- You want to check if the contact exists in the system.
- If it exists, then you get the GUID (Global Unique Identifier)of the record/contact and update it to match.
- If it doesn’t, then you will create a new contact.
Output
- Once it has looped all the data, you will output a CSV file.
- You can access it by going to your flow.
Logging Errors and Sending Notifications
- Log any errors encountered during the process and send notifications to the appropriate teams for resolution.
- Your implementation might be that if there are error logs greater than 0,>format and send an email to your web and CRM team.
Test and Validate the Flow
- Test the Power Automate flow thoroughly to ensure that data retrieval, mapping, and creation processes function as expected.
- Validate the integration by inspecting Dynamics to confirm that the mapped data from Vepple has been successfully imported.
Monitor and Optimise Performance
- Monitor the performance of the integration flow regularly to identify any bottlenecks or areas for optimisation.
- Optimise the flow by fine-tuning data retrieval queries, adjusting mapping logic, or optimising error handling mechanisms as needed.
Document and Maintain
- Maintain the integration flow by updating it as necessary to accommodate changes in Vepple API endpoints, Dynamics entities, or data requirements.
- Document the integration flow, including mapping rules, data transformations, and error-handling procedures, for future reference.
Comments
0 comments
Please sign in to leave a comment.