Locoia
  • Overview
  • Account and User Settings
    • User types
    • Adding Users
    • Teams
    • Access Permissions
    • 2 Factor Authentication 2FA
    • Versioning and Snapshots
    • Activity Log
  • Reset your Password
  • Invoices and Payments
  • Automation
    • Flow Builder
      • Flow Building Best Practices
      • Jinja Template Language
        • Jinja: (Custom) variables, wildcards and functions
        • Magic Code Samples
      • Connectors & APIs
        • Titles and References
        • Referencing data of objects, lists, arrays - how to pass data dynamically
        • Accessing Objects with JSONPath
        • Merging nested JSON objects
        • Parsing JSONs from String
        • Response Headers & Status Codes
        • Custom Data Fields
        • Wildcard API calls and actions
        • Response cleaning
      • Text Strings, Date & Time, Numbers and Currencies
        • Text and Strings
        • Dates & Time
        • Numbers (Thousand Separators, Currencies)
      • Email-formatting
      • Code Fields
      • Running single Flow steps
      • Flow run data retention, logging, and error notifications
      • Advanced View
      • Dynamic Title
      • Custom Error Handling
      • Error Handling Flows
      • Automatic Pagination
    • Flow Debugger
      • Automatic Retrying
      • Run Flows again
      • Troubleshooting Flows
    • Community Library
  • Connectors & Helpers
    • Connectors
      • Monday.com
      • ActiveCampaign
      • Aircall
      • Allthings
      • Amplitude
      • Animus
      • Assetti
      • Awork
      • AWS RDS Database - How to connect
      • bubble.io
      • Casavi
      • Chargebee
      • CleverReach
      • comgy
      • commercetools
      • Everreal
      • Exact Online
      • Facebook Marketing
      • FahrlƤnder Partner
      • FastBill
      • FILESTAGE.io
      • Freshdesk
      • Freshsales
      • Google Ads
      • Google Ads Lead Form
      • Google Analytics
      • Google Chat
      • Google Drive
      • Google Sheets
      • Gmail
      • HubSpot
      • Heyflow
      • iDWELL
      • ImmobilienScout24
      • Instagram Ads
      • Intercom
      • klaviyo
      • Kiwi Opening Doors
      • Klenty
      • Klipfolio
      • Kolibri CRM
      • konfipay
      • KUGU
      • Shopify
      • S3 AWS
      • SQS AWS
      • Lambda AWS
      • Learnster
      • lexoffice
      • LineMetrics
      • Linkedin
      • Locoia
      • Notion
      • MailGun
      • Makula
      • Microsoft Dynamics 365
      • Microsoft OneDrive
      • MixPanel
      • MongoDB
      • Odoo
      • OnFleet
      • OnOffice
      • Oracle NetSuite
      • Outbrain
      • Quickbooks
      • Trello
      • PandaDoc
      • Personio
      • Pinterest Ads
      • Pipedrive
      • Plentific
      • PriceHubble
      • relay
      • REALCUBE
      • Sage ERP
      • Salesforce
      • SAP
      • Scoro
      • Seafile
      • sevDesk
      • SharePoint
      • SharpSpring
      • Slack
      • Snapchat Marketing
      • Snowflake
      • Teamleader Focus
      • Teamwork.com
      • Tableau
      • TikTok
      • TinQwise
      • The Trade Desk
      • Twitter
      • Typeform
      • WordPress
      • Xero
      • Youtube
      • Zendesk
      • Zoho CRM
      • Zoom
    • Helpers
      • Scheduler
      • Webhook
      • Dict Helper
      • Spreadsheet Helper
      • REST Helper
      • Boolean Helper
      • Multi Case Helper
      • Looper
      • FTP Helper
      • CSV Helper
      • XLSX Helper
      • Mail Sender
      • Flow Trigger
      • File Storage Helper
      • Terminate Helper
      • Delay Helper
      • SQL Connector
      • PDF Helper
      • Zip Helper
      • Data Warehouse Helper
      • XML Helper
      • Form Helper
      • Arrow
      • Error Arrow
    • Authentication Types Available
      • Setting up authentication
      • OAuth1
      • OAuth2
      • Refreshable token
      • AWS Signature
      • Basic Auth and Other Simple Authentication Methods
      • How are API versioning and API updates handeled?
      • Custom OAuth2 clients (apps)
    • Building Connectors
      • Base Connector Setup
        • Connector Auth Validation
        • GraphQL APIs
        • Rendering with User Input
      • Building Connector Actions
        • Actions Examples
      • Search Automation
      • Pagination Automation
      • Uploading Files in Actions
      • Working with SOAP APIs
    • Super Actions
    • Webhook Trigger for Connectors
    • Data Mapping and Env Variables
  • Embed - White Label Portal
    • Embed Overview
      • 1. Embed Flow
        • 1.1 Creating Embed Flows
        • 1.2 Updating Embed Flows
        • 1.3 Embed Error Handling
        • 1.4 Setting up Callbacks for Integration activation/deactivation
        • 1.5 Setting up Remote search
        • 1.6 Setting up End User logs
      • 2. Configure Embed
        • 2.1 Embed Integration via SSO
        • 2.2 Proprietary connector setup
        • 2.3 Sharing level
        • 2.4 Consent screen
        • 2.5 Account Secrets
        • 2.7 Further settings
      • 3. Integrate Embed
        • 3.1 iframe vs native embed
        • 3.2 Customizing CSS
        • 3.3 Events emitted from iframe to parent window
      • 4. Embed for End User
        • 4.1 Embed Remote Search
        • 4.2 Embed End User Logs
      • 5. Test Embed Configuration
        • Testing example
      • 6. Embed Integrations and Connector Auths
    • Embed FAQs
  • Data and Dashboards
    • Dashboards & Insights
      • Introduction to Dashboards
      • Introduction to Insights
      • Introduction to Data Sources
      • Dashboard Filters
      • Insight Marketplace - Using Pre-Built Insights
      • Writing SQL Queries
      • Useful SQL Examples
      • Charts
        • Line Chart
        • Bar and Horizontal Bar Chart
        • Stat Card
        • Pie Chart
        • Gauge Chart
        • Donut Chart
        • Stacked Bar, Horizontal Stacked Bar, and Normalized Horizontal Stacked Bar
        • Multiple Line Chart
        • Pivot Table
        • Map Chart
  • Best Practice Guides
    • Integration Best Practices
    • Integration Check List
    • CSV Files in Excel
    • Multi-Tenant Flows
    • On-Premise Integrations
    • Database Connection Setup
    • Data and General Security
    • Using Tags
    • FAQ
  • API
    • Locoia API Authentication - Personal Access Token
    • Create Connector Authentication
  • Contact us
  • Status of Service
  • Data Privacy
  • Imprint
