Checks each new inquiry against who you sell to, sends good ones to the right rep in Slack with a reply drafted, and parks the rest.

UsesClaudeApolloGmailGoogle SheetsHubSpotSlackZeroBounce

Route every new sales inquiry to the right rep

Every two minutes, new rows on the 'New leads' tab of your spreadsheet are picked up. Throwaway and undeliverable addresses are dropped, the company is matched against accounts you already own, and the AI reads what the person wrote to judge how well they fit who you sell to and how ready they are to talk. A good lead goes to the rep who owns the account, or to the next available rep in turn, is added to HubSpot and is posted in Slack mentioning that rep, with a reply drafted. Leads in no hurry are posted for nurture, partners and existing customers for someone to pick up, and pitches, job seekers, students and spam are recorded and left out.

When the AI is unsure what an inquiry is, it still goes to a person, flagged to be read first, though a throwaway or undeliverable address is always dropped. Every lead is written to the 'Ledger' tab, which is how none is handled twice; up to 10 are handled per run and the run says how many are still waiting. If Slack, the AI, HubSpot, a Gmail draft or the Ledger fails, the run is marked failed and names the leads.

You need Google Sheets, Slack, Anthropic and HubSpot connected, plus ZeroBounce and Apollo if you want addresses checked and companies looked up, and Gmail if replies should also be saved as drafts. You also need a spreadsheet with 'New leads', 'Accounts', 'Reps' and 'Ledger' tabs, and five settings filled in: who you sell to, who you do not, the spreadsheet link, the Slack channel and your booking link.

