1515)
1616
1717from integrations .lead_tracking .hubspot .constants import (
18+ HUBSPOT_API_LEAD_SOURCE_SELF_HOSTED ,
1819 HUBSPOT_FORM_ID ,
1920 HUBSPOT_PORTAL_ID ,
2021 HUBSPOT_ROOT_FORM_URL ,
@@ -111,7 +112,11 @@ def create_contact(
111112 "lastname" : user .last_name ,
112113 "hs_marketable_status" : user .marketing_consent_given ,
113114 }
115+ return self ._create_contact (properties , hubspot_company_id )
114116
117+ def _create_contact (
118+ self , properties : dict [str , Any ], hubspot_company_id : str
119+ ) -> dict [str , str ]:
115120 response = self .client .crm .contacts .basic_api .create (
116121 simple_public_object_input_for_create = SimplePublicObjectInputForCreate (
117122 properties = properties ,
@@ -130,6 +135,17 @@ def create_contact(
130135 )
131136 return response .to_dict () # type: ignore[no-any-return]
132137
138+ def create_self_hosted_contact (
139+ self , email : str , first_name : str , last_name : str , hubspot_company_id : str
140+ ) -> None :
141+ properties = {
142+ "email" : email ,
143+ "firstname" : first_name ,
144+ "lastname" : last_name ,
145+ "api_lead_source" : HUBSPOT_API_LEAD_SOURCE_SELF_HOSTED ,
146+ }
147+ self ._create_contact (properties , hubspot_company_id )
148+
133149 def get_company_by_domain (self , domain : str ) -> dict [str , Any ] | None :
134150 """
135151 Domain should be unique in Hubspot by design, so we should only ever have
0 commit comments