Some fields aren't updated when sending an UPSERT

Highlighted
New Contributor

When I send some sync messages to the API, the contact or deal is created/updated, but certain fields stay empty even if I'm sending what I believe are the correct properties. For example, I send this to the API:

PUT https://api.hubapi.com/extensions/ecomm/v2/sync/messages?hapikey=blah
{
  "storeId": "test-store",
  "objectType": "CONTACT",
  "messages": [
    {
      "action": "UPSERT",
      "externalObjectId": "bob.smith@example.com",
      "properties": {
        "firstname": "Bob",
        "lastname": "Smith",
        "customer_email": "bob.smith@example.com",
        "school_name": "",
        "phone_number": "1234567890",
        "address": "1234 Cherry Lane",
        "city": "Columbus",
        "state": "OH",
        "zip": "43212",
        "country": "US",
        "ip__ecomm_bridge__ecomm_synced": "true",
        "ip__ecomm_bridge__source_store_id": "test-store"
      }
    }
  ]
}

I get a 204 No Content in reply, I check the sync status and it says no errors. I check the contact, and some fields are changed, but firstname, lastname and the address fields (address, city, state, zip, country) are still empty on the contact. I checked the object properties and mappings, and I think those are the correct properties, but they still don't work.

Another example:

PUT https://api.hubapi.com/extensions/ecomm/v2/sync/messages?hapikey=blah
{
  "storeId": "test-store",
  "objectType": "DEAL",
  "messages": [
    {
      "action": "UPSERT",
      "externalObjectId": "237622",
      "properties": {
        "name": "237622",
        "purchase_date": 1573768786000,
        "dealtype": "order",
        "stage": "checkout_completed",
        "amount": 64.5,
        "ip__ecomm_bridge__ecomm_synced": "true",
        "ip__ecomm_bridge__source_store_id": "test-store"
      },
      "associations": {
        "CONTACT": [
          "bob.smith@example.com"
        ]
      }
    }
  ]
}

On the deal, dealtype and amount don't work. Again, I've checked all the things I could think of that I might be doing wrong, but it seems right and still doesn't work.

Reply
0 Upvotes
10 Replies 10
Regular Advisor | Silver Partner

Hi @nanderson 

 

Have you tried your code with an OAuth setp?

 

While the HAPI Key should work it's only used for testing and *not* production code.

 

I've had issues before where the HAPI Key didn't work... although I'd expect an error other than 204.

 

Have fun

Mike

New Contributor

Hi @Mike_Eastwood, no I didn't try OAuth. The Ecommerce Bridge Overview page says that "Note: When developing a custom solution for an individual HubSpot account, the OAuth token can be omitted and the API key for that account should be used instead." I'm doing this for an individiual Hubspot account, so it seems that the HAPI key is the way to go. The developers.hubspot.com page also says that the HAPI key should be used for custom solutions for a specific business.

 

I might have to end up trying OAuth, but I don't want to make that the first option. Thanks for replying though!

Reply
0 Upvotes
Regular Advisor | Silver Partner

Hi @nanderson 

 

If HubSpot says the API Token works it *should* work.

 

Do you use Postman for Testing? Postman will help you simulate the API Call and give you more transparency over any errors.

 

Have fun

Mike

Reply
0 Upvotes
New Contributor

@Mike_Eastwood I have a similiar tool, yeah. I get a 204 No Content response from the API, which seems to be what's expected. And then when I check the sync status of the object, it indicates that there are no errors. But when I look at the First Name and Last Name fields on the contact, there's nothing there.

Reply
0 Upvotes
Regular Advisor | Silver Partner

Hey @nanderson 

 

I would check the nesting of the data in your arrays/objects.

 

I have had issues before where I was mistakenly 1 level too deep (or too shallow) with my nesting so it would update the data as null.

 

Hard to explain but worht checking.

Mike

Reply
0 Upvotes
Community Manager

Hey @nanderson ,

 

