Quick Overview
This workflow runs daily to scrape recent Instagram posts via Apify, scores them with rule-based logic plus OpenAI, logs results to Google Sheets, and routes top posts to Slack for approval and warm posts to Gmail, while also emailing a weekly summary report.
How it works
- Runs on a daily schedule (or manually for testing) and loads all runtime settings such as Apify inputs, scoring thresholds, and destination IDs.
- Starts an Apify Instagram posts scraper run and polls the Apify Runs API until the actor succeeds or fails.
- Downloads the Apify dataset results, removes incomplete or previously seen posts, and stops quietly if there are no new records.
- Calculates a transparent 0–100 rule score per post (likes, comments, lift vs the account’s median, freshness, keywords, and format) and then sends each post to OpenAI to produce a structured fit score, verdict, summary, outreach angle, and red flags.
- Blends the rule score with the OpenAI fit score to set a final tier (hot/warm/cold) and upserts each post into Google Sheets keyed by a unique post identifier.
- Sends hot posts to Slack as a single approval message and writes the approve/dismiss decision back to Google Sheets, while warm posts are emailed as an HTML digest via Gmail and cold posts remain logged in the sheet only.
- On a separate weekly schedule, reads the last 7 days of rows from Google Sheets, builds an HTML report of tiers and top posts, and emails it via Gmail.
Setup
- Add an Apify API token as an HTTP Header Auth credential (for example,
Authorization: Bearer <token>) and select it on the Apify HTTP Request steps.
- Connect a Google Sheets account, create a sheet tab (for example, “Posts”) with columns that match the workflow mapping, and paste your Google Sheet ID and tab name into the Config values.
- Add an OpenAI API credential for the chat model used by the AI scoring step (or swap in another supported chat model) and adjust the AI criteria/weight in Config if needed.
- Connect Slack and set the target channel ID in Config (and in the error-alert Slack step) so hot-post approvals and failure alerts post to the right place.
- Connect Gmail and set the digest email address in Config so the warm-post digest and weekly report can be delivered.