Sync new TikTok lead form leads to HubSpot and Slack

By General Input

Every 15 minutes, pull fresh TikTok Instant Form leads, add them to HubSpot, and ping your sales team in Slack so no lead sits cold.

Integrations

  • TikTok Ads
  • HubSpot
  • Slack

Type

Deterministic Code

Categories

  • Sales
  • Marketing

Build a code workflow that runs on a cron every 15 minutes and syncs new TikTok Lead Generation Instant Form submissions into HubSpot, then notifies the sales team in Slack. This is deterministic pipeline work with clear steps, so keep it a code workflow, not an agent.

Trigger: cron, every 15 minutes. Persist a last-run timestamp in workflow state (per form is fine) so each run only fetches leads submitted since the previous run. On the very first run, look back a short window like the last 30 minutes so we do not backfill everything.

Step 1. Enumerate active lead forms. Call the tiktok-ads Get Instant Pages operation for the configured advertiser_id to list the advertiser's Instant Pages / Instant Forms. Filter to forms that are active. The advertiser_id should be a workflow input the user configures once.

Step 2. For each form, pull new leads. Call the tiktok-ads Create Lead Download Task operation for that form, scoped to the time window since the last successful run. Poll or wait until the task is ready, then call the tiktok-ads Download Leads operation to fetch the leads file. Parse it into a normalized list of leads with email, first name, last name, phone, form id, form name, submission timestamp, and any custom form fields.

Step 3. Upsert into HubSpot. Map the fields as follows: email -> email, first name -> firstname, last name -> lastname, phone -> phone. Write the originating form name to a custom contact property (default name tiktok_lead_form, but let the user rename it). Also stamp a lead_source property with the value "tiktok-lead-gen" so these are easy to segment later. Send everything through the hubspot Batch Upsert Contacts operation matched on email, in batches of up to 100 contacts. Capture the returned HubSpot contact id for each lead.

Step 4. Notify Slack. For each new lead, call the slack Send a Message operation to a channel that the user configures (default #new-leads). The message should include the lead's name, email, phone, form name, and a clickable HubSpot contact URL of the form https://app.hubspot.com/contacts/<portalId>/contact/<contactId>. Keep the message compact and scannable, one message per lead so it is easy to claim.

Configuration the workflow should expose as inputs: TikTok Ads advertiser_id, HubSpot portal id (for building the contact URL), Slack channel id or name, optional lookback window for the first run, and an optional map from TikTok custom form field ids to HubSpot property names.

Edge cases: dedupe within a single run so the same email does not get two Slack pings; skip rows that are missing an email since HubSpot upsert needs it; if a TikTok download task fails, log the error and continue with the other forms rather than aborting the whole run; only advance the last-run timestamp after HubSpot and Slack both succeed for that form.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredTurn Mailjet email clicks into ranked HubSpot follow-upsiMessage campaign console with pre-flight checks and delivery boardChat quality review board for LiveChat support leadsA searchable RFP answer library your bid team drafts fromSee which target accounts just started advertising on LinkedInAccount health board that puts product usage next to your CRMLook up a customer's full chat history mid conversationLusha prospecting workbench with credit-safe reveals