Ecommerce Bridge API, need help on some basic questions


#1

I am sorry if these are basic questions but i need to get cleared on them.
How can i create a contact and submit deals data along with line items and products using Ecommerce Bridge API? If i need to do that using Contact and Forms API, where comes the role of Ecommerce Bridge API?

Also, what is difference between "custom integration" and "implementing an ecommerce bridge application". Which category my scenario will fall when i am developing a system to synchronise data from Magento to HubSpot? If i need to implement ecommerce bridge application, is "import" process for synchronising current data?
I am sure these are basic question but i couldn't make my mind clear on them by reading documentiona. Thank you very much in advance for the help!


Integration of Ecommerce Bridge API: does not have proper permissions! (requires all of [portal-developers-access])
#3

Hi @ahsan,

Happy to clarify.

The Ecommerce Bridge allows you to create, update, and delete contacts, deals, products, and line items without having to use those dedicated APIs.

For example, to create a contact once you've installed app or the ecommerce settings and configured your property mappings, you could send a sync message like the example below:

PUT https://api.hubapi.com/extensions/ecomm/v1/sync-messages/CONTACT?hapikey=demo

[
  {
    "integratorObjectId": "123",
    "action": "UPSERT",
    "changeOccurredTimestamp": 1540481935000,
    "propertyNameToValues": {
      "your_first_name_field": "Brian",
      "your_email_field": "bh@hubspot.com"
    }
  }
]

You could also create a deal with a sync message like:

PUT https://api.hubapi.com/extensions/ecomm/v1/sync-messages/DEAL?hapikey=demo

[
  {
    "integratorObjectId": "456",
    "action": "UPSERT",
    "changeOccurredTimestamp": 1540481935000,
    "propertyNameToValues": {
      "your_deal_stage_field": "new",
      "your_deal_amount_field": 100
    }
  }
]

This is all done through the Ecommerce Bridge; you don't have to use the Contacts API and Deals API separately.

Are you developing a system for only your organization to use, or do you want or need to share it with other HubSpot users? If the system is only for internal use, you can develop a custom integration. If you plan to develop an app that can be used by others, then you will need to implement an OAuth Ecommerce Bridge application. If you are implementing an app, then yes, the import process syncs current data.

I should note that are existing Ecommerce Bridge apps that support Magento. You may be interested in using the following:


#4

Thank you Isaac for answering questions. Many things got clear!

How it goes when i need to do property mapping through settings for Ecommerce bridge?
Isn't it required for E commerce bridge installed app to upsert ecommerce settings (/extensions/ecomm/v1/settings)?
If i try to do that while providing hapikey (https://api.hubapi.com/extensions/ecomm/v1/settings?hapikey=my-hapi-key&appId=182707), i get following response:
{
"status": "error",
"message": "Request implies conflicting values for hub-id: 5051097 from [hapikey (...5d8bd)] vs. 5051184 from oauth-token (...AHwX)",
"requestId": "6966fe1118d8cf46aea6b3f901032ae1",
"correlationId": "590b049d-d2a9-49c5-8799-13e2daf8e86d"
}
When i try to create a contact through sync-message, i receive following response:
{
"status": "error",
"message": "Ecommerce Bridge settings not set up",
"requestId": "59da3fc504c803771438d06682d3877d",
"correlationId": "e110eced-f21c-4c42-90c2-c992cd836afc"
}

I am sorry but need help as it confusing to follow any step-by-step process. Can you please guide?
Thanks!


#5

I am sorry Issac for bothering you again, any idea what can be wrong?


#6

Hi @ahsan,

Yes, you must upsert ecommerce settings to app 182707 using this endpoint.

I confirmed your app's settings were blank with this endpoint and uploaded one mapping as a test. Can you try the GET endpoint with the hapikey ending in 5d8bd and appId=182707? The endpoint should return:

{
    "enabled": false,
    "importOnInstall": true,
    "productSyncSettings": {
        "properties": [
            {
                "propertyName": "my_name_field",
                "dataType": "STRING",
                "targetHubspotProperty": "name"
            }
        ]
    },
    "dealSyncSettings": {
        "properties": []
    },
    "lineItemSyncSettings": {
        "properties": []
    },
    "contactSyncSettings": {
        "properties": []
    }
}

If you get this, then you know the hapikey you are using is correct.

Once you verify this, can you share the settings you are trying to upload? I will try to upload them myself to see if I can replicate the issue above.

Note: Please do not publish your API key or OAuth tokens here. This is a public forum. I have edited your last post for security.