Skip to content

Commit

Permalink
feat: Add org id to hubspot company (#3680)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachaysan authored Mar 27, 2024
1 parent 88d3012 commit 9952424
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/integrations/lead_tracking/hubspot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def create_contact(self, user: FFAdminUser, hubspot_company_id: str) -> dict:
)
return response.to_dict()

def create_company(self, name: str) -> dict:
properties = {"name": name}
def create_company(self, name: str, organisation_id: int) -> dict:
properties = {"name": name, "orgid": str(organisation_id)}
simple_public_object_input_for_create = SimplePublicObjectInputForCreate(
properties=properties,
)
Expand Down
5 changes: 4 additions & 1 deletion api/integrations/lead_tracking/hubspot/lead_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ def get_or_create_organisation_hubspot_id(self, organisation: Organisation) -> s
if getattr(organisation, "hubspot_organisation", None):
return organisation.hubspot_organisation.hubspot_id

response = self.client.create_company(name=organisation.name)
response = self.client.create_company(
name=organisation.name,
organisation_id=organisation.id,
)
# Store the organisation data in the database since we are
# unable to look them up via a unique identifier.
HubspotOrganisation.objects.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ def test_hubspot_with_new_contact_and_new_organisation(
# Then
organisation.refresh_from_db()
assert organisation.hubspot_organisation.hubspot_id == future_hubspot_id
mock_create_company.assert_called_once_with(name=organisation.name)
mock_create_company.assert_called_once_with(
name=organisation.name, organisation_id=organisation.id
)
mock_create_contact.assert_called_once_with(user, future_hubspot_id)
mock_get_contact.assert_called_once_with(user)

Expand Down

0 comments on commit 9952424

Please sign in to comment.