Skip to main content

Export Records to Knack Connector Documentation

Overview

This documentation describes how to use the "Export Records to Knack" connector, which enables the export of data from your system to a Knack database. This connector is designed to synchronize data between your application and Knack, ensuring that records are kept up-to-date in both systems.

Knack DB

Knack is a no-code platform that allows users to create custom applications for their business. The platform provides a simple interface to build databases, forms, and workflows without the need for coding. Knack databases can be used to store and manage various types of data, making it a versatile tool for businesses of all sizes.

Connector Parameters

export_records_to_knack

Knack Settings

Knack Application ID

  • Type: Variable
  • Description: The Application ID uniquely identifies your Knack application.
  • How to Obtain: Access your Knack dashboard, navigate to 'Settings', and find the Application ID under 'API & Code'. knack_application_id

Knack API Key

  • Type: Variable
  • Description: The API Key is used to authenticate requests to the Knack API.
  • How to Obtain: From the Knack dashboard, go to 'API & Code' under 'Settings' to find your API Key. Keep this key secure as it allows access to your application data. knack_api_key
  • Note: The API Key should be kept secure in Secret Variable as it provides access to your Knack application data.

Knack Object Key

  • Type: String
  • Description: The Object Key corresponds to the specific database object (like a table) in Knack from which data will be imported.
  • How to Find: In the Knack application, navigate to the table you want to import data from. The Object Key can be found in the URL after /objects/. knack_object_key

Knack Filter for Duplicate Check

  • Type: JSON

  • Description: A JSON object defining the criteria used to check for duplicates before exporting data to Knack.

  • Configuration: The "Knack filter for duplicate check" is used to match records between the source entity and the target table in a Knack App. This utilizes the Knack Filter API, which is detailed at Knack's filter documentation.

  • Detail guide
    Here is a basic example of how to construct such a filter:
    {
    "match": "and",
    "rules": [
    {
    "field": "field_1", // ID of the field in the Knack table
    "operator": "is",
    "value": data.field_1 // Field from the source Entity
    }
    ]
    }

    PS: Don't forget to delete comments before using the JSON object.

    In this example, the filter is set up to ensure that the value in field_1 of the Knack table matches the field_1 from the source entity.

    If a unique identifier is composite, meaning it consists of multiple fields, you'll need to extend your filter to include each component of the identifier. In Knack, this is achieved by adding multiple rules to the filter, each specifying a part of the composite key. Each rule will compare a specific field in the target table to a corresponding field in the source entity.

    Here's an example of how to construct a filter with a composite unique identifier using the Knack Filter API:

    {
    "match": "and",
    "rules": [
    {
    "field": "field_1", // ID of the first part of the composite key in the Knack table
    "operator": "is",
    "value": data.field_1 // First part of the composite key from the source Entity
    },
    {
    "field": "field_2", // ID of the second part of the composite key in the Knack table
    "operator": "is",
    "value": data.field_2 // Second part of the composite key from the source Entity
    },
    // Add more rules as needed for additional parts of the composite key
    ]
    }

    When dealing with fields that are objects rather than literals for synchronization in Knack, and you require a full match between the object in the source entity and the object in the Knack table, you should use the full modifier in the value field of the filter. This ensures that the comparison checks for a complete match of the entire object structure and content, rather than just matching a simple literal value.

    Here is how you would modify the filter setup in the Knack Filter API to accommodate an object-based field requiring a full match:

    {
    "match": "and",
    "rules": [
    {
    "field": "field_1", // ID of the field in the Knack table
    "operator": "is",
    "value": data.field_1.full
    }
    ]
    }

Source Settings

Source Entity

  • Type: Entity
  • Description: Specifies the entity in your system from which data will be exported.
  • Selection: Choose the appropriate entity from the dropdown menu in the pipeline configuration.

Source Entity Filter

  • Type: JSON
  • Description: Defines conditions under which records are selected for export.
  • Configuration: Enter a Mongo query JSON object that specifies filtering rules.

Source Entity Mapping

  • Type: JSONata
  • Description: Maps fields from your source entity to the corresponding fields in the Knack object.
  • Example Configuration: Provide a JSONata object that pairs knack field ids with source entity fields.
{
"field_1": data.field_1,
"field_2": data.field_2,
"field_3": data.field_3
}
  • Note: JSONata syntax it's not the same as JSON. JSONata is a query and transformation language for JSON data. You can learn more about JSONata here.

Pipeline Creation Process

Follow these steps to create and configure your data export pipeline:

  1. Find and save Knack API details: Retrieve the Knack Application ID, API Key, and Object Key from your Knack dashboard
  2. Create variables: In the integration tab, create variables for Knack Application ID and Knack API Key
  3. Create source entity: Ensure that the source entity is created in your system to export data from
  4. Create a new pipeline: Open the Integration Detail Page, navigate to the "Pipelines" tab, and click on the "Create Pipeline" button
  5. Name Your Pipeline: Enter a descriptive name for your pipeline.
  6. Select Connector: Choose the 'Export Records to Knack' connector from the list of available connectors.
  7. Fill in Knack Connector Settings: Select variables for Knack Application ID and Knack API Key, enter Knack Object Key.
  8. Fill Knack Filter for Duplicate Check: Define the criteria for checking duplicates before exporting data to Knack.
  9. Fill Source Entity Settings: Select the source entity, enter the source entity filter, and provide the source entity mapping.
  10. Create Pipeline: Click on the "Create Pipeline" button to save your configuration.

Validation and Debugging

  • Check the last run status and logs to verify if the pipeline executed successfully.
  • Inspect the Knack database to ensure that the exported data is stored correctly.

FAQs and Troubleshooting

Common Problems

  • Duplicate Records: Ensure the duplicate check filter is correctly configured to match unique field values.
  • Empty Knack Table after Export: 1. Check the source entity filter to ensure that records are being selected for export. 2. Check the duplocate check filter to ensure that records are not being skipped due to duplicates.
  • API Authentication Errors: Double-check the API Key and Application ID for accuracy.