This page was recently updated. What do you think about it? Let us know!.

Connect HubSpot to your preprocessing pipeline, and use the Unstructured Ingest CLI or the Unstructured Ingest Python library to batch process all your documents and store structured outputs locally on your filesystem.

The requirements are as follows.

The HubSpot connector dependencies:

CLI, Python
pip install "unstructured-ingest[hubspot]"

You might also need to install additional dependencies, depending on your needs. Learn more.

The following environment variables:

  • HUBSPOT_API_TOKEN - The access token value for the HubSpot private app, represented by --api-token (CLI) or api_token (Python).
  • HUBSPOT_OBJECT_TYPES - A comma-separated list of strings (CLI) or an array of strings (Python) specifying one or more of the object types to access. This must be a subset of tickets, calls, emails, notes, tasks, products, and communications. These are represented by --object-types (CLI) or object_types (Python); if not specified, all of these object types are accessed by default.
  • HUBSPOT_PROPERTIES - Any filtering to be applied to specified object types, declared as a dictionary of key-value pairs (Python) specifying one or more of the default properties and their desired property values, represented by properties (Python). Not available in the CLI.
  • HUBSPOT_CUSTOM_PROPERTIES - Any custom properties to access. For the CLI, this is specified as a JSON-like string in the form "{\"<object_type>\":[\"<custom_property_id>\", ..., \"<custom_property_id>\"]}". For Python, this is specified as a Dict[str, List[str]]. This must map to the internal name of the variable. If the property is missing, it will be omitted. This is represented by --custom-properties (CLI) or custom_properties (Python).
  • HUBSPOT_PARAMS - For Python, an array of strings specifying any values to filter the customer properties on represented by params. Not available in the CLI.

Now call the Unstructured Ingest CLI or the Unstructured Ingest Python library. The destination connector can be any of the ones supported. This example uses the local destination connector.

This example sends data to Unstructured API services for processing by default. To process data locally instead, see the instructions at the end of this page.

For the Unstructured Ingest CLI and the Unstructured Ingest Python library, you can use the --partition-by-api option (CLI) or partition_by_api (Python) parameter to specify where files are processed:

  • To do local file processing, omit --partition-by-api (CLI) or partition_by_api (Python), or explicitly specify partition_by_api=False (Python).

    Local file processing does not use an Unstructured API key or API URL, so you can also omit the following, if they appear:

    • --api-key $UNSTRUCTURED_API_KEY (CLI) or api_key=os.getenv("UNSTRUCTURED_API_KEY") (Python)
    • --partition-endpoint $UNSTRUCTURED_API_URL (CLI) or partition_endpoint=os.getenv("UNSTRUCTURED_API_URL") (Python)
    • The environment variables UNSTRUCTURED_API_KEY and UNSTRUCTURED_API_URL
  • To send files to Unstructured API services for processing, specify --partition-by-api (CLI) or partition_by_api=True (Python).

    Unstructured API services also requires an Unstructured API key and API URL, by adding the following:

    • --api-key $UNSTRUCTURED_API_KEY (CLI) or api_key=os.getenv("UNSTRUCTURED_API_KEY") (Python)
    • --partition-endpoint $UNSTRUCTURED_API_URL (CLI) or partition_endpoint=os.getenv("UNSTRUCTURED_API_URL") (Python)
    • The environment variables UNSTRUCTURED_API_KEY and UNSTRUCTURED_API_URL, representing your API key and API URL, respectively.

    Get an API key and API URL.