Powered by GitBook
On this page
  • Feature Introduction
  • Connector configuration
  • Search configuration
  • Pagination configuration (optional)
  • Configuration on action
  • Examples
  • Freshsales - Search
  • HubSpot - Search
  • Slack - List
  • Stripe - List

Was this helpful?

  1. Connectors & Helpers
  2. Building Connectors

Search Automation

This will automatically do the entire pagination logic and will output a nice 'flat' list of records.

PreviousActions ExamplesNextPagination Automation

Last updated 29 days ago

Was this helpful?

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:

To implement this feature, the following configurations are required:

  • Connector configuration: Defines how the search is performed.

  • Pagination configuration (if needed): Handles cases where results span multiple pages.

  • UI form schema: Specifies where and how the search input appears in the user interface.

Connector configuration

The connector's configuration is provided in JSON format, which defines the logic and parameters for the search operation.

Search configuration

The search configuration defines most of the logic required to execute a search. It specifies the fields to retrieve, query structure, endpoint, and optional parameters like body and conditions. You can use Jinja in all fields to use parameters passed from the action or even have conditional statements

Example configuration
{
  "response_fields": {
    "id": "$[*].id",
    "match": "$[*].name"
  },
  "query": {
    "include": "{{ resource_type }}",
    "q": "{{ q }}",
    "per_page": 50
  },
  "type": "search",
  "endpoint": "search"
}

Key Fields:

  • response_fields:

    • id: JSON path for the field to insert into the connector (typically an ID). $[*].id retrieves the contact ID field (example above)

    • match: JSON path for the field used in user search (e.g., name). $[*].name retrieves the contact's name (example above)

  • 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 (optional)

    • A JSON string defining query parameters for a GET request.

    • q The search input from the UI field where remote search is configured in the action.

  • body (optional)

    • A JSON string for request body parameters in a POST request.

  • type:

    • Specifies the search type:

      • search: Uses the connector's search endpoint directly.

      • list: Retrieves a list of entities when the connector lacks a search endpoint. In this case, the actual search happens in our backend.

  • when (optional)

    • A condition evaluated as True to determine if this configuration should be used.

Multiple configurations

To support multiple search scenarios 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)

Multiple configurations example
[
  {
    "when": "{{ resource_type == 'contacts' }}",
    "type": "search",
    "response_fields": {
      "id": "$[*].id",
      "match": "$[*].name"
    },
    "endpoint": "contacts/search"
  },
  {
    "type": "list",
    "response_fields": {
      "id": "$[*].id",
      "match": "$[*].lastName"
    },
    "endpoint": "users/list"
  }
]

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.

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.

"id": {
  "title": "Account ID",
  "type": "text",
  "required": true,
  "placeholder": "Search by account name...",
  "hasRemoteSearch": true,
  "resourceType": "sales_account",
  "remoteSearchParam": [],
  "count": 10
}

