1. Feature Overview
You can map parameters from APIs to LeadSquared fields, ensuring accurate data exchange, and transform data as needed using LiquidJS filters. The connector also lets you dynamically utilize API responses in subsequent actions, streamlining complex workflows. Additionally, it supports custom success and error handling criteria, enabling robust error detection and retries. With the ability to chain actions and reuse data from previous steps, the connector simplifies creating efficient and connected data flows.
If you’re new to UDS, see Getting Started with UDS.
2. Prerequisites
- You must be an Administrator user.
- The Universal Data Sync Connector is a paid feature. To enable it on your account, contact your account manager, or write to support@leadsquared.com.
- Before creating actions, you must select a trigger for your data flow. For more information, see Select a Trigger.
3. Example Data Flow
This is an example of how you can set up data flows using UDS connector for Razorpay, but the same approach can be applied to any provider. In all the configuration-related documents, we’ve created two data flows as examples –
- Generate Payment Link (Outbound): Sends payment data to Razorpay and logs a payment activity in LeadSquared
- Receive Payment Notifications (Inbound): Captures payment status updates from Razorpay and adds them as activities in LeadSquared.
You can configure similar flows for any third-party provider, automating data exchanges and keeping your systems synchronized.
We’ll create 2 actions in the Actions section to demonstrate this feature –
- Action 1 – Send Payment Data from LeadSquared to Razorpay (using Razorpay’s Payment Link API) to generate a payment link.
- Action 2 – Post an activity against the lead LeadSquared to track payments leads have made.
4. Create an Action
- Click Add Action.
- Enter the name and description, then click Save & Next.
5. Third Party API Setup
Configure the third-party APIs to send data from LeadSquared to the third-party platform. In this example, we use the Razorpay generate payment link API to send transaction details from LeadSquared to Razorpay to enable payment functionality for end users.
1. Input cURL Request –
- Click Edit Details and enter the API cURL request.
- Scroll down and click Save & Next.
2. Define Param –
- The parameters are automatically populated based on your cURL request.
- Change the Type of the parameter if required.
- Enable Required for API for mandatory fields.*
- If required, click Add Custom to add more parameters to the API request.
- Use the delete icon under the Actions column to remove unwanted parameters.
- Scroll down and click Save & Next.
3. API Configuration –
This section is auto-populated based on your cURL request. If required, you can make changes to the API configurations here –
- Edit the HTTP method (Post, Get, etc.).
- On the top right section, click View Merge Fields. You’ll see the list of parameters and corresponding keys. LeadSquared system authentication variables are also available (e.g., LEAD_ID, ORG_ID, LSQ_SECRET_KEY, APPLICATION_ID, etc.). You can append these parameters to the API query string or the the request body if required.
- If required, on the Headers tab, click Add New to add headers to the API request. Enter the required key-value pairs.
- Navigate to the Body tab and review the request body. If required, change the request format (e.g., Click the View Merge Fields link to copy and add additional parameters.
- Click Save & Close when you’re done.
6. Param Mapping
Once the third-party API is configured, the next step is to map its parameters to LeadSquared fields. This ensures the correct data from LeadSquared is sent to the third-party system.
- Click Define Mapping.
- Alongside each variable, click Select a Field. Select the entity (e.g., lead, opportunity, activity. etc.) then select the field to map to the API parameter. You can map multiple fields to the same API parameter. If the first field you mapped is blank (doesn’t contain data), the value is taken from the subsequent field mapping.
- Map all parameters and click Save & Close.
7. Creating a Custom Mapping
When triggering a data flow on an event that’s not listed (for example, task triggers, account triggers, etc.), the custom option allows you to map trigger data with an API parameter here.
- Use the JSON Path Finder to find the mapping key for the parameter you wish to map.
- Put the parameter within double curly braces {{ }} and prepend data.
- For example, {{data.Jsonpath}}
For example, if the path for the parameter (from the JSON Pathfinder) is x.accept_partial, pass it here as {{data.accept_partial}}
8. Transform Data
Click the circle icon under the Transformation column alongside a variable/parameter to transform the data using LiquidJS filters. This is useful for customizing how data is sent to third-party systems. For example, you can remove the country code from a phone number using a transformation filter. To learn more, see LiquidJS Filters.
9. Response Mapping For Success
Response Mapping lets you capture parameters from a third-party API response to be used in subsequent actions in your data sync application. This makes data integration smooth by letting you dynamically utilize values returned by the external API.
For example, we’ll capture the entire response of the payment link API and use it in the next action to post the payment link and other details as an activity on the lead in LeadSquared.
1. Data Key Selection –
- Enter or paste the API response in the space provided.
- All parameters are captured from the payload by default. Instead if you only want to capture one specific parameter from the payload, select the child key.
2. Success Criteria –
Map custom HTTP response codes and keywords to indicate successful API calls. This is helpful when third-party APIs use non-standard response codes (instead of the typical 2xx OK
) to signal a successful response. Additionally, they may include success keywords in the response body, such as "status": "completed"
or "message": "success"
.
You can configure these unconventional success indicators in the connector by mapping specific response codes or keywords. This ensures your data flows proceed as expected, even when dealing with non-standard API responses.
- Click Add Custom.
- Enter the HTTP Response code and the keyword, and hit enter.
3. Response Variable Mapping
This is a read-only section for information purposes only. When you’re setting up the next action, the ‘data’ object with all the parameters of the API response will be available for use.
10. Response Mapping For Errors
Similarly, you can map specific HTTP response codes or keywords to indicate an error during an API call. This allows the system to detect and handle failed responses effectively. You can configure error handling by –
- Mapping HTTP error codes such as
400
,404
, or500
to indicate a failed request. - Using error keywords from the API response body, such as
"status": "failed"
or"error": "invalid_request"
, to identify errors even when the HTTP code may not explicitly indicate failure.
- Alongside Response Mapping for Error, click Edit Details.
- Click Add Custom.
- Enter the HTTP Response Code, Keyword(s) and Error Message. Click Auto Retry to initiate another API call (maximum limit is 3 times).
- Scroll down and click Save & Close.
The action is now successfully configure. Click Save & Close.
11. Chaining Actions
In this section, we’ll demonstrate how to use the response of a previous action in subsequent actions and handle more complex workflows.
Let’s create a new action under the same data flow. This action creates an activity on LeadSquared with the payment link and other details received in the response of the Razorpay Payment Link API (mapped in the previous step).
The steps are similar to the previous action. This time we configure the LeadSquared Add Activity API to post the activity on the lead who made the payment.
First, we’ll create the action and configure the API.
In the API configuration step, we’ll replace the values for the ActivityEvent and the SchemaName parameters with the actual values. The remaining parameters will be dynamically populated using the API response in the previous step.
Next, we’ll map the API request parameters from the Create Activity API to their corresponding fields in LeadSquared, such as Access Key, Secret Key, and Lead ID. Additionally, we’ll map other parameters to the response from the Get Payment Link API (configured in the previous step) to capture details like the payment link, amount, and reference ID.
In this example, we’ll skip the Response Mapping for Success step, because we don’t need to map the Create Activity API response and use it in a subsequent action. We’ll also skip the Response Mapping for Failure step, and Save & Close the action.
Our set up is now complete. Action 1 sends the lead and payment information to Razorpay. Action 2 receives the payment link and other details and posts them as an activity against the lead on LeadSquared.
12. Next Steps
Now that you’ve setup an app, a data flow with actions, you can create more apps or data flows if required.
Any Questions?
Did you find this article helpful? Please let us know any feedback you may have in the comments section below. We’d love to hear from you and help you out!