--- tags: done, gluglu, hubspot --- # BUY-2104 - Casavo can recognize buyer leads from casavo listing platform also on Hubspot - https://casavo.atlassian.net/browse/BUY-2104 - https://github.com/casavo/gluglu/pull/438 - https://github.com/casavo/tribe-buyers/wiki/Listing-Platform-vs-Hubspot - nuovo workflow to be completed https://app.hubspot.com/workflows/5259730/platform/flow/229096050/edit - https://github.com/frozencure/twitch-client/tree/master/src/main/kotlin/com/github/frozencure/helix - https://ktor.io/docs/default-request.html#headers ### workflows - [ITALY] Deal Owner Assignation for Direct Sales from Call Schedule - [ITALY] Buyer Lead from FORM - Casavo Listing - [SPAIN] Buyer Lead from FORM - Casavo Listing - [ITALY] On Deals created from Casavo Listing Platform # MARKETING LIST MIGRATION - [x] tutti quelli nella lista Potential Buyers - true marketing checkbox - preferred language dedotta da city del contatto - [x] su gluglu valorizzare nel contatto il marketing checkbox a true se marketing dato - [x] tenere invece aggiunta a lista marketing - [x] far rigirare workflow temporaneo per recuperare storico - https://app.hubspot.com/workflows/5259730/platform/flow/231153449 - [x] togliere dalla lista chi ha checkbox marketing false - [ ] far usare alla lista marketing "checkbox + preferred language" (invece di "presenza lista + city elencate") # NEW WORKFLOW COMPLETING - [x] fix brokered assignation: no owner for brokered - [x] migrate schedule call owner in new workflow - [x] add new email to be sent non present in old workflow - [x] disable old schedule call workflow - [ ] handle brokered in new spain workflow: check label on send email (only to buyer, not to broker) - [ ] handle brokered in new portugal workflow: check label on send email (only to buyer, not to broker) # OLD WORKFLOW DEPRECATION - [ ] old deprecated GLOBAL workflow - [ ] disable - [ ] delete - [ ] old deprecated SPAIN workflow - [x] disable - [ ] delete # OTHER HUBSPOT CLEAN - [ ] delete contact fields related to deal (Last requested listing info) ? - [x] delete old schedule call workflow: https://app.hubspot.com/workflows/5259730/platform/flow/222998283/edit ## # Todo - [ ] Implement `ICrmBridge` interface in new `CrmBridge` - [x] `addBuyerLeadToCrm(CasavoBuyerInformationRequestUseCase.Request, ListingDetails)` - [x] put deal in a different hubspot pipeline for ES and PT - [x] put deal in a different hs pipeline for non-direct (brokered) listings - [x] what about contact `casavo_potential_buyer` field ? --> useless without the workflow - [x] what about contact `hs_language` field ? --> lets populate it with navigation language as legacy HubspotCrm do - [x] what about contact `consent_for_casavo_mortgage_service` field? --> we have it from the request ! - [x] also `CasavoBuyerScheduleCallUseCase` forgot this field - [x] change mortgage consent from nullable boolean to enum with YES/NO/DO_NOT_CHANGE/DO_NOT_KNOW values (?) - reading from hubspot `null` never set, `""` like null but resetted from a previous value - writing: `""` resets the field, `null` do not change the field - [x] get rid of lastName field from domain Contact (?) - [x] what about `buyer_request_reason` DEAL field ? -> si serve - [x] what about the DEAL `consent_for_casavo_mortgage_service` field ?? -> qualche dubbio, ma mettiamo - [x] rename `consentMortgageService` in `mortgageServiceConsent` in domain Contact - [x] also `CasavoBuyerScheduleCallUseCase` forgot this field - [x] what about `phone_number` DEAL field ? -> si serve per gli sms - [ ] ~~what about `interested_in_visit` DEAL field ? should we fill it from the request reason~~ ? -> per ora non mettiamo - [ ] what about contact `date_of_the_last_buyer_lead_for_a_casavo_property` field ? it is set by workflow - [x] `addBookVisitToCrm(BookVisit, ListingDetails)` - [x] remember to put deal in a different hubspot stage of the pipeline (INTERESTED_IN_VISIT) - [ ] ~~remember to put deal in a different hubspot pipeline for ES and PT~~ -> we do not have book visit in ES and PT - [x] remember `preferred_visit_slot_time` (contact) -> `preferred_visit_time` (deal) field - [ ] ~~what about `interested_in_visit` DEAL field ? should we fill it ?~~ -> veniva messo a true fisso in questo usecase e copiato as-is nel deal; quello del contatto veniva usato dal workflow per decidere lo stage in pipeline, quello del deal sembra inutilizzato - [x] kill `calendly` references - [x] `addContactToCrm(furnishingProposalRequest: FurnishingProposalRequest)` (only contact) - [x] `addBuyerLeadToCrm(event: RequestInfoAboutListingReceived)` (only contact) - [x] `ContactAgencyUseCase.Request` should use SupportedLanguage enum - [x] Switch `infrastructure.hubspot.HubspotCrm` user to use new `CrmBridge` - [x] `CasavoBuyerInformationRequestUseCase` for `addBuyerLeadToCrm(CasavoBuyerInformationRequestUseCase.Request, ListingDetails)` - [x] `CasavoBuyerBookVisitUseCase` for `addBookVisitToCrm(BookVisit, ListingDetails)` - [x] `CasavoBuyerFurnishingProposalRequestUseCase` for `addContactToCrm(furnishingProposalRequest: FurnishingProposalRequest)` - [x] `ContactAgencyUseCase` for `addBuyerLeadToCrm(event: RequestInfoAboutListingReceived)` - [ ] update e2e - [x] add new hubspot stub responses - [ ] add some verify assertions? - [x] create new HS workflow to assign deal owner and send the thank you email - [x] direct + brokered + visit + call - [x] third party ? --> finiscono in ramo morto - [x] furnishing ? --> non entravano in workflow senza listing_id - [x] dismiss old HS workflow - [x] Increase contact property `Count of leads` should be removed from Workflow and from contact property - [x] Get rid of `HttpHubspotClient`, `HubspotClient`, `infrastructure.hubspot.HubspotCrm` - [x] check pipeline and stage hubspot ids for non-italian leads (IT_DIRECT_SALES_LEAD_MANAGEMENT_PIPELINE_ID) ## # Improvements - [x] use ContactId typealias in Crm interface - [x] turn dealPipeline and dealStage enums in domain, translated in codes by HubspotCrm - [x] move duplicated pipeline and dealStage constants (i.e. in an enum) - [x] do we really need the default values in Contact and Deal domain objects? - [x] move `gluglu.core.domain.models` classes under `gluglu.core.domain.crm` ? - [x] `HubSpotStub` should not have v1 stub response, except for marketing list add - [x] use `CrmBridge` also in `CasavoBuyerScheduleCallUseCase` instead of `HubspotCrm` directly? - [x] search contact by phone when not found with email ? ---> create separated card ! - [x] rename CrmBridge methods to reflect kind of request (eg. addBuyerLeadForDirectListing addBuyerLeadForBrokered) - [x] `addBookVisitToCrm` could have a better name ! - [ ] hubspot resources ids should be long or strings ? - [ ] could deal properties be non-nullable since we never read values from HS? - [ ] test mapping from domain Deal.Properties to HubspotDeal.Properties - [ ] use visitSlot and CallSlot types instead of String in Deal.Properties domain object - [ ] `casavo_potential_buyer` is used to know if a property is a casavo property or third_party, we should verify if this property is used in the datalake - [ ] should we set `listing_inventory` field in the deal ? (new unused field created by Christian) - it will be used soon in https://github.com/casavo/agata/pull/179 - [ ] rename some Hubspot classes to HubSpot ? at least classes involved in this development - [ ] in v3/HubspotCrmTest move runBlocking at begninning in every tests - [ ] should we unit test `MortgageConsent` enum (now we are testing it through other classes)? ------ ### # AS IS ![](https://i.imgur.com/FFrbUEd.png) ### # TO BE ![](https://i.imgur.com/Wk6ipS9.png)