Search Automation
This will automatically do the entire pagination logic and will output a nice 'flat' list of records.
Feature Introduction
The remote search feature allows users to search for IDs by a name they're used to, e.g. they can search for a contact ID by the name of a contact:
In order for this to work, we need to setup a search, and for some connectors a pagination configuration, on the connector itself and add some fields to the ui form schema of the field where the search should take place.
Configuration on connector
The configurations on the connector are both in JSON format.
Search configuration
The search configuration contains most of the logic needed to do the search itself.
You can use Jinja in all fields in order to use parameters that are passed from the action or even have conditional statements involving these parameters.
response_fields
response_fields
The response_fields
are JSON paths to the fields that should be searched and shown in the search results.
It is always a dictionary with the keys id
and match
.
The id
field specifies the json paths to the field that should later be inserted into the field in the connector; it is mostly an id (thus the name), e.g. the contact id in the example above).
The match
field specifies the json paths to the field that the user is searching by (e.g. for the example the contact's name). For the type
search
it actually doesn't have any effect, however it is used for the type
list
.
endpoint
endpoint
The endpoint
is the endpoint that is used for searching by that connector and will be appended to the base domain, just like the endpoint in actions.
query
query
Optional
The query
is a string that contains a dictionary of query parameters that will be used in the search call.
q
is always the input of the field where remote search is configured in the action.
If the query
parameter is given a GET
call is being done by the search configuration.
body
body
Optional
The body
is a string that contains a dictionary of request body parameters that will be used in the search call.
If the body
parameter is given a POST
call is being done by the search configuration.
type
type
The type
specifies whether the search goes directly to a search endpoint of the connector, then the type
is search
, or whether a call to a list endpoint that returns a list of entities is done (in case the connector doesn't provide a search endpoint), then the type
is list
.
In case of the list
type
the actual search happens in our backend.
when
when
Optional
The, potentially rendered, result of this parameter will be compared to True
and if it matches, that search configuration will be used.
This needs to be used in combination with multiple configurations.
Multiple configurations
In order to add multiple search configurations for one Connector, the configuration needs to be a list of configurations and the parameter when
needs to be used, except for the last statement, which can be a 'catch all' configuration.
The when
parameter will be checked from top to bottom and the one that matches first will be used. In case none match and a search configuration does not have a when
parameter, that configuration will be used (i.e. similar to multiple elif
and lastly an else
statement).
Pagination configuration
Optional
This is only needed in case there's any pagination for the endpoint required. Parameters such as limit
can be directly configured within the search configuration.
The pagination configuration is also used for Automatic Pagination Configuration
Configuration on action
On the action that uses the search some more configurations are necessary, in order to specify in which field the search should happen and to pass further parameters.
The field used for search needs to be on the first level of JSON nesting (i.e. it can't be nested).
type
type
The type of the field has to be text
We didn't see a use case for any other field type, so we kept it simple. In case you see a use case, let us know.
placeholder
placeholder
Optional
The placeholder
is not required, however this is probably the best way to make it obvious to the user that they can search here.
hasRemoteSearch
hasRemoteSearch
hasRemoteSearch
needs to be set to true
.
resourceType
resourceType
resourceType
is required to be filled and will be accessible in the search configuration.
This could e.g. be "customer", "ticket", "user"; so an entity name that exists in the connector.
remoteSearchParam
remoteSearchParam
With this field we can use input from other fields, which are also on the first level of JSON nesting and then access it within the search configuration
E.g. for Asana we need to pass the workspace_gid
to the search configuration, which looks like this:
The UI Form Schema in this case would look something like this:
count
count
Optional
This could e.g. be 5
or 10
; and specifies the number of entities that we want to return (in case this is configured in the search configuration).
We haven't seen a use case yet where it makes sense to configure this on the action. If we don't see one in the next month, we can probably remove it entirely
Examples
Freshsales - Search
Search configuration
Action search configuration
HubSpot - Search
Search configuration
HubSpot has a search endpoint, which works great for the resource types that could have potentially thousands of entries (i.e. using type list is not an option), however, it does not work for all resource types and for the ones that are not supported get calls need to be made.
Thus, multiple configurations are needed in order to cover all resource types:
For the search endpoint HubSpot expects a
POST
request, thus we need to provide the fieldbody
instead of the fieldquery
. This configuration will use thewhen
parameter, as HubSpot has a set list of resource types that are supported by this endpoint.For the get endpoints, search type
list
needs to be used. Here, thewhen
parameter will not be used, as it should always be used if the resource type is not supported by the search endpoint (and thus the first search configuration).
Action search configuration
Slack - List
Search configuration
This is not dynamic yet, needs to be improved
Action search configuration
Stripe - List
Search configuration
Here we use conditional Jinja logic in order to reference to the proper match
field.
Action search configuration
Last updated