Every Monday, posts the week's new HubSpot leads to Slack: how many, how that compares to last week, and who they are.
Uses
HubSpot
Slack
Weekly HubSpot lead report to Slack
slackChannelId to blank.Set slackChannelId to blank.leadLimit to 500.Set leadLimit to 500.maxNamed to 12.Set maxNamed to 12.weekStart.Get the date 7 days before the current date and time and save it as weekStart.weekStart and save it as priorWeekStart.Get the date 7 days before weekStart and save it as priorWeekStart.weekStart. Save it as newLeads.Find contacts created since weekStart. Save it as newLeads.priorWeekStart. Save it as priorLeads.Find contacts created since priorWeekStart. Save it as priorLeads.newLeadCount to newLeads.total.Set newLeadCount to newLeads.total.leadChange to newLeadCount minus priorLeads.total.Set leadChange to newLeadCount minus priorLeads.total.leadChange and save it as leadSwing.Calculate the absolute value of leadChange and save it as leadSwing.percentNote to blank.Set percentNote to blank.priorLeads.total is greater than 0If priorLeads.total is greater than 0Yes
swingRatio to leadSwing divided by priorLeads.total.Set swingRatio to leadSwing divided by priorLeads.total.swingRatio as a percentage with 0 decimal places and save it as swingPercent.Format swingRatio as a percentage with 0 decimal places and save it as swingPercent.percentNote to (swingPercent).Change percentNote to (swingPercent).No
No steps
momentum to level with the week before.Set momentum to level with the week before.leadChange is greater than 0If leadChange is greater than 0Yes
momentum to up leadSwing@percentNote on the week before.Change momentum to up leadSwing@percentNote on the week before.Else if @leadChange is less than 0
momentum to down leadSwing@percentNote on the week before.Change momentum to down leadSwing@percentNote on the week before.Otherwise
No steps
contacts, window_start, max_named, has_more, and total_count and save it as digest.Run Python code on contacts, window_start, max_named, has_more, and total_count and save it as digest.weekStart readable as “November 2, 2026” and save it as weekLabel.Make weekStart readable as “November 2, 2026” and save it as weekLabel.*New HubSpot leads, week of @weekLabel* @newLeadCount new contacts, @momentum. @digest.body and save it as reportText.Build the text *New HubSpot leads, week of @weekLabel* @newLeadCount new contacts, @momentum. @digest.body and save it as reportText.slackChannelId. Save it as posted.Send a message to slackChannelId. Save it as posted.reportText