APIs & Integrations

gillytech
Contributor

ECommerce Bridge - Can't add new pipeline stage

I have installed ECommerce Bridge into my portal.

I have successfully mapped all my properties for Deals and Contacts.

Now have completed all my sync message handling in my app and they all work. Deal stages can be changed, etc. The only problem now is that when I add a new Pipeline Stage to the Ecommerce Pipeline it's not recognized in the Ecommerce Bridge API sync message api.

The pipeline stage I have tried to add is checkout_errored. That's the internal id for the stage I created. When I try to use this in a sync message I get:

{
    "portalId": 4253638,
    "objectType": "DEAL",
    "integratorObjectId": "d6637d65-a809-4266-953b-1c566c2a780f",
    "changeOccurredTimestamp": 1548120193758,
    "errorTimestamp": 1548120194864,
    "type": "INVALID_DEAL_STAGE",
    "details": "Deal stage SyncHadoopHubspotPropertyValue{hubspotPropertyName=dealstage, propertyValue=checkout_errored, timestamp=1548120193758} is not valid for portal SyncKey{objectType=DEAL, portalId=0000000, settingsId=2518, externalObjectId=d6637d65-a809-4266-953b-1c566c2a780f}",
    "status": "OPEN"
}

As an additional note, if I edit the cancelled stage the behavior in the Deals UI changes, instead of the empty dots in the "stage bar" it's checkmarks all the way through. I just re-installed the Ecommerce Bridge settings via the API and everything returned to normal.

So now I am suspicious that there is some special mapping that occurs between ECommerce Sync API <==> Deals API. Is there a way to add a deal stage that I can sync to through the ECommerce Bridge API Sync Message?

0 Upvotes
12 Replies 12
zaklein
Contributor | Diamond Partner
Contributor | Diamond Partner

ECommerce Bridge - Can't add new pipeline stage

Hi @gillytech 

cc @IsaacTakushi & @Zibi

 

I stumbled across this post, looking for the same kind of solution re: programmatic use of customised deal stages for Ecommerce Bridge.

 

