See llms.txt for all machine-readable content.

Back to Templates

Collect social media leads from Instagram and Facebook with Apify and Google Sheets

Quick overview

This workflow runs every 6 hours to read pending keyword topics from Google Sheets, scrape related Instagram hashtags and Facebook posts via Apify, extract basic lead details (profile, post link, email, phone), and save deduplicated results back to a Google Sheets Leads tab.

How it works

  1. Runs every 6 hours on a schedule trigger.
  2. Reads rows from the Google Sheets “Topics” sheet and keeps only entries that are not marked Done and contain Keywords.
  3. Selects the next pending topic and sends its keywords to Apify’s Instagram Hashtag Scraper and Facebook Post Search Scraper.
  4. Extracts lead fields from each returned post (topic, area, post/profile links, name, email/phone from the text, and timestamp) and filters out invalid Facebook results.
  5. Merges the Instagram and Facebook lead lists into a single stream.
  6. Appends or updates rows in the Google Sheets “Leads” sheet, deduplicating by “Post Link,” and then updates the corresponding topic row to Status = Done.

Setup

  1. Create a Google Sheet with a “Topics” tab (including at least Topic, Area, Keywords, and Status columns) and a “Leads” tab with columns matching the workflow fields (for example: Topic, Area, Platform, Post Link, Profile ID, Profile Link, Name, Email, Contact, Post Text, Collected At).
  2. Connect Google Sheets OAuth2 credentials in n8n and update the spreadsheet document ID and sheet names if you are not using the provided ones.
  3. Add an Apify API token (HTTP credential) and ensure the Apify actors apify~instagram-hashtag-scraper and themineworks~facebook-post-search-scraper are available to your account.
  4. (Optional) Adjust the schedule interval, results limits, and keyword formatting (comma-separated) to match your lead volume and scraping needs.