n8n
n8n copied to clipboard
Add support for HubSpot custom objects
In 2020 HubSpot added support for creating custom object types. This PR aims to add support for most operations on custom objects to the HubSpot Node. Associations between custom objects are not in scope.
Features:
- [x] Create custom objects
- [x] Read custom objects
- [x] Update custom objects
- [x] Delete custom objects
- [x] Search custom objects
- [x] Review and simplify description
- [x] ~Add documentation~ For now the descriptions should suffice.
Optional:
- [x] Use batch operations to save api calls
- [x] Create a synthetic upsert operation for convenience
- [x] ~Look into adding custom objects to the trigger node~ HubSpot does not support webhooks for custom objects
- [x] List custom objects
@michael-radency The previous PR #3035 got closed for inactivity. This is now ready for review.
Hello @Zebreus I made some adjustment to batch get operation so it will behave in more expected way regarding continueOnFail, also I think we need to remove error parsing from continueOnFail as it can cause errors by itself and just add it to return data, as it generally done in other nodes. Please let me know if you have any suggestion about it.
Delete operations always returns success true, even if it was not successful.
Upsert operation is not working as expected, for example here I would expect that it creates a new object
Hey @michael-radency It was probably the best choice to remove the complicated error parsing for the batch operations.
Do you have an example for when the delete operatioon returns true, when it should not? I think the only case a delete operation should error is when the resource exists, but cannot be deleted.
Upserting only works with a custom ID, because we cannot choose the HubSpot ID of the newly created object. A good fix would probably be to disable upserting by the HubSpot object ID. I will add that later.
Hello @Zebreus , issue with delete that we do not know if operation was successful, it just returns same value when it deleted object or this object don't exist, and as there are issues with upserting by hubspot ID we should probably disable it. Please let me know when it is ready for review.
I think the behaviour on delete is somewhat expected. A delete operation is successful, if the element does not exist afterwards. This is also the way the HubSpot API does deletion (i.E. https://api.hubapi.com/crm/v3/objects/contact/834872398 returns 204
and not 404
, even if there is no contact with the id 834872398).
@michael-radency This PR is now ready for review again. I disabled upserting with the HubSpot object ID. I also added some resources for Associations, Properties and Property Groups I had already written. Originally it was planned to add these in a separate PR, but I won't be able to spent much time with HubSpot in the future, so it is probably best to include them here.