HubSpot
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.
You will need:
The HubSpot prerequisites:
- A HubSpot private app and its related access token.
- The HubSpot object types and any of their built-in properties that you want to access. Supported object types include tickets, emails, notes, calls, products, and communications.
- Any HubSpot params and custom properties that you want to access for any of the supported object types.
The HubSpot connector dependencies:
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) orapi_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) orobject_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 byproperties
(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 aDict[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) orcustom_properties
(Python).HUBSPOT_PARAMS
- For Python, an array of strings specifying any values to filter the customer properties on represented byparams
. 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) orpartition_by_api
(Python), or explicitly specifypartition_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) orapi_key=os.getenv("UNSTRUCTURED_API_KEY")
(Python)--partition-endpoint $UNSTRUCTURED_API_URL
(CLI) orpartition_endpoint=os.getenv("UNSTRUCTURED_API_URL")
(Python)- The environment variables
UNSTRUCTURED_API_KEY
andUNSTRUCTURED_API_URL
-
To send files to Unstructured API services for processing, specify
--partition-by-api
(CLI) orpartition_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) orapi_key=os.getenv("UNSTRUCTURED_API_KEY")
(Python)--partition-endpoint $UNSTRUCTURED_API_URL
(CLI) orpartition_endpoint=os.getenv("UNSTRUCTURED_API_URL")
(Python)- The environment variables
UNSTRUCTURED_API_KEY
andUNSTRUCTURED_API_URL
, representing your API key and API URL, respectively.
Was this page helpful?