revert icon indicating copy to clipboard operation
revert copied to clipboard

[ISSUE-REVERT]: Support for Hubspot associations API

Open cmdrGuyson opened this issue 2 years ago • 10 comments

Describe the feature Currently there is no way to access associations between different hubspot data objects.

For example given a deal entity identify all contacts associated with that deal.

Accessing associations in bulk (batches) would also be useful as it is a common use case to get associations of multiple objects in one API call.

Additional context Hubspot Associations API documentation - https://developers.hubspot.com/docs/api/crm/associations

cmdrGuyson avatar Apr 08 '24 11:04 cmdrGuyson

A functionality that will be really useful would be coupling the associations api with the CRM GET apis. For example, while using the /crm/deals GET endpoint, being able to pass another query param called associations containing string of comma separated objects to be associated with the primary object.

curl -G https://api.revert.dev/crm/deals \
     -H "x-revert-api-token: string" \
     -H "x-revert-t-id: string" \
     -H "x-api-version: string" \
     -d fields=string \
     -d associations="contacts" \
     -d pageSize=string 

which will give a response like below,

{
  "status": "ok",
  "results": [
    {
      "amount": 0,
      "createdTimestamp": {},
      "expectedCloseDate": {},
      "id": "string",
      "isWon": true,
      "name": "string",
      "probability": 0,
      "remoteId": "string",
      "stage": "string",
      "updatedTimestamp": {},
      "additional": {},
      "priority": "string"
      "contacts": [...list of contacts associated with deal]
    }
  ],
  "next": "string",
  "previous": "string"
}

cmdrGuyson avatar Apr 09 '24 04:04 cmdrGuyson

~~## 💎 $40 bounty • Revert~~

~~### Steps to solve:~~ ~~1. Start working: Comment /attempt #540 with your implementation plan~~ ~~2. Submit work: Create a pull request including /claim #540 in the PR body to claim the bounty~~ ~~3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts~~

~~Thank you for contributing to revertinc/revert!~~

~~Add a bountyShare on socials~~

Attempt Started (GMT+0) Solution
🟢 @majjikishore007 Apr 27, 2024, 5:29:27 AM WIP
🟢 @ashutoshdhande Apr 30, 2024, 2:22:26 AM WIP
🟢 @bibhuty-did-this May 6, 2024, 11:32:28 AM WIP
🟢 @manish-singh-bisht #548

algora-pbc[bot] avatar Apr 22 '24 10:04 algora-pbc[bot]

/attempt #540

Options

majjikishore007 avatar Apr 27 '24 05:04 majjikishore007

/attempt #540

Options

ashutoshdhande avatar Apr 30 '24 02:04 ashutoshdhande

@majjikishore007

Here the request can contain the association parameter with a comma seperated set of fields such as contacts,companies or only one contacts.

The API response should have the associated contacts or companies or another association data in the additional block like this:

{
  "additional" : {
    "associations" : {
	"contacts: '{...}'
   }
  }
}

For multiple associations requested the response should look like this:

{
  "additional" : {
    "associations" : {
          "contacts": '{...}',
	  "companies: '{...}',
    }
  }
}

If the request does not have associations in the request query the response should look like this:

{
  "additional" : {}
}

Please follow this request & response structure for the PR, thanks!

jatinsandilya avatar May 01 '24 10:05 jatinsandilya

got it @jatinsandilya will update the pr accordingly thanks

majjikishore007 avatar May 01 '24 10:05 majjikishore007

🎉🎈 @manish-singh-bisht has been awarded $40! 🎈🎊

algora-pbc[bot] avatar May 06 '24 09:05 algora-pbc[bot]

this bounty awarded is not for this issue, it was for different issue.

the bounty for this issue is still valid.

🎉🎈 @manish-singh-bisht has been awarded $40! 🎈🎊

* [Share on socials](https://console.algora.io/awards/clvurv8iy0002me09kpvkl1yy)

* [Give feedback](https://console.algora.io/claims/clvurv8iy0002me09kpvkl1yy)

manish-singh-bisht avatar May 06 '24 10:05 manish-singh-bisht

/attempt #540

Options

bibhuty avatar May 06 '24 11:05 bibhuty

@jatinsandilya here is the sample response given in the docs for a batch read request

{
  "completedAt": "2024-05-10T14:16:40.773Z",
  "requestedAt": "2024-05-10T14:16:40.773Z",
  "startedAt": "2024-05-10T14:16:40.773Z",
  "links": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  },
  "results": [
    {
      "from": {
        "id": "37295"
      },
      "to": {
        "id": "37295"
      },
      "type": "contact_to_company"
    }
  ],
  "status": "PENDING"
}

could you please specify how the final response should look, as you mentioned you need the actual data of contacts and companies

majjikishore007 avatar May 10 '24 14:05 majjikishore007