APIs & Integrations

Walter_Anderson
Member

ECommerce Bridge - line items with the same integratorObjectId

I'm seeing some odd behavior around deleting/adding/updating line items that are attached to a deal using the Sync Messages API, and was hoping to get some clarification on if this behavior is intentional, or whether or not this is a bug.

The behavior has to do with deleting an associated line item from a deal, and then re-adding it to that same deal. For context, in this example we are using the Deals entities to represent (e-commerce) subscriptions, with the line items representing the products in that subscription. This can change any time the customer wants to modify their subscription.

So here's the scenario: User deletes product foo from their subscription, then changes their mind and re-adds product foo back to their subscription.

Deleting foo from the deal:

  {
    "integratorObjectId": "376161:107",
    "action": "DELETE",
    "changeOccurredTimestamp": 1531850442256,
    "propertyNameToValues": {}
  },

Re-adding foo to the deal:

{
    "integratorObjectId": "376161:107",
    "action": "UPSERT",
    "changeOccurredTimestamp": 1531850456725,
    "propertyNameToValues": {
      "associated_product_id": 107,
      "associated_order_id": 376161,
      "quantity": 1
    }
  }

What I'm seeing is the line item does not get re-added to the deal. The initial API request returns a success response, and the sync errors endpoint does not return any related errors. I suspect the reason has to do with the fact that I'm using the same integratorObjectId. In our system we don't actually have a unique identifier to represent these line items, so I used a combination of the order ID and the product ID.

Would this be considered expected behavior? Do I need to alter my implementation and assign these line items unique identifiers?

Thanks

0 Upvotes
14 Replies 14
sduane
HubSpot Product Team
HubSpot Product Team

ECommerce Bridge - line items with the same integratorObjectId

Currently, there is no way to "recover" an integratorObjectID except to recreate the deleted object.

I can definitely consider some workarounds at some point. Maybe you should be able to determine the internal hubspot ID? Maybe you should be able to say "force resync this" which creates a new object?

0 Upvotes
mkloepfel
Participant

ECommerce Bridge - line items with the same integratorObjectId

Sorry for digging up this old thread, but this problem still persists to this day. The earlier comments in this thread suggest deletions via sync messages, but this isn't possible with V2 of the Ecommerce Bridge at all as stated by the docs:

Please note that the DELETE action type will not remove the object from HubSpot, it will prevent it from syncing in the future.

In my tests, V1 seems to behave the same way though. This means that it's neither possible to delete records via the Ecommerce Bridge nor can the Bridge deal with deletions from any other source.

 

I also don't quite understand how one would programatically make use of the suggested way to "recover" an external ID:

Currently, there is no way to "recover" an integratorObjectID except to recreate the deleted object.

As far as I understand, the Ecommerce Bridge just maps an external ID to an internal ID, which would mean that an object with the same internal ID would need to be created in order to "recover" an external ID this way. However, as far as I know, one cannot influence the internal ID when creating an object via any API.

 

Regarding the other suggestions that were made:

Maybe you should be able to determine the internal hubspot ID?

In V2, this is possible using the Check the sync status of an object endpoint, but it doesn't really help that much, either. It would be possible to build a workaround based on this and the dedicated APIs for the individual record types, but it defeats the purpose of the Ecommerce Bridge being a "everything under one roof" API and would require workaround API requests for every sync message.

 

Maybe you should be able to say "force resync this" which creates a new object?

Generally speaking, yes, it would be great if the Bridge could handle this itself (so this would need to be a "force resync this if it doesn't exist anymore" flag to not require manual checks beforehand). However, I personally don't think that a flag would be necessary as I can't really see any scenario in which the current behavior would be desirable - sync messages are basically just ignored if the record was deleted somehow and this doesn't seem useful to me under any circumstances. Instead, I think the Bridge should just check if the internal record still exists and behave like it does for new records (with external IDs that it didn't know before) if the internal record was deleted (performing the email deduplication check for contacts, creating the "new" record, re-mapping the external ID to the new record).

 

To summarize: it would be really nice if the Ecommerce Bridge was "aware" of all kinds of deletions and it would be even nicer if the Ecommerce Bridge itself would offer a way to delete records.

0 Upvotes
tylerbeckert
Member

ECommerce Bridge - line items with the same integratorObjectId

I understand what was stated above, about Sync respecting objects deleted manually, but is there a way to re-use the integratorObjectID from an object that was manually deleted?

0 Upvotes
bting
HubSpot Product Team
HubSpot Product Team

ECommerce Bridge - line items with the same integratorObjectId

Bumping this up for Tyler, please let us know if this is working as expected @Sean_Duane!

0 Upvotes
tylerbeckert
Member

ECommerce Bridge - line items with the same integratorObjectId

I am having an issue with Products created using the Sync Messages API.

I deleted the products by hand within the HubSpot portal, and now I can not UPSERT a product using the same integratorObjectID from the previously deleted product via the Sync Messages API now.

I have verified this variable is the cause, because when I change integratorObjectID the product is created.

0 Upvotes
sduane
HubSpot Product Team
HubSpot Product Team

ECommerce Bridge - line items with the same integratorObjectId

@Walter_Anderson Well that was a fun fix!

Objects deleted via sync should now be able to be created anew via sync, moving forward, as of today.

Give it a shot and let me know if it works as expected?

Walter_Anderson
Member

ECommerce Bridge - line items with the same integratorObjectId

@Sean_Duane Thanks for the update, I'll keep an eye on this post.

0 Upvotes
sduane
HubSpot Product Team
HubSpot Product Team

ECommerce Bridge - line items with the same integratorObjectId

@Walter_Anderson Finally getting to this.

I can confirm that objects deleted via sync are not able to be recreated via sync.

I have a plan to fix this.
This fix will maintain what I said before - Objects deleted outside of sync (via api, via ui) cannot be resynced until recreated (manually, via api)

0 Upvotes
Walter_Anderson
Member

ECommerce Bridge - line items with the same integratorObjectId

@Sean_Duane any updates here?

0 Upvotes
sduane
HubSpot Product Team
HubSpot Product Team

ECommerce Bridge - line items with the same integratorObjectId

@Walter_Anderson Hey, sorry for taking so long. I've been preoccupied with other items, so this will have to be a next week fix.

0 Upvotes
Walter_Anderson
Member

ECommerce Bridge - line items with the same integratorObjectId

Hey @Sean_Duane, just wanted to follow up and see what the status is on this issue.

0 Upvotes
Walter_Anderson
Member

ECommerce Bridge - line items with the same integratorObjectId

@Sean_Duane Yes, /ecomm/v1/sync-messages/LINE_ITEM is the endpoint I am using for the sync messages above.

0 Upvotes
sduane
HubSpot Product Team
HubSpot Product Team

ECommerce Bridge - line items with the same integratorObjectId

@Walter_Anderson Yeah that doesn't sound right then.

Sync messages will respect objects deleted outside of the sync (e.g. via the Hubpot UI or API), but it should be able to resync something that was deleted via sync.

I'll look into it tomorrow/early next week

0 Upvotes
sduane
HubSpot Product Team
HubSpot Product Team

ECommerce Bridge - line items with the same integratorObjectId

Just to clarify, when you send that first delete sync, it's against the LINE_ITEM endpoint, right?

0 Upvotes