Ecommerce Bridge - Deal not being associated with contact

Guilty
Member

I have an issue with the Hubspot ecommerce bridge API.

 

I am sending the following data one after the other. 

However it seems to randomly not work, the Deal is always created, however sometimes the product is not associated properly, and very rarely does the contact get associated with the deal.

 

// First sync all the products
{
    "storeId": "5de67dca60b2d",
    "objectType": "PRODUCT",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": 1584996853694,
            "externalObjectId": "rb20",
            "properties": {
                "price": 276.95,
                "product_name": "RB20",
                "product_description": "No description"
            }
        },
        {
            "action": "UPSERT",
            "changedAt": 1584996853694,
            "externalObjectId": "rb200",
            "properties": {
                "price": 2528.95,
                "product_name": "RB200",
                "product_description": "No description"
            }
        }
    ]
}

// Then i create the contact
{
    "storeId": "5de67dca60b2d",
    "objectType": "CONTACT",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": 1584996844266,
            "externalObjectId": "1",
            "properties": {
                "first_name": "jack",
                "last_name": "smith",
                "email": "email@example.com",
                "phone": "555-123-1234",
                "address": "123 fake street",
                "state": "",
                "zip": "12345"
            }
        }
    ]
}


// Then i create the deal
{
    "storeId": "5de67dca60b2d",
    "objectType": "DEAL",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": 1584996854266,
            "externalObjectId": "af6bb9ad66419b2dc008cf73d0c557b5",
            "properties": {
                "name": "Order: af6bb9ad66419b2dc008cf73d0c557b5",
                "stage": "checkout_completed",
                "amount": 276.95
            },
            "associations": {
                "CONTACT": [
                    "1"
                ]
            }
        }
    ]
}

// Then the line items are created
{
    "storeId": "5de67dca60b2d",
    "objectType": "LINE_ITEM",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": 1584996859266,
            "externalObjectId": "3112",
            "properties": {
                "price": 276.95,
                "num_items": 1,
                "tax_amount": 0
            },
            "associations": {
                "DEAL": [
                    "af6bb9ad66419b2dc008cf73d0c557b5"
                ],
                "PRODUCT": [
                    "rb20"
                ]
            }
        }
    ]
}

 

This is my property mapping:

{
    "enabled": true,
    "webhookUri": null,
    "mappings": {
        "CONTACT": {
            "properties": [
                {
                    "externalPropertyName": "first_name",
                    "hubspotPropertyName": "firstname",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "phone",
                    "hubspotPropertyName": "mobilephone",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "last_name",
                    "hubspotPropertyName": "lastname",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "email",
                    "hubspotPropertyName": "email",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "address",
                    "hubspotPropertyName": "address",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "state",
                    "hubspotPropertyName": "state",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "zip",
                    "hubspotPropertyName": "zip",
                    "dataType": "STRING"
                }
            ]
        },
        "DEAL": {
            "properties": [
                {
                    "externalPropertyName": "amount",
                    "hubspotPropertyName": "amount",
                    "dataType": "NUMBER"
                },
                {
                    "externalPropertyName": "date_ordered",
                    "hubspotPropertyName": "closedate",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "abandoned_cart_url",
                    "hubspotPropertyName": "ip__ecomm_bride__abandoned_cart_url",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "stage",
                    "hubspotPropertyName": "dealstage",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "name",
                    "hubspotPropertyName": "dealname",
                    "dataType": "STRING"
                }
            ]
        },
        "PRODUCT": {
            "properties": [
                {
                    "externalPropertyName": "product_name",
                    "hubspotPropertyName": "name",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "product_description",
                    "hubspotPropertyName": "description",
                    "dataType": "STRING"
                },
                {
                    "externalPropertyName": "price",
                    "hubspotPropertyName": "price",
                    "dataType": "NUMBER"
                }
            ]
        },
        "LINE_ITEM": {
            "properties": [
                {
                    "externalPropertyName": "tax_amount",
                    "hubspotPropertyName": "tax",
                    "dataType": "NUMBER"
                },
                {
                    "externalPropertyName": "discount_amount",
                    "hubspotPropertyName": "discount",
                    "dataType": "NUMBER"
                },
                {
                    "externalPropertyName": "num_items",
                    "hubspotPropertyName": "quantity",
                    "dataType": "NUMBER"
                },
                {
                    "externalPropertyName": "price",
                    "hubspotPropertyName": "price",
                    "dataType": "NUMBER"
                }
            ]
        }
    }
}

 

Does anyone know why this randomly does not work at times?

0 Upvotes
1 Reply 1
WendyGoh
HubSpot Employee

Hey @Guilty,

 

When looking at the sync status of the contact object - externalObjectId - 1, I note that it is link to HubSpot contact ID 951. However, it seems that contact 951 has been deleted.

 

For now, I restored contact 951 > send the following ecommerce sync message:

 

 

{
    "storeId": "5de67dca60b2d",
    "objectType": "DEAL",
    "messages": [
        {
            "action": "UPSERT",
            "changedAt": 1584996854266,
            "externalObjectId": "af6bb9ad66419b2dc008cf73d0c557b5",
            "properties": {
                "name": "Order: af6bb9ad66419b2dc008cf73d0c557b5",
                "stage": "checkout_completed",
                "amount": 276.95
            },
            "associations": {
                "CONTACT": [
                    "1"
                ]
            }
        }
    ]
}

and I'm able to see that deal Order: af6bb9ad66419b2dc008cf73d0c557b5 is associated with HubSpot contact ID 951. 

 

Could you try and create another association (without deleting the contact) and see if it works for you? 

 

0 Upvotes