Run every 2 minutes.Run every 2 minutes.
Set whoYouSellTo to blank.Set whoYouSellTo to blank.
Set whoYouDoNotSellTo to blank.Set whoYouDoNotSellTo to blank.
Set spreadsheetUrl to blank.Set spreadsheetUrl to blank.
Set slackChannelId to blank.Set slackChannelId to blank.
Set bookingLink to blank.Set bookingLink to blank.
Set formNamesThatMeanTalkToSalesNow to “Request a demo,Contact sales,Pricing inquiry”.Set formNamesThatMeanTalkToSalesNow to “Request a demo,Contact sales,Pricing inquiry”.
Set replyMode to “slack”.Set replyMode to “slack”.
Set replyWithinMinutes to 5.Set replyWithinMinutes to 5.
Set loadedNewLeads to a record of status, headers, rows, and count.Set loadedNewLeads to a record of status, headers, rows, and count.
Set loadedAccounts to a record of status, headers, rows, and count.Set loadedAccounts to a record of status, headers, rows, and count.
Set loadedReps to a record of status, headers, rows, and count.Set loadedReps to a record of status, headers, rows, and count.
Set loadedLedger to a record of status, headers, rows, and count.Set loadedLedger to a record of status, headers, rows, and count.
If a step below fails, save the error as sheetErrorIf a step below fails, save the error as sheetError
Try
Google SheetsGoogle SheetsRead the rows of spreadsheetUrl. Save it as loadedNewLeads.Read the rows of spreadsheetUrl. Save it as loadedNewLeads.
Google SheetsGoogle SheetsRead the rows of spreadsheetUrl. Save it as loadedAccounts.Read the rows of spreadsheetUrl. Save it as loadedAccounts.
Google SheetsGoogle SheetsRead the rows of spreadsheetUrl. Save it as loadedReps.Read the rows of spreadsheetUrl. Save it as loadedReps.
Google SheetsGoogle SheetsRead the rows of spreadsheetUrl. Save it as loadedLedger.Read the rows of spreadsheetUrl. Save it as loadedLedger.
On error
Stop and report a problem: Could not read the lead spreadsheet. It needs four tabs named exactly 'New leads', 'Accounts', 'Reps' and 'Ledger', and the connected Google Sheets account must have access to it. Run the 'Inbound lead workspace setup' template to build one correctly. The underlying error was: sheetError.message.Stop and report a problem: Could not read the lead spreadsheet. It needs four tabs named exactly 'New leads', 'Accounts', 'Reps' and 'Ledger', and the connected Google Sheets account must have access to it. Run the 'Inbound lead workspace setup' template to build one correctly. The underlying error was: sheetError.message.
Set freeMailDomains to “gmail.com,googlemail.com,yahoo.com,hotmail.com,outlook.com,live.com,aol.com,icloud.com,me.com,proton.me,protonmail.com,gmx.com,mail.com,yandex.com,zoho.com,hey.com”.Set freeMailDomains to “gmail.com,googlemail.com,yahoo.com,hotmail.com,outlook.com,live.com,aol.com,icloud.com,me.com,proton.me,protonmail.com,gmx.com,mail.com,yandex.com,zoho.com,hey.com”.
Set throwawayDomains to “mailinator.com,10minutemail.com,guerrillamail.com,tempmail.com,trashmail.com,yopmail.com,sharklasers.com,dispostable.com,maildrop.cc”.Set throwawayDomains to “mailinator.com,10minutemail.com,guerrillamail.com,tempmail.com,trashmail.com,yopmail.com,sharklasers.com,dispostable.com,maildrop.cc”.
Set roleAddressPrefixes to “info,sales,support,admin,contact,hello,help,noreply,no-reply,billing,office,team,marketing,careers,jobs,hr,press,legal,webmaster,postmaster”.Set roleAddressPrefixes to “info,sales,support,admin,contact,hello,help,noreply,no-reply,billing,office,team,marketing,careers,jobs,hr,press,legal,webmaster,postmaster”.
If loadedNewLeads.rows isn't empty and loadedNewLeads.headers doesn't contain…If loadedNewLeads.rows isn't empty and loadedNewLeads.headers doesn't contain…
Yes
Stop and report a problem: The 'New leads' tab is missing required column headers. Row 1 must contain exactly these, spelled and capitalized this way: Submission ID, Form, Name, Email, Company, Message. Run the 'Inbound lead workspace setup' template to build the sheet correctly.Stop and report a problem: The 'New leads' tab is missing required column headers. Row 1 must contain exactly these, spelled and capitalized this way: Submission ID, Form, Name, Email, Company, Message. Run the 'Inbound lead workspace setup' template to build the sheet correctly.
No
No steps
If loadedLedger.headers doesn't contain “Submission ID” or loadedLedger.headers…If loadedLedger.headers doesn't contain “Submission ID” or loadedLedger.headers…
Yes
Stop and report a problem: The 'Ledger' tab needs its heading row before the first run: it is how the workflow knows which leads it has already handled. Row 1 must read, in this order: Submission ID, Processed At, Email, Domain, Company, Decision, Reason Code, Fit Tier, Intent Tier, Intent Class, Confidence, ICP Score, Routed To, Routed To Slack ID, Routing Rule, SLA Due, Claimed At, Next Touch At, Touches Sent, Evidence, Reasoning. The 'Inbound lead workspace setup' template writes it for you.Stop and report a problem: The 'Ledger' tab needs its heading row before the first run: it is how the workflow knows which leads it has already handled. Row 1 must read, in this order: Submission ID, Processed At, Email, Domain, Company, Decision, Reason Code, Fit Tier, Intent Tier, Intent Class, Confidence, ICP Score, Routed To, Routed To Slack ID, Routing Rule, SLA Due, Claimed At, Next Touch At, Touches Sent, Evidence, Reasoning. The 'Inbound lead workspace setup' template writes it for you.
No
No steps
Keep each item in loadedNewLeads.rows where item["Submission ID"] isn't blank and item.Email contains “@” and save it as leadsWithAnAddress.Keep each item in loadedNewLeads.rows where item["Submission ID"] isn't blank and item.Email contains “@” and save it as leadsWithAnAddress.
Compare leadsWithAnAddress with loadedLedger.rows, matching by “Submission ID” and save it as comparedWithLedger.Compare leadsWithAnAddress with loadedLedger.rows, matching by “Submission ID” and save it as comparedWithLedger.
Remove duplicates of “Submission ID” from comparedWithLedger.only_in_first and save it as newLeads.Remove duplicates of “Submission ID” from comparedWithLedger.only_in_first and save it as newLeads.
Take the first 10 items of newLeads and save it as leadsThisRun.Take the first 10 items of newLeads and save it as leadsThisRun.
Take newLeads from item 11 on and save it as leadsForNextRun.Take newLeads from item 11 on and save it as leadsForNextRun.
Keep each item in loadedLedger.rows where item["Routing Rule"] in lowercase is “round robin” and save it as earlierRoundRobinLeads.Keep each item in loadedLedger.rows where item["Routing Rule"] in lowercase is “round robin” and save it as earlierRoundRobinLeads.
Count the items in earlierRoundRobinLeads and save it as roundRobinTurn.Count the items in earlierRoundRobinLeads and save it as roundRobinTurn.
Set leadProblems to an empty list.Set leadProblems to an empty list.
Set routedThisRun to 0.Set routedThisRun to 0.
Set droppedThisRun to 0.Set droppedThisRun to 0.
For each lead in leadsThisRun:For each lead in leadsThisRun:
If a step below fails, save the error as leadErrorIf a step below fails, save the error as leadError
Try
Trim lead["Submission ID"] and save it as submissionId.Trim lead["Submission ID"] and save it as submissionId.
If submissionId is emptyIf submissionId is empty
Yes
Skip to the next item.Skip to the next item.
No
No steps
TextMake lead.Email lowercase and save it as leadEmail.Make lead.Email lowercase and save it as leadEmail.
If leadEmail doesn't contain “@”If leadEmail doesn't contain “@”
Yes
Show in the output: Skipped submission submissionId: no usable email address.Show in the output: Skipped submission submissionId: no usable email address.
Skip to the next item.Skip to the next item.
No
No steps
Get the first item of leadEmail split by “@” and save it as emailLocalPart.Get the first item of leadEmail split by “@” and save it as emailLocalPart.
Get the last item of leadEmail split by “@” and save it as emailDomain.Get the last item of leadEmail split by “@” and save it as emailDomain.
Trim lead.Company and save it as statedCompany.Trim lead.Company and save it as statedCompany.
Trim lead.Name and save it as leadName.Trim lead.Name and save it as leadName.
Trim lead.Message and save it as leadMessage.Trim lead.Message and save it as leadMessage.
Trim lead.Form and save it as formName.Trim lead.Form and save it as formName.
TextMake statedCompany with “,” replaced by “” with “.” replaced by “” with “ Inc” replaced by “” with “ Ltd” replaced by “” with “ LLC” replaced by “” lowercase and save it as companyKey.Make statedCompany with “,” replaced by “” with “.” replaced by “” with “ Inc” replaced by “” with “ Ltd” replaced by “” with “ LLC” replaced by “” lowercase and save it as companyKey.
Check whether ,freeMailDomains, contains ,emailDomain, and save it as isFreeMailDomain.Check whether ,freeMailDomains, contains ,emailDomain, and save it as isFreeMailDomain.
Check whether ,throwawayDomains, contains ,emailDomain, and save it as isThrowawayDomain.Check whether ,throwawayDomains, contains ,emailDomain, and save it as isThrowawayDomain.
Check whether ,roleAddressPrefixes, contains ,emailLocalPart, and save it as isRoleAddress.Check whether ,roleAddressPrefixes, contains ,emailLocalPart, and save it as isRoleAddress.
Set emailStatus to “unchecked”.Set emailStatus to “unchecked”.
Set emailTypoSuggestion to blank.Set emailTypoSuggestion to blank.
If a step below fails, save the error as verifyErrorIf a step below fails, save the error as verifyError
Try
ZeroBounceZeroBounceVerify the email address leadEmail. Save it as emailCheck.Verify the email address leadEmail. Save it as emailCheck.
Trim emailCheck.status and save it as emailStatus.Trim emailCheck.status and save it as emailStatus.
Trim emailCheck.did_you_mean and save it as emailTypoSuggestion.Trim emailCheck.did_you_mean and save it as emailTypoSuggestion.
On error
Show in the output: Could not verify leadEmail - continuing without a deliverability check. verifyError.message.Show in the output: Could not verify leadEmail - continuing without a deliverability check. verifyError.message.
Keep each item in loadedAccounts.rows where isFreeMailDomain is no and item.Domain in lowercase is emailDomain and save it as accountMatches.Keep each item in loadedAccounts.rows where isFreeMailDomain is no and item.Domain in lowercase is emailDomain and save it as accountMatches.
If accountMatches is empty and companyKey isn't emptyIf accountMatches is empty and companyKey isn't empty
Yes
Keep each item in loadedAccounts.rows where item["Account Name"] in lowercase is companyKey and save it as accountMatches.Keep each item in loadedAccounts.rows where item["Account Name"] in lowercase is companyKey and save it as accountMatches.
No
No steps
Get the first item of accountMatches and save it as matchedAccount.Get the first item of accountMatches and save it as matchedAccount.
Set hasAccountMatch to the length of accountMatches is greater than 0.Set hasAccountMatch to the length of accountMatches is greater than 0.
Set accountOwnerEmail to blank.Set accountOwnerEmail to blank.
Set accountOwnerSlackId to blank.Set accountOwnerSlackId to blank.
Set accountIsCustomer to false.Set accountIsCustomer to false.
Set accountHasOpenDeal to false.Set accountHasOpenDeal to false.
If hasAccountMatch is yesIf hasAccountMatch is yes
Yes
TextMake matchedAccount["Owner Email"] lowercase and save it as accountOwnerEmail.Make matchedAccount["Owner Email"] lowercase and save it as accountOwnerEmail.
Trim matchedAccount["Owner Slack ID"] and save it as accountOwnerSlackId.Trim matchedAccount["Owner Slack ID"] and save it as accountOwnerSlackId.
Change accountIsCustomer to matchedAccount["Is Customer"] in lowercase is “yes”.Change accountIsCustomer to matchedAccount["Is Customer"] in lowercase is “yes”.
Change accountHasOpenDeal to matchedAccount["Open Opportunity"] in lowercase is “yes”.Change accountHasOpenDeal to matchedAccount["Open Opportunity"] in lowercase is “yes”.
No
No steps
Keep each item in loadedLedger.rows where isFreeMailDomain is no and item.Domain in lowercase is emailDomain and… and save it as sameDomainRecently.Keep each item in loadedLedger.rows where isFreeMailDomain is no and item.Domain in lowercase is emailDomain and… and save it as sameDomainRecently.
Set isBuyingGroup to the length of sameDomainRecently is greater than 0.Set isBuyingGroup to the length of sameDomainRecently is greater than 0.
Set enrichedTitle to blank.Set enrichedTitle to blank.
Set enrichedCompany to statedCompany.Set enrichedCompany to statedCompany.
Set enrichedEmployees to blank.Set enrichedEmployees to blank.
Set enrichedIndustry to blank.Set enrichedIndustry to blank.
If a step below fails, save the error as enrichErrorIf a step below fails, save the error as enrichError
Try
ApolloApolloEnrich person leadEmail. Save it as personEnrichment.Enrich person leadEmail. Save it as personEnrichment.
Trim personEnrichment.person.title and save it as enrichedTitle.Trim personEnrichment.person.title and save it as enrichedTitle.
On error
Show in the output: Could not look up the person behind leadEmail - judging on the form alone. enrichError.message.Show in the output: Could not look up the person behind leadEmail - judging on the form alone. enrichError.message.
If isFreeMailDomain is noIf isFreeMailDomain is no
Yes
If a step below fails, save the error as orgErrorIf a step below fails, save the error as orgError
Try
ApolloApolloEnrich organization emailDomain. Save it as companyEnrichment.Enrich organization emailDomain. Save it as companyEnrichment.
Set org to companyEnrichment.organization.Set org to companyEnrichment.organization.
Trim org.name and save it as enrichedCompany.Trim org.name and save it as enrichedCompany.
Trim org.estimated_num_employees and save it as enrichedEmployees.Trim org.estimated_num_employees and save it as enrichedEmployees.
Trim org.industry and save it as enrichedIndustry.Trim org.industry and save it as enrichedIndustry.
On error
Show in the output: Could not look up the company at emailDomain. orgError.message.Show in the output: Could not look up the company at emailDomain. orgError.message.
No
No steps
If enrichedTitle is “null”If enrichedTitle is “null”
Yes
Change enrichedTitle to blank.Change enrichedTitle to blank.
No
No steps
If enrichedEmployees is “null”If enrichedEmployees is “null”
Yes
Change enrichedEmployees to blank.Change enrichedEmployees to blank.
No
No steps
If enrichedIndustry is “null”If enrichedIndustry is “null”
Yes
Change enrichedIndustry to blank.Change enrichedIndustry to blank.
No
No steps
If emailStatus is “null”If emailStatus is “null”
Yes
Change emailStatus to blank.Change emailStatus to blank.
No
No steps
If emailTypoSuggestion is “null”If emailTypoSuggestion is “null”
Yes
Change emailTypoSuggestion to blank.Change emailTypoSuggestion to blank.
No
No steps
If enrichedCompany is “null” or enrichedCompany is emptyIf enrichedCompany is “null” or enrichedCompany is empty
Yes
Change enrichedCompany to statedCompany.Change enrichedCompany to statedCompany.
No
No steps
Set icpFitScore to “not scored”.Set icpFitScore to “not scored”.
Set icpFitReason to blank.Set icpFitReason to blank.
If a step below fails, save the error as icpErrorIf a step below fails, save the error as icpError
Try
Run an AI agent: Score how well this company fits our ideal customer profile. Company: enrichedCompany We… and save it as icpCheck.Run an AI agent: Score how well this company fits our ideal customer profile. Company: enrichedCompany We… and save it as icpCheck.
Change icpFitScore to icpCheck.output.score.Change icpFitScore to icpCheck.output.score.
Trim icpCheck.output.reason and save it as icpFitReason.Trim icpCheck.output.reason and save it as icpFitReason.
On error
Show in the output: The company fit check did not run. icpError.message.Show in the output: The company fit check did not run. icpError.message.
Check whether ,formNamesThatMeanTalkToSalesNow, in lowercase contains ,formName, in lowercase and save it as isHighIntentForm.Check whether ,formNamesThatMeanTalkToSalesNow, in lowercase contains ,formName, in lowercase and save it as isHighIntentForm.
Set leadDossier to WHO WE SELL TO:Set leadDossier to WHO WE SELL TO: whoYouSellTo WHO WE DO NOT SELL TO: whoYouDoNotSellTo --- THE INQUIRY --- Form: formName plus High-intent form: isHighIntentForm plus Name: leadName Email: leadEmail Email domain: emailDomain plus Free-mail address: isFreeMailDomain Throwaway address: isThrowawayDomain Role address (info@, sales@): isRoleAddress plus Deliverability: emailStatus Company as typed: statedCompany Company enriched: enrichedCompany Employees: enrichedEmployees Industry: enrichedIndustry Title: enrichedTitle ICP fit score (0-100, from a separate check): icpFitScore Already a known account: hasAccountMatch plus Already a customer: accountIsCustomer Has an open deal: accountHasOpenDeal Others from this company inquired recently: isBuyingGroup plus WHAT THEY WROTE: leadMessage.
Set triagePrompt to You are triaging one inbound sales inquiry for the sales team described below. Two jobs: decide what this is, and draft the reply.Set triagePrompt to You are triaging one inbound sales inquiry for the sales team described below. Two jobs: decide what this is, and draft the reply. Judge FIT from the company against WHO WE SELL TO and WHO WE DO NOT SELL TO. Judge INTENT from what the person actually wrote and which form they used. They are different axes: a perfect-fit company idly downloading an ebook is not the same as a poor-fit company demanding a call today, and the two need opposite treatment. Read the message before anything else. It is the only place that reveals someone is an agency pitching us, a candidate who couldn't find the careers page, a student doing research, or an existing customer who wanted support. Firmographics cannot catch any of those, and all four score well on paper. Reply in EXACTLY this shape. Every line before the reply delimiter is 'KEY: value' on one line. Do not add commentary, headings or blank lines before the delimiter. INTENT_CLASS: one of buyer, vendor_pitch, job_seeker, student, existing_customer_support, partner_enquiry, competitor, spam, unclear FIT_TIER: A, B, C or D. A is squarely in the profile, D is nowhere near. INTENT_TIER: high, medium or low CONFIDENCE: a number from 0 to 1 EVIDENCE: one short quote from their message that drove the call. If they wrote nothing usable, put NONE. REASONING: one sentence a rep can read in three seconds TEAM_SIZE: a number, or UNKNOWN TIMELINE: what they said about timing, or UNKNOWN CURRENT_TOOLING: tools they mentioned, or UNKNOWN COMPETITOR: a competitor they mentioned switching from, or NONE ---REPLY--- Then the reply itself, written as the rep who will run the call. Open by referencing the specific thing they asked about, in their words, not yours. Say one useful thing. Offer the booking link. Under 90 words, no bullet points, no 'I hope this email finds you well'. If INTENT_CLASS is not buyer, write a short courteous decline or redirect instead - never a sales pitch. If the inquiry genuinely does not say enough to judge, set INTENT_CLASS to unclear and CONFIDENCE below 0.4 rather than guessing. A person will read those. Booking link to offer: bookingLink leadDossier.
ClaudeClaudeAsk Claude: triagePrompt. Save it as triageResponse.Ask Claude: triagePrompt. Save it as triageResponse. Maximum response length: 1400
Set triage to a record of parsed, intent class, fit tier, and 9 more.Set triage to a record of parsed, intent class, fit tier, and 9 more.
If a step below fails, save the error as parseErrorIf a step below fails, save the error as parseError
Try
Run Python code on raw and save it as triage.Run Python code on raw and save it as triage.
On error
Show in the output: Could not read the triage result for leadEmail - routing it to a human instead. parseError.message.Show in the output: Could not read the triage result for leadEmail - routing it to a human instead. parseError.message.
Set intentClass to triage.intent_class.Set intentClass to triage.intent_class.
Set fitTier to triage.fit_tier.Set fitTier to triage.fit_tier.
Set intentTier to triage.intent_tier.Set intentTier to triage.intent_tier.
Set decision to “route”.Set decision to “route”.
Set reasonCode to blank.Set reasonCode to blank.
Set needsHumanEye to false.Set needsHumanEye to false.
If intentClass is “spam”If intentClass is “spam”
Yes
Change decision to “drop”.Change decision to “drop”.
Change reasonCode to “INVALID_OR_SPAM”.Change reasonCode to “INVALID_OR_SPAM”.
No
No steps
If intentClass is “vendor_pitch”If intentClass is “vendor_pitch”
Yes
Change decision to “drop”.Change decision to “drop”.
Change reasonCode to “VENDOR_PITCH”.Change reasonCode to “VENDOR_PITCH”.
No
No steps
If intentClass is “job_seeker”If intentClass is “job_seeker”
Yes
Change decision to “drop”.Change decision to “drop”.
Change reasonCode to “JOB_SEEKER”.Change reasonCode to “JOB_SEEKER”.
No
No steps
If intentClass is “student”If intentClass is “student”
Yes
Change decision to “drop”.Change decision to “drop”.
Change reasonCode to “STUDENT_OR_RESEARCH”.Change reasonCode to “STUDENT_OR_RESEARCH”.
No
No steps
If intentClass is “competitor”If intentClass is “competitor”
Yes
Change decision to “drop”.Change decision to “drop”.
Change reasonCode to “COMPETITOR”.Change reasonCode to “COMPETITOR”.
No
No steps
If intentClass is “partner_enquiry”If intentClass is “partner_enquiry”
Yes
Change decision to “handoff”.Change decision to “handoff”.
Change reasonCode to “PARTNER_ENQUIRY”.Change reasonCode to “PARTNER_ENQUIRY”.
No
No steps
If intentClass is “existing_customer_support”If intentClass is “existing_customer_support”
Yes
Change decision to “handoff”.Change decision to “handoff”.
Change reasonCode to “EXISTING_CUSTOMER”.Change reasonCode to “EXISTING_CUSTOMER”.
No
No steps
If triage.parsed is no or triage.confidence is less than 0.4If triage.parsed is no or triage.confidence is less than 0.4
Yes
Change needsHumanEye to true.Change needsHumanEye to true.
Change decision to “route”.Change decision to “route”.
Change reasonCode to “LOW_CONFIDENCE”.Change reasonCode to “LOW_CONFIDENCE”.
No
No steps
If isThrowawayDomain is yesIf isThrowawayDomain is yes
Yes
Change decision to “drop”.Change decision to “drop”.
Change reasonCode to “INVALID_OR_SPAM”.Change reasonCode to “INVALID_OR_SPAM”.
No
No steps
If “,invalid,spamtrap,abuse,do_not_mail,” contains ,emailStatus,If “,invalid,spamtrap,abuse,do_not_mail,” contains ,emailStatus,
Yes
Change decision to “drop”.Change decision to “drop”.
Change reasonCode to “INVALID_OR_SPAM”.Change reasonCode to “INVALID_OR_SPAM”.
No
No steps
If decision is “route”If decision is “route”
Yes
If reasonCode is blank and fitTier is “A” or fitTier is “B”If reasonCode is blank and fitTier is “A” or fitTier is “B”
Yes
If intentTier is “low”If intentTier is “low”
Yes
Change decision to “nurture”.Change decision to “nurture”.
Change reasonCode to “GOOD_FIT_NOT_NOW”.Change reasonCode to “GOOD_FIT_NOT_NOW”.
No
Change reasonCode to “PURSUE”.Change reasonCode to “PURSUE”.
Else if @reasonCode is blank
If intentTier is “high”If intentTier is “high”
Yes
Change decision to “handoff”.Change decision to “handoff”.
Change reasonCode to “LOW_FIT_HIGH_INTENT”.Change reasonCode to “LOW_FIT_HIGH_INTENT”.
No
Change decision to “nurture”.Change decision to “nurture”.
Change reasonCode to “LOW_FIT”.Change reasonCode to “LOW_FIT”.
Otherwise
No steps
No
No steps
Set routedToName to blank.Set routedToName to blank.
Set routedToEmail to blank.Set routedToEmail to blank.
Set routedToSlackId to blank.Set routedToSlackId to blank.
Set routingRule to blank.Set routingRule to blank.
If decision is not “drop”If decision is not “drop”
Yes
If accountHasOpenDeal is yes and accountOwnerEmail isn't emptyIf accountHasOpenDeal is yes and accountOwnerEmail isn't empty
Yes
Change routedToEmail to accountOwnerEmail.Change routedToEmail to accountOwnerEmail.
Change routedToSlackId to accountOwnerSlackId.Change routedToSlackId to accountOwnerSlackId.
Change routingRule to “open-opportunity owner”.Change routingRule to “open-opportunity owner”.
Else if @hasAccountMatch is yes and @accountOwnerEmail isn'…
Change routedToEmail to accountOwnerEmail.Change routedToEmail to accountOwnerEmail.
Change routedToSlackId to accountOwnerSlackId.Change routedToSlackId to accountOwnerSlackId.
Change routingRule to “existing account owner”.Change routingRule to “existing account owner”.
Otherwise
No steps
If routedToEmail is emptyIf routedToEmail is empty
Yes
Keep each item in loadedReps.rows where item.Available in lowercase is not “no” and item.Email isn't blank and save it as availableReps.Keep each item in loadedReps.rows where item.Available in lowercase is not “no” and item.Email isn't blank and save it as availableReps.
If availableReps is emptyIf availableReps is empty
Yes
Change routingRule to “no rep available”.Change routingRule to “no rep available”.
Change reasonCode to “OWNER_UNAVAILABLE”.Change reasonCode to “OWNER_UNAVAILABLE”.
Change needsHumanEye to true.Change needsHumanEye to true.
No
Set rotationIndex to the remainder of roundRobinTurn divided by the length of availableReps.Set rotationIndex to the remainder of roundRobinTurn divided by the length of availableReps.
Set chosenRep to availableReps[@rotationIndex].Set chosenRep to availableReps[@rotationIndex].
Trim chosenRep.Name and save it as routedToName.Trim chosenRep.Name and save it as routedToName.
TextMake chosenRep.Email lowercase and save it as routedToEmail.Make chosenRep.Email lowercase and save it as routedToEmail.
Trim chosenRep["Slack ID"] and save it as routedToSlackId.Trim chosenRep["Slack ID"] and save it as routedToSlackId.
Change routingRule to “round robin”.Change routingRule to “round robin”.
Add 1 to roundRobinTurn.Add 1 to roundRobinTurn.
No
No steps
No
No steps
Set crmContactId to blank.Set crmContactId to blank.
If decision is “route”If decision is “route”
Yes
If a step below fails, save the error as crmLookupErrorIf a step below fails, save the error as crmLookupError
Try
HubSpotHubSpotFind the contact leadEmail. Save it as crmLookup.Find the contact leadEmail. Save it as crmLookup.
Trim crmLookup.id and save it as crmContactId.Trim crmLookup.id and save it as crmContactId.
On error
If a step below fails, save the error as crmCreateErrorIf a step below fails, save the error as crmCreateError
Try
HubSpotHubSpotCreate the contact leadEmail. Save it as crmCreated.Create the contact leadEmail. Save it as crmCreated.
Trim crmCreated.id and save it as crmContactId.Trim crmCreated.id and save it as crmContactId.
On error
Add leadEmail was posted and recorded but could not be added to HubSpot, so add them by hand (crmCreateError.message). to the end of leadProblems and save it as leadProblems.Add leadEmail was posted and recorded but could not be added to HubSpot, so add them by hand (crmCreateError.message). to the end of leadProblems and save it as leadProblems.
No
No steps
Look up decision in a table and save it as decisionLabel.Look up decision in a table and save it as decisionLabel.
Look up fitTier in a table and save it as fitLabel.Look up fitTier in a table and save it as fitLabel.
Look up intentTier in a table and save it as intentLabel.Look up intentTier in a table and save it as intentLabel.
Build the text “*@decisionLabel* - @fitLabel, @intentLabel” and save it as alertHeadline.Build the text “*@decisionLabel* - @fitLabel, @intentLabel” and save it as alertHeadline.
Set whoLine to leadName.Set whoLine to leadName.
If enrichedTitle isn't emptyIf enrichedTitle isn't empty
Yes
Change whoLine to whoLine, enrichedTitle.Change whoLine to whoLine, enrichedTitle.
No
No steps
If enrichedCompany isn't emptyIf enrichedCompany isn't empty
Yes
Change whoLine to whoLine at enrichedCompany.Change whoLine to whoLine at enrichedCompany.
No
No steps
Set ownerMention to routedToEmail.Set ownerMention to routedToEmail.
If routedToSlackId isn't emptyIf routedToSlackId isn't empty
Yes
Build the text “<@@routedToSlackId>” and save it as ownerMention.Build the text “<@@routedToSlackId>” and save it as ownerMention.
No
No steps
If routedToEmail is emptyIf routedToEmail is empty
Yes
Change ownerMention to “nobody yet”.Change ownerMention to “nobody yet”.
No
No steps
Set alertBody to alertHeadlineSet alertBody to alertHeadline whoLine <mailto:leadEmail|leadEmail> · form: formName > triage.evidence triage.reasoning Routed to: ownerMention (routingRule).
If isBuyingGroup is yesIf isBuyingGroup is yes
Yes
Change alertBody to alertBodyChange alertBody to alertBody :busts_in_silhouette: Someone else from emailDomain also inquired recently - treat this as one buying group.
No
No steps
If needsHumanEye is yesIf needsHumanEye is yes
Yes
Look up reasonCode in a table and save it as humanEyeReason.Look up reasonCode in a table and save it as humanEyeReason.
Build the text “@alertBody :eyes: Read this one yourself before replying - @humanEyeReason” and save it as alertBody.Build the text “@alertBody :eyes: Read this one yourself before replying - @humanEyeReason” and save it as alertBody.
No
No steps
If emailTypoSuggestion isn't emptyIf emailTypoSuggestion isn't empty
Yes
Change alertBody to alertBodyChange alertBody to alertBody :warning: Possible typo in the address - did they mean emailTypoSuggestion?.
No
No steps
If decision is not “drop”If decision is not “drop”
Yes
Change alertBody to alertBodyChange alertBody to alertBody *Suggested reply* triage.reply.
If a step below fails, save the error as slackErrorIf a step below fails, save the error as slackError
Try
SlackSlackSend a message to slackChannelId.Send a message to slackChannelId.alertBody
On error
Stop and report a problem: Could not post to Slack, so nobody would hear about this lead. Check the channel id on the step called 'Create slackChannelId', and make sure the Lodol app has been invited to that channel with /invite Lodol. The underlying error was: slackError.message.Stop and report a problem: Could not post to Slack, so nobody would hear about this lead. Check the channel id on the step called 'Create slackChannelId', and make sure the Lodol app has been invited to that channel with /invite Lodol. The underlying error was: slackError.message.
Add 1 to routedThisRun.Add 1 to routedThisRun.
No
Add 1 to droppedThisRun.Add 1 to droppedThisRun.
If replyMode in lowercase is “draft” and decision is “route”If replyMode in lowercase is “draft” and decision is “route”
Yes
If a step below fails, save the error as draftErrorIf a step below fails, save the error as draftError
Try
GmailGmailDraft an email to leadEmail.Draft an email to leadEmail. Subject: Re: formNametriage.reply
On error
Add leadEmail was posted to Slack and recorded, but the Gmail draft could not be saved, so reply from the suggested text in Slack (draftError.message). to the end of leadProblems and save it as leadProblems.Add leadEmail was posted to Slack and recorded, but the Gmail draft could not be saved, so reply from the suggested text in Slack (draftError.message). to the end of leadProblems and save it as leadProblems.
No
No steps
Move the current date and time by replyWithinMinutes minutes and save it as replyDueAt.Move the current date and time by replyWithinMinutes minutes and save it as replyDueAt.
If a step below fails, save the error as ledgerErrorIf a step below fails, save the error as ledgerError
Try
Google SheetsGoogle SheetsAdd a row to 'Ledger' in spreadsheetUrl.Add a row to 'Ledger' in spreadsheetUrl.
On error
Stop and report a problem: Stopped: leadEmail (submission submissionId) was handled but could not be added to the 'Ledger' tab. The next run will handle it again, so if it was posted to Slack it will be posted a second time. Check that the connected Google Sheets account can edit the spreadsheet and that the 'Ledger' tab is still there. The error was: ledgerError.message.Stop and report a problem: Stopped: leadEmail (submission submissionId) was handled but could not be added to the 'Ledger' tab. The next run will handle it again, so if it was posted to Slack it will be posted a second time. Check that the connected Google Sheets account can edit the spreadsheet and that the 'Ledger' tab is still there. The error was: ledgerError.message.
On error
Add lead.Email (submission lead["Submission ID"]) could not be triaged and was not recorded, so the next run tries it again (leadError.message). to the end of leadProblems and save it as leadProblems.Add lead.Email (submission lead["Submission ID"]) could not be triaged and was not recorded, so the next run tries it again (leadError.message). to the end of leadProblems and save it as leadProblems.
Set handledThisRun to routedThisRun plus droppedThisRun.Set handledThisRun to routedThisRun plus droppedThisRun.
Count the items in leadsForNextRun and save it as waitingCount.Count the items in leadsForNextRun and save it as waitingCount.
If leadProblems isn't emptyIf leadProblems isn't empty
Yes
Join leadProblems with a new line and save it as problemList.Join leadProblems with a new line and save it as problemList.
Stop and report a problem: New leads handled: handledThisRun. Some need attention:Stop and report a problem: New leads handled: handledThisRun. Some need attention: problemList.
No
No steps
If waitingCount is greater than 0If waitingCount is greater than 0
Yes
Finish the run: New leads handled: handledThisRun (routedThisRun posted to Slack, droppedThisRun dropped). Still waiting: waitingCount - they are picked up by the next runs, 10 at a time.Finish the run: New leads handled: handledThisRun (routedThisRun posted to Slack, droppedThisRun dropped). Still waiting: waitingCount - they are picked up by the next runs, 10 at a time.
No
No steps
If handledThisRun is 0If handledThisRun is 0
Yes
Finish the run: No new leads on the 'New leads' tab.Finish the run: No new leads on the 'New leads' tab.
No
No steps
Finish the run: New leads handled: handledThisRun (routedThisRun posted to Slack, droppedThisRun dropped).Finish the run: New leads handled: handledThisRun (routedThisRun posted to Slack, droppedThisRun dropped).