Marketing · n8n

Track Instagram Hashtag Mentions and Log Them to Google Sheets

An n8n workflow that watches a branded or campaign hashtag on Instagram, collects every new public post using it, and logs the author, caption and engagement to Google Sheets — giving social media managers a live record of user-generated content and campaign reach.

difficulty Intermediatesetup 50 minresult A continuously updating sheet of every public post using your hashtag — perfect for UGC and campaign tracking
  1. 1

    Resolve the hashtag ID

    A Schedule Trigger (hourly) runs an HTTP Request to https://graph.facebook.com/v19.0/ig_hashtag_search with user_id, the hashtag q (without the #) and your token. It returns the hashtag's numeric ID, which the next call needs.

  2. 2

    Fetch recent media for the hashtag

    An HTTP Request to https://graph.facebook.com/v19.0/HASHTAG_ID/recent_media with fields=id,caption,permalink,like_count,comments_count,timestamp and your user_id returns the newest public posts using that hashtag.

  3. 3

    Split and de-duplicate

    An Item Lists node splits the response into one item per post, then a Filter node drops any media ID already logged. This keeps every run adding only genuinely new posts to the sheet.

  4. 4

    Shape the row

    A Set node maps each post into clean columns: date, author permalink, caption, likes, comments and a computed engagement (likes + comments). Structured columns make the sheet instantly sortable by reach.

  5. 5

    Append to the tracking sheet

    A Google Sheets node appends the rows. Sort by engagement to find your best UGC to reshare, or pivot by date to chart campaign momentum over time — all without touching the Instagram app.

Frequently asked questions

Which hashtags can I track?

Any public hashtag, via the Instagram Graph API's Hashtag Search then recent-media endpoints. You first resolve the hashtag to an ID, then request recent media. Note the platform limit: you can query up to 30 unique hashtags in a rolling 7-day window per account, which is plenty for campaign tracking.

Does it capture Stories or only feed posts?

Hashtag search returns feed posts and Reels, not Stories — the API doesn't expose Story hashtag usage this way. For Stories you'd need the mentions webhook, which only fires when someone tags your account handle. This recipe focuses on the reliable feed/Reels hashtag data.

How do I avoid logging the same post twice?

The workflow stores the most recent media IDs it has seen (in n8n static data or a lookup column in the sheet) and skips anything already recorded. Because the recent-media endpoint returns posts newest-first, a simple 'stop when we hit a known ID' check keeps the sheet clean.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.