Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support for Hubspot associations API #552

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

majjikishore007
Copy link
Contributor

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

  • 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:

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

Copy link

vercel bot commented May 1, 2024

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

A member of the Team first needs to authorize it.

Copy link

github-actions bot commented May 1, 2024

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

@majjikishore007 majjikishore007 changed the title feat coupling the associations api with the CRM GET deals api for Hub… feat Support for Hubspot associations API May 1, 2024
@majjikishore007 majjikishore007 changed the title feat Support for Hubspot associations API feat: Support for Hubspot associations API May 1, 2024
Copy link
Contributor

@jatinsandilya jatinsandilya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@majjikishore007 we need the actual contacts or companies data here, not the association data

@majjikishore007
Copy link
Contributor Author

majjikishore007 commented May 5, 2024

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

@majjikishore007
Copy link
Contributor Author

majjikishore007 commented May 10, 2024

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": "neomajji@gmail.com",
                                "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": "alice.smith@hubspot.com",
                                "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": "david.lee@hubspot.com",
                                "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": "frank.miller@hubspot.com",
                                "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": "carol.wilson@hubspot.com",
                                "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": "bob.johnson@hubspot.com",
                                "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": "emma.taylor@hubspot.com",
                                "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": {}
            }
        }
    ]
}

@jatinsandilya
Copy link
Contributor

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": "neomajji@gmail.com",
                                "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": "alice.smith@hubspot.com",
                                "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": "david.lee@hubspot.com",
                                "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": "frank.miller@hubspot.com",
                                "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": "carol.wilson@hubspot.com",
                                "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": "bob.johnson@hubspot.com",
                                "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": "emma.taylor@hubspot.com",
                                "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 ?

@majjikishore007
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ISSUE-REVERT]: Support for Hubspot associations API
2 participants