Api reference
components.growth.public.api ¶
Growth component public API.
This module consolidates all public exports from the growth component. External code should import from this module rather than internal modules.
Accountant
dataclass
¶
CustomerIOEmailCaptureEventName ¶
DocumentReviewIndividualParams
dataclass
¶
DocumentReviewParams
dataclass
¶
DocumentReviewParams(
proposal_id,
ccn_code,
company_siren,
company_name,
plan_id,
health_start_date,
participation,
contract_cover_option,
legacy_health_contract,
choose_prevoyance,
legacy_prevoyance_contract,
)
EmailCaptureData
dataclass
¶
GrowthIntercomHandlerService ¶
Service to handle Intercom webhook events for Growth tracking. Only handles user_replied and admin_replied topics.
handle_topic
staticmethod
¶
Handle Intercom topics for Growth tracking.
Source code in components/growth/internal/services/growth_intercom_handler_service.py
GrowthUser
dataclass
¶
InboundSalesTeam
dataclass
¶
Bases: DataClassJsonMixin
Represents an inbound sales team / crew for a specific country
IndividualDocumentReviewEvent
dataclass
¶
IndividualDocumentReviewEvent(
proposal_id,
health_start_date_timestamp,
primary_price,
primary_age,
has_legacy_health_contract,
document_review_version="1",
)
Bases: DataClassJsonMixin
MarketingEventParameters
dataclass
¶
MarketingEventParameters(
utms,
all_utms,
clids,
facebook,
alan_partner_code,
referring_user_token,
referring_partner,
cookie_status,
version,
landing_referrer_url,
landing_page_url,
device_type=None,
)
Bases: DataClassJsonMixin, DataClassJsonAlanMixin
__post_init__ ¶
Truncate all string fields to appropriate max lengths.
Source code in components/growth/internal/entities/prospect.py
PersonaType ¶
Bases: AlanBaseEnum
Marketing persona types (mirrors frontend PersonaType).
ProspectEventContractSignedProperties
dataclass
¶
Bases: DataClassJsonMixin
Properties for contract signed events.
ProspectEventManager ¶
Static class for creating prospect events in the database.
create_prospect_event
staticmethod
¶
create_prospect_event(
email,
event_name,
country_code,
persona_type,
marketing_parameters,
event_properties,
create_prospect_if_not_exists=True,
commit=False,
)
Create a prospect event in the database.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_account_creation
staticmethod
¶
Dispatch account creation event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_call_hungup
staticmethod
¶
Dispatch sales inbound call hung up event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_contact_sales
staticmethod
¶
on_contact_sales(
email,
country_code,
persona_type,
properties,
marketing_parameters,
commit=True,
)
Dispatch meeting request event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_contract_signed
staticmethod
¶
Dispatch contract signed event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_flow_capture_screen
staticmethod
¶
Dispatch flow capture contact event (email capture).
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_intercom_admin_replied
staticmethod
¶
Dispatch sales inbound mail/chat replied event based on tags.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_intercom_user_replied
staticmethod
¶
Dispatch sales inbound mail/chat sent event based on tags.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_nurturing_mail_clicked
staticmethod
¶
Dispatch nurturing mail clicked event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_nurturing_mail_read
staticmethod
¶
Dispatch nurturing mail read event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_nurturing_mail_sent
staticmethod
¶
Dispatch nurturing mail sent event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_page_view
staticmethod
¶
Dispatch page view event for known prospects only.
Marketing parameters are only stored if different from the last recorded parameters for this prospect (across any event type).
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_quote_request
staticmethod
¶
Dispatch quote request event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
on_website_capture_form
staticmethod
¶
on_website_capture_form(
email,
country_code,
persona_type,
marketing_parameters,
properties=None,
commit=True,
)
Dispatch website capture form event.
Source code in components/growth/internal/business_logic/prospect/prospect_event_manager.py
ProspectFactory ¶
ProspectRequestType
module-attribute
¶
ProspectRequestType = Literal[
"meeting_request",
"callback",
"email",
"chat",
"account_creation_stuck",
"quote_request",
"email_capture",
]
QuoteRequestData
dataclass
¶
QuoteRequestData(
*,
customer_io_event_name,
customer_io_event_attributes,
should_be_sent_to_crm,
quote_details,
self_serve_flow_id
)
Bases: DataClassJsonMixin
ReferralType
module-attribute
¶
SELF_SERVE_PROPOSAL_EXPIRES_AFTER_IN_DAYS
module-attribute
¶
clean_phone_number ¶
Clean a phone number by removing all non-digit characters and keeping the country code if it exists. Returns null if cleaned number is too short.
Source code in components/growth/internal/business_logic/crm/utils/phone_number.py
create_attribution_signature_success ¶
Source code in components/growth/internal/business_logic/crm/fr/attribution.py
create_or_retrieve_self_serve_health_plan ¶
create_or_retrieve_self_serve_health_plan(
coverage_level, siren, ccn_code, target_population="all"
)
Create a Plan from the top builder product for a given company and coverage level
Retrieve the existing Plan if it has already been created Raise an error if the builder product were not created
Returns the Plan id
Source code in components/growth/internal/business_logic/self_serve/fr/actions/company_health.py
extract_marketing_parameters_from_params ¶
Extract marketing parameters from params dict if present.
Source code in components/growth/internal/entities/prospect.py
get_accountant_by_email ¶
Source code in components/growth/internal/business_logic/accountant/fr/get_accountant.py
get_accounting_firm_landing_page_link ¶
get_livestorm_replay_url ¶
Get the replay URL for a given Livestorm session ID from Public API.
Source code in components/growth/internal/business_logic/crm/lead_generation_resources.py
individual_paid_acquisition_contract_conversion_value ¶
Source code in components/growth/internal/business_logic/crm/fr/attribution.py
is_alaner_inbound_sales ¶
Source code in components/growth/internal/business_logic/crm/user_and_roles.py
is_assigned_to_inbound_sales ¶
Returns True if the inbox_id parameter is one of the Inbound Sales inbox for the selected country
Source code in components/growth/internal/business_logic/crm/intercom.py
load_growth_settings ¶
Load all growth settings to the database, used for flask data init
Source code in components/growth/internal/helpers/data_init.py
notify_company_document_review ¶
Source code in components/growth/internal/business_logic/crm/fr/notify_document_review.py
notify_individual_document_review ¶
Source code in components/growth/internal/business_logic/crm/fr/notify_document_review.py
notify_intercom_on_contract_signature ¶
Source code in components/growth/internal/business_logic/crm/actions/notify_intercom_on_contract_signature.py
notify_nurturing_company_contract_signature ¶
notify_nurturing_company_contract_signature(
user_id,
approver_email,
company_id,
products,
contract_id=None,
)
Source code in components/growth/internal/business_logic/crm/fr/notify_contract_signature.py
notify_nurturing_individual_contract_signature ¶
notify_nurturing_individual_contract_signature(
user_id,
approver_email,
segment_for_slack_message,
persona_type,
siren_or_siret=None,
contract_id=None,
)
Source code in components/growth/internal/business_logic/crm/fr/notify_contract_signature.py
paid_acquisition_contract_conversion_value ¶
paid_acquisition_contract_conversion_value(
coverage_level=None, ccn_code=None, has_prevoyance=False
)
Source code in components/growth/internal/business_logic/crm/fr/attribution.py
prospect_conversation_detect_duplicates ¶
This function will try to detect if Lead/Prospect have started several conversation, it will rely on both the fact that we have a Prospect object, but also if the conversation are owned by a Inbound Sales alaner or if the conversation was in the Lead Inbox.
We will also try to detect when a conversation is open via multiple prospect for the SIREN, it actually happens quite a lot, we can have the HR that come ask some questions, but then when the CEO is ready to sign they might ask new questions.
Source code in components/growth/internal/business_logic/crm/fr/conversation_detect_duplicates.py
register_new_prospect ¶
Register a new prospect in the database. If the prospect already exists, it will update the phone number and attribution survey if provided.
Source code in components/growth/internal/business_logic/prospect/register_new_prospect.py
retrieve_eligible_prevoyance_offers_from_account_id ¶
Source code in components/growth/internal/business_logic/self_serve/fr/queries/company_prevoyance.py
retrieve_eligible_prevoyance_offers_from_company_id ¶
Conditions to meet: - Active Health Contract - No Active Prevoyance Contract - No suspended Prevoyance contract - No Tailored offer in the account
Return only self-serve prevoyance offers (if there are some for the CCN)
Source code in components/growth/internal/business_logic/self_serve/fr/queries/company_prevoyance.py
submit_contact_form ¶
Source code in components/growth/internal/business_logic/crm/fr/push_sales_contact.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
submit_form_to_hubspot ¶
submit_form_to_hubspot(
portal_id,
form_id,
fields,
ip_address,
page=None,
marketing_parameters=None,
)
Submit form to hubspot API
Source code in components/growth/internal/business_logic/crm/hubspot.py
unsubscribe_email ¶
Unsubscribe user or prospect from commercial emails.
Return success. Note that in the failure case, it's important that we return the same value (False) whether it's the email that does not exist or the token which is incorrect. This is because we don't want a snooper to be able to deduce the email addresses in our system by brute forcing this function.
Source code in components/growth/internal/business_logic/prospect/fr/commercial_emails_unsubscription.py
unsubscribe_email_without_token ¶
Unsubscribe user or prospect from commercial emails.
WARNING: This doesn't require a token, and should only be called in a context where we're sure the request is legit. (eg webhook)
Source code in components/growth/internal/business_logic/prospect/fr/commercial_emails_unsubscription.py
components.growth.public.dependencies ¶
GrowthDependency ¶
Bases: ABC
create_conversation_context
abstractmethod
¶
Implement create_conversation_context
Source code in components/growth/internal/business_logic/dependencies/growth_dependency.py
get_company_quote_request_data
abstractmethod
¶
get_company_quote_request_data(
language,
phone_number,
firstname,
lastname,
company_name,
number_of_employees,
qualification,
)
Implement get_company_quote_request_event
Source code in components/growth/internal/business_logic/dependencies/growth_dependency.py
get_email_capture_event_data
abstractmethod
¶
Implement get_company_email_capture_event_data
get_extra_tags_for_country
abstractmethod
¶
Implement get_extra_tags_for_country
get_inbound_sales_team
abstractmethod
¶
get_intercom_admin_id_from_user_id
abstractmethod
¶
get_persona_type_via_flow_id
abstractmethod
¶
get_prospects_emails_from_phone_number
abstractmethod
¶
Implement get_prospects_emails_from_phone_number
get_self_serve_flow_id_from_qualification
abstractmethod
¶
Implement get_self_serve_flow_id_from_qualification
get_user
abstractmethod
¶
get_user_from_email
abstractmethod
¶
get_user_from_intercom_admin_id
abstractmethod
¶
Implement get_user_from_intercom_admin_id
is_admin_sales
abstractmethod
¶
is_request_likely_for_care
abstractmethod
¶
Implement is_request_likely_for_care it should return a tuple with: - a bool if the request is likely for care - a str with the reason if the request is likely for care
Source code in components/growth/internal/business_logic/dependencies/growth_dependency.py
register_prospect
abstractmethod
¶
register_prospect(
email,
phone=None,
attribution_survey_source=None,
qualification_raw_company=None,
qualification_raw_individual=None,
qualification_raw_website=None,
)
Implement register_prospect
Source code in components/growth/internal/business_logic/dependencies/growth_dependency.py
send_unauthenticated_user_async_message_to_intercom
abstractmethod
¶
Implement send_unauthenticated_user_async_message_to_intercom
Source code in components/growth/internal/business_logic/dependencies/growth_dependency.py
set_app_growth_dependency ¶
Set the growth dependency in the current app context