revert icon indicating copy to clipboard operation
revert copied to clipboard

feat: Support for Hubspot associations API

Open majjikishore007 opened this issue 1 year ago • 5 comments

Description

This is the fix for HubSpot CRM to fetch the associates along with the deals by introducing a new parameter associations

Fixes #540

Type of change

  • [x] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Response Before
{
    "status": "ok",
    "results": [
        {
            "amount": 10000,
            "priority": "low",
            "stage": "appointmentscheduled",
            "name": "Books shipment",
            "expectedCloseDate": "2024-05-31T07:09:39.911Z",
            "isWon": false,
            "probability": 0.2,
            "id": "19029182777",
            "remoteId": "19029182777",
            "createdTimestamp": "2024-05-01T07:10:12.688Z",
            "updatedTimestamp": "2024-05-01T07:10:13.905Z",
            "additional": {
                "createdAt": "2024-05-01T07:10:12.688Z",
                "updatedAt": "2024-05-01T07:10:13.905Z",
                "archived": false,
                "closedate": "2024-05-31T07:09:39.911Z",
                "createdate": "2024-05-01T07:10:12.688Z",
                "dealname": "Books shipment",
                "dealstage": "appointmentscheduled",
                "hs_createdate": "2024-05-01T07:10:12.688Z",
                "hs_deal_stage_probability": "0.200000000000000011102230246251565404236316680908203125",
                "hs_is_closed_won": "false",
                "hs_lastmodifieddate": "2024-05-01T07:10:13.905Z",
                "hs_object_id": "19029182777",
                "hs_priority": "low"
            }
        }
    ]
}

Response After
{
    "status": "ok",
    "results": [
        {
            "amount": 10000,
            "priority": "low",
            "stage": "appointmentscheduled",
            "name": "Books shipment",
            "expectedCloseDate": "2024-05-31T07:09:39.911Z",
            "isWon": false,
            "probability": 0.2,
            "id": "19029182777",
            "remoteId": "19029182777",
            "createdTimestamp": "2024-05-01T07:10:12.688Z",
            "updatedTimestamp": "2024-05-01T07:10:13.905Z",
            "additional": {
                "createdAt": "2024-05-01T07:10:12.688Z",
                "updatedAt": "2024-05-01T07:10:13.905Z",
                "archived": false,
                "closedate": "2024-05-31T07:09:39.911Z",
                "createdate": "2024-05-01T07:10:12.688Z",
                "dealname": "Books shipment",
                "dealstage": "appointmentscheduled",
                "hs_createdate": "2024-05-01T07:10:12.688Z",
                "hs_deal_stage_probability": "0.200000000000000011102230246251565404236316680908203125",
                "hs_is_closed_won": "false",
                "hs_lastmodifieddate": "2024-05-01T07:10:13.905Z",
                "hs_object_id": "19029182777",
                "hs_priority": "low",
                "companies": {
                    "results": [
                        {
                            "id": "20573849979",
                            "type": "deal_to_company"
                        },
                        {
                            "id": "20573849979",
                            "type": "deal_to_company_unlabeled"
                        }
                    ]
                },
                "contacts": {
                    "results": [
                        {
                            "id": "17427015520",
                            "type": "deal_to_contact"
                        },
                        {
                            "id": "17440350258",
                            "type": "deal_to_contact"
                        }
                    ]
                }
            }
        }
    ]
}

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules

majjikishore007 avatar May 01 '24 09:05 majjikishore007

@majjikishore007 is attempting to deploy a commit to the OpenInt Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 01 '24 09:05 vercel[bot]

Thank you for following the naming conventions for pull request titles! 🙏

github-actions[bot] avatar May 01 '24 09:05 github-actions[bot]

Hi @jatinsandilya can you give some sample data on how the output should look, thanks.

majjikishore007 avatar May 05 '24 04:05 majjikishore007

Hi @jatinsandilya here is the corrected response after implanting the bulk read API, do let me know if anything needs to be changed thank you

0.associations="contacts,companies"

