Files
Frends templates for files. File templates allow to perform common file and directory operations.
This template reads a JSON file containing company data from a local fileshare and either inserts or updates each company in HubSpot.
This template assumes that the following prerequisites are in place:
The path to the JSON file in the local fileshare is determined in the process variables. The template either inserts or updates each company in HubSpot, depending on whether a company with a matching name is found.
To use the template without modifications, ensure the JSON data matches the format required for creating companies via the API. If the data format does not match, the template can be adjusted to include additional mapping.
Example JSON data structure
[
{
"properties": {
"name": "Example Company",
"domain": "https://www.examplecompany.com",
"address": "123 Lane Road",
"city": "Los Angeles",
"zip": "10001",
"state": "CA",
"country": "United States",
"phone": "555-123-4567"
},
},
{
"properties": {
"name": "Another Company",
"domain": "https://www.anothercomp.org",
"phone": "555-321-7654"
},
}
]
If the file cannot be read, the process throws an exception. The API calls to HubSpot are checked for errors. If processing a company fails, the template moves to the next one, and any encountered errors are displayed at the end of the process. This template does not handle transient errors separately. However, if transient errors are expected, you can enable the "Retry on Failure" option in the advanced settings of the HubSpot request tasks.
InFilePath | The full path of the JSON file, including the file name. |
HubSpotAccessToken 🗝 | The Access token for the HubSpot API. |
HubSpotBaseUrl | The base URL of the HubSpot API. |