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.
- 1
Resolve the hashtag ID
A
Schedule Trigger(hourly) runs anHTTP Requesttohttps://graph.facebook.com/v19.0/ig_hashtag_searchwithuser_id, the hashtagq(without the #) and your token. It returns the hashtag's numeric ID, which the next call needs. - 2
Fetch recent media for the hashtag
An
HTTP Requesttohttps://graph.facebook.com/v19.0/HASHTAG_ID/recent_mediawithfields=id,caption,permalink,like_count,comments_count,timestampand youruser_idreturns the newest public posts using that hashtag. - 3
Split and de-duplicate
An
Item Listsnode splits the response into one item per post, then aFilternode drops any media ID already logged. This keeps every run adding only genuinely new posts to the sheet. - 4
Shape the row
A
Setnode maps each post into clean columns: date, author permalink, caption, likes, comments and a computedengagement(likes + comments). Structured columns make the sheet instantly sortable by reach. - 5
Append to the tracking sheet
A
Google Sheetsnode 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.