{
    "status": "ok",
    "results": [
        {
            "amount": 10000,
            "priority": "low",
            "stage": "appointmentscheduled",
            "name": "Books shipment",
            "expectedCloseDate": "2024-05-31T07:09:39.911Z",
            "isWon": false,
            "probability": 0.2,
            "id": "19029182777",
            "remoteId": "19029182777",
            "createdTimestamp": "2024-05-01T07:10:12.688Z",
            "updatedTimestamp": "2024-05-10T16:50:41.180Z",
            "additional": {
                "createdAt": "2024-05-01T07:10:12.688Z",
                "updatedAt": "2024-05-10T16:50:41.180Z",
                "archived": false,
                "closedate": "2024-05-31T07:09:39.911Z",
                "createdate": "2024-05-01T07:10:12.688Z",
                "dealname": "Books shipment",
                "dealstage": "appointmentscheduled",
                "hs_createdate": "2024-05-01T07:10:12.688Z",
                "hs_deal_stage_probability": "0.200000000000000011102230246251565404236316680908203125",
                "hs_is_closed_won": "false",
                "hs_lastmodifieddate": "2024-05-10T16:50:41.180Z",
                "hs_object_id": "19029182777",
                "hs_priority": "low",
                "associations": {
                    "companies": [
                        {
                            "id": "20573849979",
                            "properties": {
                                "createdate": "2024-05-01T05:14:32.516Z",
                                "domain": "hubspot.com",
                                "hs_lastmodifieddate": "2024-05-10T16:50:10.982Z",
                                "hs_object_id": "20573849979",
                                "name": "HubSpot"
                            },
                            "createdAt": "2024-05-01T05:14:32.516Z",
                            "updatedAt": "2024-05-10T16:50:10.982Z",
                            "archived": false
                        },
                        {
                            "id": "20573849979",
                            "properties": {
                                "createdate": "2024-05-01T05:14:32.516Z",
                                "domain": "hubspot.com",
                                "hs_lastmodifieddate": "2024-05-10T16:50:10.982Z",
                                "hs_object_id": "20573849979",
                                "name": "HubSpot"
                            },
                            "createdAt": "2024-05-01T05:14:32.516Z",
                            "updatedAt": "2024-05-10T16:50:10.982Z",
                            "archived": false
                        },
                        {
                            "id": "20741666719",
                            "properties": {
                                "createdate": "2024-05-10T14:49:01.652Z",
                                "domain": "Dell.com",
                                "hs_lastmodifieddate": "2024-05-10T14:57:43.922Z",
                                "hs_object_id": "20741666719",
                                "name": "Dell"
                            },
                            "createdAt": "2024-05-10T14:49:01.652Z",
                            "updatedAt": "2024-05-10T14:57:43.922Z",
                            "archived": false
                        },
                        {
                            "id": "20741759296",
                            "properties": {
                                "createdate": "2024-05-10T14:49:37.288Z",
                                "domain": "google.com",
                                "hs_lastmodifieddate": "2024-05-10T14:57:42.686Z",
                                "hs_object_id": "20741759296",
                                "name": "Google"
                            },
                            "createdAt": "2024-05-10T14:49:37.288Z",
                            "updatedAt": "2024-05-10T14:57:42.686Z",
                            "archived": false
                        }
                    ],
                    "contacts": [
                        {
                            "id": "17587205508",
                            "properties": {
                                "createdate": "2024-05-01T18:16:11.114Z",
                                "email": "[email protected]",
                                "firstname": "neo",
                                "hs_object_id": "17587205508",
                                "lastmodifieddate": "2024-05-01T18:17:28.690Z",
                                "lastname": "kishore"
                            },
                            "createdAt": "2024-05-01T18:16:11.114Z",
                            "updatedAt": "2024-05-01T18:17:28.690Z",
                            "archived": false
                        },
                        {
                            "id": "20238647389",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Alice",
                                "hs_object_id": "20238647389",
                                "lastmodifieddate": "2024-05-10T16:50:44.604Z",
                                "lastname": "Smith"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.604Z",
                            "archived": false
                        },
                        {
                            "id": "20238647390",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "David",
                                "hs_object_id": "20238647390",
                                "lastmodifieddate": "2024-05-10T16:50:44.658Z",
                                "lastname": "Lee"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.658Z",
                            "archived": false
                        },
                        {
                            "id": "20238647391",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Frank",
                                "hs_object_id": "20238647391",
                                "lastmodifieddate": "2024-05-10T16:50:46.280Z",
                                "lastname": "Miller"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:46.280Z",
                            "archived": false
                        },
                        {
                            "id": "20238647392",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Carol",
                                "hs_object_id": "20238647392",
                                "lastmodifieddate": "2024-05-10T16:50:44.629Z",
                                "lastname": "Wilson"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.629Z",
                            "archived": false
                        },
                        {
                            "id": "20238647393",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Bob",
                                "hs_object_id": "20238647393",
                                "lastmodifieddate": "2024-05-10T16:50:44.638Z",
                                "lastname": "Johnson"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.638Z",
                            "archived": false
                        },
                        {
                            "id": "20238647394",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Emma",
                                "hs_object_id": "20238647394",
                                "lastmodifieddate": "2024-05-10T16:50:44.602Z",
                                "lastname": "Taylor"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.602Z",
                            "archived": false
                        }
                    ]
                }
            }
        }
    ]
}
  1. associations=" "
{
    "status": "ok",
    "results": [
        {
            "amount": 10000,
            "priority": "low",
            "stage": "appointmentscheduled",
            "name": "Books shipment",
            "expectedCloseDate": "2024-05-31T07:09:39.911Z",
            "isWon": false,
            "probability": 0.2,
            "id": "19029182777",
            "remoteId": "19029182777",
            "createdTimestamp": "2024-05-01T07:10:12.688Z",
            "updatedTimestamp": "2024-05-10T16:50:41.180Z",
            "additional": {
                "createdAt": "2024-05-01T07:10:12.688Z",
                "updatedAt": "2024-05-10T16:50:41.180Z",
                "archived": false,
                "closedate": "2024-05-31T07:09:39.911Z",
                "createdate": "2024-05-01T07:10:12.688Z",
                "dealname": "Books shipment",
                "dealstage": "appointmentscheduled",
                "hs_createdate": "2024-05-01T07:10:12.688Z",
                "hs_deal_stage_probability": "0.200000000000000011102230246251565404236316680908203125",
                "hs_is_closed_won": "false",
                "hs_lastmodifieddate": "2024-05-10T16:50:41.180Z",
                "hs_object_id": "19029182777",
                "hs_priority": "low",
                "associations": {}
            }
        }
    ]
}