Can you post your property mappings? It sounds like mappings might be missing/misconfigured for some of those properties. On a cursory look, `firstname` and `lastname` are the internal property name of the default "First name" and "Last name" properties. However sending sync messages that include internal HubSpot property names directly isn't supported; you still need to create a mapping for those properties.

Reply
0 Upvotes
New Contributor

@Derek_Gervais That was a big part of the problem, thank you! I thought that the mappings were just for convenience, I didn't realize they were required. Once I added those, everything worked except for address, city, state, zip and country on the contact.

 

My mappings for those are below: 

"CONTACT": {
      "properties": [
        {
          "externalPropertyName": "city",
          "hubspotPropertyName": "city",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "school_name",
          "hubspotPropertyName": "company",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "customer_email",
          "hubspotPropertyName": "email",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "state",
          "hubspotPropertyName": "state",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "first_name",
          "hubspotPropertyName": "firstname",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "country",
          "hubspotPropertyName": "country",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "phone_number",
          "hubspotPropertyName": "phone",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "name",
          "hubspotPropertyName": "customer_name",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "last_name",
          "hubspotPropertyName": "lastname",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "postal",
          "hubspotPropertyName": "zip",
          "dataType": "STRING"
        },
        {
          "externalPropertyName": "street",
          "hubspotPropertyName": "address",
          "dataType": "STRING"
        }
      ]
    }

I tried changing the mappings to have the external name be different from the internal name, in case that was a problem, so I'm now sending something like this for the mapping above:

{
  "storeId": "test-store",
  "objectType": "CONTACT",
  "messages": [
    {
      "action": "UPSERT",
      "externalObjectId": "bob.smith@example.com",
      "properties": {
        "first_name": "Bob",
        "last_name": "Smith",
        "customer_email": "bob.smith@example.com",
        "school_name": "",
        "phone_number": "5311234567",
        "street": "65 S Front St",
        "city": "Columbus",
        "state": "OH",
        "postal": "43215",
        "country": "US",
        "ip__ecomm_bridge__ecomm_synced": "true",
        "ip__ecomm_bridge__source_store_id": "stenhouse-test-store"
      }
    }
  ]
}

I also tried both real and fake addresses, in case it was verifying the address before inserting, but neitiher worked.

Reply
0 Upvotes
Community Manager

Hey @nanderson ,

 

Apologies for the delay here. If you're seeing issues with specific properties, my guess is that there's some more information we can glean from the sync errors. Can you give me the Hub ID of the portal(s) you're working in, and some example contacts that you're seeing issues with? I'm happy to help dig into these.

Reply
0 Upvotes
New Contributor

Hi @Derek_Gervais, if the Hub ID is the number in the profile menu, then it's 5618249. The contact I've been testing with is nick.anderson@highlights.com. I did try doing a GET on https://api.hubapi.com/extensions/ecomm/v2/sync/status/stenhouse-test-store/CONTACT/nick.anderson@hi... to see if there were any sync errors, but the errors array was always empty. 

Reply
0 Upvotes
Community Manager

Hey @nanderson ,

 

I really appreciate your patience here. I dug into the logs we have on our end, as well as your account's sync settings and the status of the object in question. I'm not seeing any particular issue in your configuration, but I am noticing two things:

  1. It looks like you're sending the value 'US' for the 'country' property, which is an enumeration, but the value you want is actually 'United States'. You can check out this sync error here: extensions/ecomm/v2/sync/status/stenhouse-test-store/CONTACT/nick.anderson@highlights.com
  2. The last sync message for that specific contact was sent a few weeks ago; this isn't an issue in and of itself, but it does make it a bit harder to dig in on my end. Could you send another sync message (identical to the one above) and see if it works? If it does, awesome! If not, I'll have a much more recent example to investigate.

 

Again, I really appreciate your patience here, and I'm looking forward to getting to the bottom of this so that you can get up and running with the Ecommerce Bridge API!

Reply
0 Upvotes