APIs & Integrations

codeclouds
Participant

How to implement custom abandoned cart?

Hello,

 

I want to implement abandoned cart feature in custom PHP. Can anyone let me know the step by step procedure for this?

0 Upvotes
6 Replies 6
IsaacTakushi
HubSpot Employee
HubSpot Employee

How to implement custom abandoned cart?

Hi, @codeclouds.

 

Could you describe what you mean by "implement abandoned cart feature" in more detail?

 

It sounds like you are building out a custom integration with the Ecommerce Bridge API., but I don't know what stage you are on. Are you already able to create deals in HubSpot by sending sync messages?

 

Have you already created a mapping for the ip__ecomm_bridge__abandoned_cart_url property and are you sending sync messages which include links to the abandoned cart in your system?

Isaac Takushi

Associate Certification Manager
0 Upvotes
codeclouds
Participant

How to implement custom abandoned cart?

I mean to say by "implement abandoned cart feature" is that: we will capture the customer prospect details and cart information. If the customer do not completes the order within a given time (Say 6 hours), we will send a remainder to that customer about that abandoned cart and request to complete the order.

 

Now we have successfully updated the settings using ecommerce bridge API.

 

Then I am trying to sync messsages but betting the following error:

{"message":"This hapikey (REDACTED) has not authorized the required scopes to complete this action, requires all of the following: [integration-sync]. Visit https://developers.hubspot.com/scopes for more information.","correlationId":"11a38979-1126-4575-bf56-66e4e6471fee","requestId":"9bdf5197-fb63-4156-b1d9-01e91213acb3"}

 

Please note: I have already added the scope  "integration-sync" to the app.

 

Here is the data i am sending in put request:

{
  "storeId": "208341",
  "objectType": "CONTACT",
  "messages": [
    {
      "action": "UPSERT",
      "changedAt": "1553486400000",
      "externalObjectId": "1234",
      "properties": {
        "firstname": "Jeff",
        "lastname": "David",
        "email": "test@example.com"
      },
      "associations": {
        "DEAL": [
          "example_dealId"
        ]
      }
    }
  ]
}

 

Can you please help me in this? 

0 Upvotes
codeclouds
Participant

How to implement custom abandoned cart?

Can anyone help me on this? I am still unable to find any solution.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

How to implement custom abandoned cart?

Hi, @codeclouds.

 

Apologies for the delayed response. I have been out of the office.

 

Please do not share API keys. This is a public forum and your key is now compromised. I recommend regenerating your key immediately. I have redacted the key from your previous post.

 

The key you used is likely your developer API key. Developer API keys allow access to app settings in your developer account, but they cannot be used to authenticate ecommerce sync messages or other API requests which manipulate data in normal production accounts.

 

Although you added the integration-sync scope to your "AbandonedCart" app, you cannot use the developer API key to send sync messages. Instead, you must use OAuth tokens, generated through this flow. The OAuth flow is used to install your app in a production or test account.

Isaac Takushi

Associate Certification Manager
0 Upvotes
codeclouds
Participant

How to implement custom abandoned cart?

Okay, got your point.

 

We have gone through the documentation of OAuth2 but this is written for Node.Js

Is there and documentation with rest API?

 

Although I have set up and hit the authorize link as below:

https://app.hubspot.com/oauth/authorize?scope=contacts%20social&redirect_uri=https://www.myurl.com/&...

 

I am getting the following error:

image.png

Can you please check and let me know why this is hapenning.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

How to implement custom abandoned cart?

Hi, @codeclouds.

 

This quickstart guide does use Node.js examples; if you're just interested in the regular REST API requests, you can reference the regular docs below:

  1. Initiate an integration with OAuth 2.0
  2. Get OAuth 2.0 access and refresh tokens (this step only needs to be completed once, when you first connect an app).
  3. Refresh OAuth 2.0 access token (you must repeat this step whenever the access_token expires, but you don't need to go through Step 2 again unless you've lost the refresh_token).

The "Couldn't complete the connection: You don't have permission to connect this integration" error usually indicates a mismatch between the scopes your app requires and the scopes available to the user installing the app.

Which user are you trying to connect with? With the contacts and social scopes, the user must have full access to contacts, companies, deals, lists, and social media channels.

 

You can also bypass this check by giving the user Super Admin access.

Isaac Takushi

Associate Certification Manager
0 Upvotes