majjikishore007 avatar May 10 '24 17:05 majjikishore007

Hi @jatinsandilya here is the corrected response after implanting the bulk read API, do let me know if anything needs to be changed thank you

0.associations="contacts,companies"

{
    "status": "ok",
    "results": [
        {
            "amount": 10000,
            "priority": "low",
            "stage": "appointmentscheduled",
            "name": "Books shipment",
            "expectedCloseDate": "2024-05-31T07:09:39.911Z",
            "isWon": false,
            "probability": 0.2,
            "id": "19029182777",
            "remoteId": "19029182777",
            "createdTimestamp": "2024-05-01T07:10:12.688Z",
            "updatedTimestamp": "2024-05-10T16:50:41.180Z",
            "additional": {
                "createdAt": "2024-05-01T07:10:12.688Z",
                "updatedAt": "2024-05-10T16:50:41.180Z",
                "archived": false,
                "closedate": "2024-05-31T07:09:39.911Z",
                "createdate": "2024-05-01T07:10:12.688Z",
                "dealname": "Books shipment",
                "dealstage": "appointmentscheduled",
                "hs_createdate": "2024-05-01T07:10:12.688Z",
                "hs_deal_stage_probability": "0.200000000000000011102230246251565404236316680908203125",
                "hs_is_closed_won": "false",
                "hs_lastmodifieddate": "2024-05-10T16:50:41.180Z",
                "hs_object_id": "19029182777",
                "hs_priority": "low",
                "associations": {
                    "companies": [
                        {
                            "id": "20573849979",
                            "properties": {
                                "createdate": "2024-05-01T05:14:32.516Z",
                                "domain": "hubspot.com",
                                "hs_lastmodifieddate": "2024-05-10T16:50:10.982Z",
                                "hs_object_id": "20573849979",
                                "name": "HubSpot"
                            },
                            "createdAt": "2024-05-01T05:14:32.516Z",
                            "updatedAt": "2024-05-10T16:50:10.982Z",
                            "archived": false
                        },
                        {
                            "id": "20573849979",
                            "properties": {
                                "createdate": "2024-05-01T05:14:32.516Z",
                                "domain": "hubspot.com",
                                "hs_lastmodifieddate": "2024-05-10T16:50:10.982Z",
                                "hs_object_id": "20573849979",
                                "name": "HubSpot"
                            },
                            "createdAt": "2024-05-01T05:14:32.516Z",
                            "updatedAt": "2024-05-10T16:50:10.982Z",
                            "archived": false
                        },
                        {
                            "id": "20741666719",
                            "properties": {
                                "createdate": "2024-05-10T14:49:01.652Z",
                                "domain": "Dell.com",
                                "hs_lastmodifieddate": "2024-05-10T14:57:43.922Z",
                                "hs_object_id": "20741666719",
                                "name": "Dell"
                            },
                            "createdAt": "2024-05-10T14:49:01.652Z",
                            "updatedAt": "2024-05-10T14:57:43.922Z",
                            "archived": false
                        },
                        {
                            "id": "20741759296",
                            "properties": {
                                "createdate": "2024-05-10T14:49:37.288Z",
                                "domain": "google.com",
                                "hs_lastmodifieddate": "2024-05-10T14:57:42.686Z",
                                "hs_object_id": "20741759296",
                                "name": "Google"
                            },
                            "createdAt": "2024-05-10T14:49:37.288Z",
                            "updatedAt": "2024-05-10T14:57:42.686Z",
                            "archived": false
                        }
                    ],
                    "contacts": [
                        {
                            "id": "17587205508",
                            "properties": {
                                "createdate": "2024-05-01T18:16:11.114Z",
                                "email": "[email protected]",
                                "firstname": "neo",
                                "hs_object_id": "17587205508",
                                "lastmodifieddate": "2024-05-01T18:17:28.690Z",
                                "lastname": "kishore"
                            },
                            "createdAt": "2024-05-01T18:16:11.114Z",
                            "updatedAt": "2024-05-01T18:17:28.690Z",
                            "archived": false
                        },
                        {
                            "id": "20238647389",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Alice",
                                "hs_object_id": "20238647389",
                                "lastmodifieddate": "2024-05-10T16:50:44.604Z",
                                "lastname": "Smith"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.604Z",
                            "archived": false
                        },
                        {
                            "id": "20238647390",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "David",
                                "hs_object_id": "20238647390",
                                "lastmodifieddate": "2024-05-10T16:50:44.658Z",
                                "lastname": "Lee"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.658Z",
                            "archived": false
                        },
                        {
                            "id": "20238647391",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Frank",
                                "hs_object_id": "20238647391",
                                "lastmodifieddate": "2024-05-10T16:50:46.280Z",
                                "lastname": "Miller"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:46.280Z",
                            "archived": false
                        },
                        {
                            "id": "20238647392",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Carol",
                                "hs_object_id": "20238647392",
                                "lastmodifieddate": "2024-05-10T16:50:44.629Z",
                                "lastname": "Wilson"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.629Z",
                            "archived": false
                        },
                        {
                            "id": "20238647393",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Bob",
                                "hs_object_id": "20238647393",
                                "lastmodifieddate": "2024-05-10T16:50:44.638Z",
                                "lastname": "Johnson"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.638Z",
                            "archived": false
                        },
                        {
                            "id": "20238647394",
                            "properties": {
                                "createdate": "2024-05-10T16:49:33.460Z",
                                "email": "[email protected]",
                                "firstname": "Emma",
                                "hs_object_id": "20238647394",
                                "lastmodifieddate": "2024-05-10T16:50:44.602Z",
                                "lastname": "Taylor"
                            },
                            "createdAt": "2024-05-10T16:49:33.460Z",
                            "updatedAt": "2024-05-10T16:50:44.602Z",
                            "archived": false
                        }
                    ]
                }
            }
        }
    ]
}
  1. associations=" "
{
    "status": "ok",
    "results": [
        {
            "amount": 10000,
            "priority": "low",
            "stage": "appointmentscheduled",
            "name": "Books shipment",
            "expectedCloseDate": "2024-05-31T07:09:39.911Z",
            "isWon": false,
            "probability": 0.2,
            "id": "19029182777",
            "remoteId": "19029182777",
            "createdTimestamp": "2024-05-01T07:10:12.688Z",
            "updatedTimestamp": "2024-05-10T16:50:41.180Z",
            "additional": {
                "createdAt": "2024-05-01T07:10:12.688Z",
                "updatedAt": "2024-05-10T16:50:41.180Z",
                "archived": false,
                "closedate": "2024-05-31T07:09:39.911Z",
                "createdate": "2024-05-01T07:10:12.688Z",
                "dealname": "Books shipment",
                "dealstage": "appointmentscheduled",
                "hs_createdate": "2024-05-01T07:10:12.688Z",
                "hs_deal_stage_probability": "0.200000000000000011102230246251565404236316680908203125",
                "hs_is_closed_won": "false",
                "hs_lastmodifieddate": "2024-05-10T16:50:41.180Z",
                "hs_object_id": "19029182777",
                "hs_priority": "low",
                "associations": {}
            }
        }
    ]
}

Is the association.company here unified as well @majjikishore007 ?

jatinsandilya avatar May 14 '24 09:05 jatinsandilya

@jatinsandilya Yes the association.acompany will be undefined for case: associations=" "

majjikishore007 avatar May 21 '24 04:05 majjikishore007

Hi, @jatinsandilya may I know that, if any more changes are required to do. Please do let me know thanks

majjikishore007 avatar Jun 02 '24 08:06 majjikishore007

@majjikishore007 Thanks for this. Although the association data should be in the unified format as well

jatinsandilya avatar Jun 05 '24 05:06 jatinsandilya

Hi @jatinsandilya the deals are in unified format as well. Please do let me know if any changes needed to be done thank you

majjikishore007 avatar Jul 09 '24 16:07 majjikishore007

Closing as already been contributed by @manish-singh-bisht

Nabhag8848 avatar Aug 06 '24 05:08 Nabhag8848