While the problem that you encountered in 2019 seems to have remained unchanged, I've tested and confirmed a workaround that might be of interest to others. It enables you to use custom Ecommerce deal stages, while still referencing external system record IDs:

  1. Create a new deal stage within the auto-created "Ecommerce" Deal pipeline (HubSpot Web UI > Settings > Objects > Deals > Pipelines > "Add a deal stage" (take note of the "Internal id" generated after you create the deal stage)
  2. Create a new property via the "Create a property" API endpoint (it's important you do this via the API, not the web UI). This will be used to store your external Deal / order record IDs.
    • Be sure to set the hasUniqueValue field to true, as per instructions under the "Creating your own unique identifiers" heading on this HubSpot API doc. This will enable you to update Deal records using your external record IDs (as is the standard when using Ecommerce Bridge).
    • Note that the hasUniqueValue property setting can only be configured at the time of property creation (i.e. you can't update an existing property's hasUniqueValue setting)
    • Update your ecommerce settings to account for the newly created property.
  3. Populate the newly created property with data for all relevant Deals (lots of options to do this --> e.g. via Ecommerce Bridge send sync messages, CSV upload, HubSpot workflow, manually in web UI etc.). Also, consider adjusting your continuous sync to account for this new property.
  4. Finally, use HubSpot's CRM API to move any relevant Ecommerce Deals into your custom deal stage, using the external system ID property you created in Step 2 (i.e. rather than the internal HubSpot record ID). You can do this via the "Update" Deals API endpoint. For example:
{
    "properties": {
        "dealstage": "YOUR_NEW_DEALSTAGE_INTERNAL_ID"
    }
}

 

I hope it proves helpful. Let me know if you have any follow up questions.

 

All the best,

Zach

gillytech
Contributor

ECommerce Bridge - Can't add new pipeline stage

@zaklein Thank you so much for the lengthy and clear instructions. Sorry I wasn't able to check this out until now. I'll need to crack open the project and see if I can implement it. This solution does look good though.

gillytech
Contributor

ECommerce Bridge - Can't add new pipeline stage

Yeah I'd rather not give you my production stuff to test on. Here you can have my test account, no problem:

Portal ID: 5305039

The checkout_errored stage is added to the ecommerce pipeline. And the internal id is dc0af5e6-5fd8-4b00-b81e-141fcc640aff

Try using ecommerce sync messages to move deals into that stage and let me know what you find!

0 Upvotes
Zibi
Participant

ECommerce Bridge - Can't add new pipeline stage

Hi @IsaacTakushi,

 

I have similar problem. I have added custom deal stages to Ecommerce Pipeline using following endpoint:

PUT https://api.hubapi.com/crm-pipelines/v1/pipelines/deal/

{
	"label": "Ecommerce Pipeline",
	"displayOrder": 2,
	"active": true,
	"stages": [{
			"stageId": "shipped",
			"label": "Shipped",
			"displayOrder": 2,
			"metadata": {
				"isClosed": "true",
				"probability": "1.0"
			},
			"active": true
		}, {
			"stageId": "delivered",
			"label": "Delivered",
			"displayOrder": 4,
			"metadata": {
				"isClosed": "true",
				"probability": "1.0"
			},
			"active": true
		}, {
			"stageId": "cancelled",
			"label": "Cancelled",
			"displayOrder": 5,
			"metadata": {
				"isClosed": "true",
				"probability": "0.0"
			},
			"active": true
		}, {
			"stageId": "new",
			"label": "New",
			"displayOrder": 1,
			"metadata": {
				"isClosed": "false",
				"probability": "0.3"
			},
			"active": true
		}, {
			"stageId": "inproduction",
			"label": "InProduction",
			"displayOrder": 6,
			"metadata": {
				"isClosed": "true",
				"probability": "1.0"
			},
			"active": true
		}, {
			"stageId": "productiondone",
			"label": "Production Done",
			"displayOrder": 7,
			"metadata": {
				"isClosed": "true",
				"probability": "1.0"
			},
			"active": true
		}, {
			"stageId": "draft",
			"label": "Draft",
			"displayOrder": 3,
			"metadata": {
				"isClosed": "false",
				"probability": "0.3"
			},
			"active": true
		}
	]
}

I am able to use these deal stages in HubSpot UI, but it does not work with sync_messeges endpoint. It fails with incorect deal stage error:

 

{
    "storeId": "default",
    "objectType": "DEAL",
    "externalObjectId": "CO190612-00102",
    "hubspotId": 821015495,
    "lastProcessedAt": 1560432424103,
    "errors": [
        {
            "portalId": 5940484,
            "storeId": "default",
            "objectType": "DEAL",
            "externalObjectId": "CO190612-00102",
            "changedAt": 1560343166193,
            "erroredAt": 1560432423939,
            "type": "INVALID_DEAL_STAGE",
            "details": "Deal stage SyncHadoopHubspotPropertyValue{hubspotPropertyName=dealstage, propertyValue=new, timestamp=1560343166193} is not valid for portal SyncKey{objectType=DEAL, portalId=5940484, settingsId=3760, externalObjectId=CO190612-00102}",
            "status": "OPEN"
        }
    ]
}

Here is my sync-messeges request:

PUT https://api.hubapi.com/extensions/ecomm/v1/sync-messages/deal

[{
		"integratorObjectId": "CO190612-00102",
		"action": "UPSERT",
		"changeOccurredTimestamp": "1560343166193",
		"propertyNameToValues": {
			"order_name": "CO190612-00102",
			"order_number": "CO190612-00102",
			"status": "draft",
			"hs_assoc__contact_ids": "test",
			"store_id": "norway",
			"language_code": "en-US",
			"currency": "NOK",
			"estimated_delivery_date": "22/02/2020",
			"shipment_tracking_id": "5345345",
			"shipment_tracking_url": "www.gls.com/track=5345345"
		}
	}
]

 

 

 

0 Upvotes
Zibi
Participant

ECommerce Bridge - Can't add new pipeline stage

Hi @gillytech, have you resolved this issue?

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

ECommerce Bridge - Can't add new pipeline stage

I'm so sorry for dropping the ball on this, @gillytech. Please be sure to tag me with @IsaacTakushi in future messages so I don't miss anything.

 

@gillytech and @Zibi, at this time, the Ecommerce Bridge does not support custom dealstage values.

 

Per the Automatic account setup section of this article, all deals created through the Ecommerce Bridge must be placed in one of the six default deal stages:

  1. checkout_abandoned
  2. checkout_pending
  3. checkout_completed
  4. checkout_completed
  5. processed
  6. shipped
  7. cancelled
Apologies for the inconvenience and confusion around this.

Isaac Takushi

Associate Certification Manager
gillytech
Contributor

ECommerce Bridge - Can't add new pipeline stage

Hey @IsaacTakushi thanks for getting back to us on this. I have moved on since this problem was encountered. It's a shame that custom stages wasn't part of the feature set of ecommerce bridge. If we can get that in as a feature request I would be much obliged

 

@Zibi, Unfortunatley no, I wasn't able to solve this. Basically making due with what we got on the default stages. 

0 Upvotes
Zibi
Participant

ECommerce Bridge - Can't add new pipeline stage

@gillytech Thank you for your response. We also used default stages and renamed them. 

Definitely feature request for custom stages for ecommerce bridge should be created.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

ECommerce Bridge - Can't add new pipeline stage

Hey, @gillytech.

I'm happy to run some tests. First, though, can you:

  1. Add the checkout_errored stage back to your Ecommerce Pipeline. It's not currently present.
  2. Share your app ID.

Isaac Takushi

Associate Certification Manager
0 Upvotes
gillytech
Contributor

ECommerce Bridge - Can't add new pipeline stage

Did you get anywhere with your own testing?

0 Upvotes
gillytech
Contributor

ECommerce Bridge - Can't add new pipeline stage

Hi @Isaac_Takushi,

You got it wrong but that's ok. Lets go over this again so we're both on the same page.

I am not trying to create a deal stage with a sync message. I tried both methods of creating the deal stage checkout_errored. One was through the UI which gave me a UUID (the long 36 character alnum string) and I also tried using the CRM Pipelines API. I successfully created the new deal stage both times.

And both times, I tried to move a deal into the checkout_errored stage (or the equivalent UUID identifier) using the ecomm sync message API and both times I got back the aforementioned error. That the deal stage ___ was not valid for our portal.

To me I think this is simply an engineering issue. My concept of the problem is that there is a missing mapping between what I am submitting and what is getting through ECommerce Bridge. Do you follow?

For instance, I need to map my properties between my app's fields and the filed names in HubSpot (for Contacts, Deals, Products, etc), right? And I think when you install the ECommerce Bridge in the portal you get the predefined deal stages installed and already mapped. So is there a way to map the new deal stage within ECommerce Bridge?

You should do some testing on that and let me know your conclusion and how we're going to handle it.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

ECommerce Bridge - Can't add new pipeline stage

Hi, @gillytech.

Please correct me if I'm missing something, but are you trying to add a deal stage to your Ecommerce Pipeline with an ecommerce sync message?

If so, this is not possible to do with a sync message, which can only manipulate CONTACT, DEAL, PRODUCT, and LINE_ITEM objects — not pipeline objects.

I see two options to modify the Ecommerce Pipeline in a given account:

  1. Add the stage manually in the UI, but you'll then have to use this endpoint with the deals object type to see the stage's internal name, as it won't be checkout_errored, but a long alphanumeric string.
  2. Use this CRM Pipelines API endpoint where you can add a "Checkout Errored" stage to the Ecommerce Pipeline and set its internal name to checkout_errored.

If I'm misunderstanding you and you're simply trying to move a deal into the checkout_errored deal stage with a sync message, you're receiving that error because your Ecommerce Pipeline currently has no stage with that internal name. I only see five stages, none of which are named "Checkout Errored."

Isaac Takushi

Associate Certification Manager
0 Upvotes