The field used for search needs to be on the first level of JSON nesting (i.e. it can't be nested).

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 is optional, however, this is probably the best way to make it obvious to the user that they can search here.

hasRemoteSearch needs to be set to true.

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 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:

{
  "type": "search",
  "response_fields": {
    "match": "$.data[*].name",
    "id": "$.data[*].gid"
  },
  "query": "{\"resource_type\": \"{{ resource_type }}\", \"query\": \"{{ q }}\", \"count\": \"50\"}",
  "endpoint": "workspaces/{{ workspace_gid }}/typeahead"
}

The UI Form Schema in this case would look something like this:

{
  "workspace_gid": {
    "title": "Workspace GID",
    "type": "text",
    "placeholder": "Required to enable search",
    "info": "Globally unique identifier for the workspace or organization."
  },
  "project_id": {
    "title": "Project ID",
    "type": "text",
    "required": true,
    "info": "Globally unique identifier for the project.",
    "placeholder": "Search by project name…",
    "hasRemoteSearch": true,
    "resourceType": "project",
    "remoteSearchParam": [
      "workspace_gid"
    ]
  }
}

count is 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

{
  "type": "search",
  "response_fields": {
    "match": "$[*].name",
    "id": "$[*].id"
  },
  "query": "{\"include\": \"{{ resource_type }}\", \"q\": \"{{ q }}\", \"per_page\": 50}",
  "endpoint": "search"
}

Action search configuration

"id": {
  "title": "Account ID",
  "type": "text",
  "required": true,
  "placeholder": "Search by account name...",
  "hasRemoteSearch": true,
  "resourceType": "sales_account",
  "remoteSearchParam": [],
  "count": 10
}

HubSpot - Search

Search configuration

Thus, multiple configurations are needed in order to cover all resource types:

  1. For the search endpoint HubSpot expects a POST request, thus we need to provide the field body instead of the field query. This configuration will use the when parameter, as HubSpot has a set list of resource types that are supported by this endpoint.

  2. For the get endpoints, search type list needs to be used. Here, the when 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).

[
  {
    "when": "{{ resource_type == 'companies' or resource_type == 'contacts' or resource_type == 'deals' or resource_type == 'feedback_submissions' or resource_type == 'products' or resource_type == 'tickets' or resource_type == 'line_items' or resource_type == 'quotes' }}",
    "type": "search",
    "body": "{ \"filterGroups\": [{\"filters\": [{\"propertyName\": \"{% if resource_type == 'companies' %}name{% elif resource_type == 'contacts' %}lastname{% elif resource_type == 'deals' %}dealname{% endif %}\", \"operator\": \"CONTAINS_TOKEN\", \"value\": \"{{ q }}\"}]}]}",
    "response_fields": {
      "id": "$.results[*].id",
      "match": "$.results[*].properties.{% if resource_type == 'companies' %}name{% elif resource_type == 'contacts' %}lastname{% elif resource_type == 'deals' %}dealname{% endif %}"
    },
    "endpoint": "crm/v3/objects/{{ resource_type }}/search"
  },
  {
    "type": "list",
    "query": "",
    "response_fields": {
      "id": "$.results[*].id",
      "match": "$.results[*].lastName"
    },
    "endpoint": "crm/v3/owners"
  }
]

Action search configuration

"companyId": {
  "type": "text",
  "title": "Company ID",
  "info": "Company to be updated",
  "required": true,
  "placeholder": "Search by company name…",
  "hasRemoteSearch": true,
  "resourceType": "companies",
  "remoteSearchParam": []
}

Slack - List

Search configuration

This is not dynamic yet, needs to be improved

{
  "type": "list",
  "response_fields": {
    "match": "$.channels[*].name",
    "id": "$.channels[*].name"
  },
  "endpoint": "conversations.list"
}

Action search configuration

"channel": {
  "title": "Channel Name without the # ",
  "type": "text",
  "placeholder": "marketing-team",
  "required": true,
  "info": "Search by name...",
  "hasRemoteSearch": true,
  "resourceType": "channels",
  "remoteSearchParam": []
}

Stripe - List

Search configuration

Here we use conditional Jinja logic in order to reference to the proper match field.

{
  "endpoint": "{{ resource_type }}",
  "type": "list",
  "response_fields": {
    "id": "$.data[*].id",
    "match": "$.data[*].{% if resource_type == 'customers' or 'products' %}name{% elif resource_type == 'invoices' %}customer_name{% endif %}"
  }
}

Action search configuration

"id": {
  "type": "text",
  "title": "ID",
  "required": true,
  "info": "Search by name...",
  "hasRemoteSearch": true,
  "resourceType": "customers",
  "remoteSearchParam": []
}

A dictionary specifying for search results.

This needs to be used in combination with .

The pagination configuration is also used for

HubSpot has a , 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.

JSON paths
Automatic Pagination Configuration
search endpoint
multiple configurations
Remote search demo
Configuration fields on connector