searchCustomersNode Documentation
Purpose
The searchCustomersNode is designed to facilitate the integration with the Stripe API specifically for the purpose of searching and retrieving customer data. It allows users to perform searches based on a query string, setting limits on the number of results returned and handling pagination through a cursor mechanism. This component is built to enhance the capabilities of the Vantage analytics and data platform by integrating with external data sources efficiently.
Settings
The searchCustomersNode has several configurable settings that adjust its functionality. Below are the detailed explanations for each setting:
1. Query
- Input Type: String
- Description: The
querysetting is crucial as it defines the search term(s) to be used when querying customer information from Stripe. If the input does not provide aquery, the function will throw an error. - Default Value: None (this is a required field).
2. Limit
- Input Type: Numeric
- Description: The
limitsetting controls the maximum number of customer records to return in one request. This is essential for managing how much data is pulled from the Stripe API at once. Setting a lower limit can result in faster responses and better performance when only a subset of results is required. - Default Value: 100 (if not provided or if it’s absent in the configuration).
3. Page
- Input Type: String (cursor)
- Description: The
pagesetting is utilized for pagination, allowing users to specify the cursor from which the next set of results should be fetched. It facilitates navigating through larger datasets by loading results in chunks rather than all at once. - Default Value: None (page is optional but does not have a defined default configuration).
How It Works
-
Integration: The
searchCustomersNodefirst establishes a connection to the Stripe API using a secure connection method. It pulls integration configurations such as authentication details from thecontext, which is passed as an argument. -
Input Handling: It processes the inputs by checking for
query,limit, andpage. It prioritizes inputs provided directly by the user over those supplied in the configuration. -
Error Handling: If the
queryis not specified, the function raises an error immediately to inform the user of the requirement for a search term. -
Data Retrieval: The function then calls the
searchCustomersNodemethod on the Stripe integration, passing the validatedquery,limit, andpageparameters. It awaits the output from this API call. -
Output: The function returns the customer data received from Stripe under the
output1key. If there is an error during the process, it captures and returns an error message with details about the issue encountered.
Expected Data
The searchCustomersNode expects the following data:
-
An object containing
inputs, which may include:query(string): The search term for finding customers.limit(numeric): The maximum number of results to return.page(string): The cursor for pagination.
-
A
configobject that can provide default values forquery,limit, andpageif they are not provided via inputs.
Use Cases & Examples
Use Case 1: Customer Data Analysis
A business wants to analyze its customer base by performing searches based on various criteria, such as email addresses or names, through its Stripe account.
Use Case 2: Customer Management System
A CRM tool integrated with Vantage requires real-time access to customer data stored in Stripe. searchCustomersNode can enable this tool to fetch and display customer information dynamically based on user inputs.
Specific Example Configuration:
Use Case 1 Implementation
To search for customers whose email contains "support":
{
"inputs": {
"query": "support",
"limit": 50,
"page": null
},
"config": {
"query": "support",
"limit": 50,
"page": null
}
}In this configuration:
- The
queryis set to "support" to find relevant customers. - The
limitis set to 50 to return a manageable number of results, reducing data load. - The
pageis left asnull, meaning the search starts from the beginning of the customer list.
This configuration will allow the business to efficiently retrieve and analyze customer data, enhancing their operational capabilities.