Examples
Five Instagram examples: product launch post, hashtag monitoring, spam moderation, DM voucher replies, and weekly carousel posts.
Example 1: Auto-Publish an Image Post When a Product Launches
// Triggered by WebhookTrigger from CMS product publish event
// Instagram node — media/imagePublish
{
"resource": "media",
"operation": "imagePublish",
"access_token": "{{ credentials.instagram_token }}",
"image_url": "{{ vars.product_hero_image_url }}",
"caption": "{{ vars.product_name }} is now available! 🛍️\n\n{{ vars.product_tagline }}\n\nShop now at the link in bio.\n\n#{{ vars.product_hashtag }} #newproduct #{{ vars.brand_hashtag }}"
}
Expected outcome: The product hero image is published to Instagram immediately at launch time with a pre-formatted caption including product name, tagline, and hashtags. The
permalink in the response can be stored back in the CMS product record.Example 2: Monitor Hashtag and Save New Posts to Database
// Step 1 — hashtag/search to get the hashtag ID (run once, store result)
{
"resource": "hashtag",
"operation": "search",
"access_token": "{{ credentials.instagram_token }}",
"hashtag": "yourbrand2026"
}
// Step 2 — hashtag/media (triggered hourly by ScheduledTrigger)
{
"resource": "hashtag",
"operation": "media",
"access_token": "{{ credentials.instagram_token }}",
"hashtag_id": "{{ vars.brand_hashtag_id }}",
"media_type": "recent_media",
"limit": 50
}
// Step 3 — Loop over data array
// → IfCondition: post timestamp > last_checked_at
// → MongoDB/insertOne: save { id, permalink, caption, username, timestamp }
Expected outcome: New branded posts are logged in MongoDB within one hour of publishing. Marketing team can review UGC content from the database for potential reposts or creator outreach.
Example 3: Auto-Hide Spam Comments Containing Keywords
// Step 1 — comments/list
{
"resource": "comments",
"operation": "list",
"access_token": "{{ credentials.instagram_token }}",
"media_id": "{{ vars.post_media_id }}",
"limit": 100
}
// Step 2 — Loop over data array
// Step 3 — Function node: check if comment.text contains spam keywords
// → If spam detected:
// Step 4 — comments/hide
{
"resource": "comments",
"operation": "hide",
"access_token": "{{ credentials.instagram_token }}",
"comment_id": "{{ vars.current_comment_id }}",
"hidden": true
}
Expected outcome: Spam comments are silently hidden from public view within minutes of posting. The comments are not deleted (allowing for review), but other users cannot see them.
Example 4: Reply to Comments with a DM Voucher Code
// Step 1 — comments/list on the giveaway post
{
"resource": "comments",
"operation": "list",
"access_token": "{{ credentials.instagram_token }}",
"media_id": "{{ vars.giveaway_post_id }}",
"limit": 100
}
// Step 2 — Loop over comments
// Step 3 — CollectionOperation: check commenter not already processed
// Step 4 — Function node: generate unique voucher code
// Step 5 — comments/privateReply
{
"resource": "comments",
"operation": "privateReply",
"access_token": "{{ credentials.instagram_token }}",
"comment_id": "{{ vars.comment_id }}",
"message": "Thanks for entering! Your exclusive discount code is: {{ vars.voucher_code }} — use it at checkout for 20% off. Valid for 7 days!"
}
Expected outcome: Every commenter receives a personalised DM with their unique voucher code. The promotion feels exclusive and personal while being fully automated.
Example 5: Publish Carousel for Weekly Product Showcase
// Triggered by ScheduledTrigger (every Friday 10:00 AM)
// Step 1 — MongoDB query: get top 5 products of the week by sales
// Step 2 — DataMapping: extract image URLs into an array
// Step 3 — Instagram node — media/carouselPublish
{
"resource": "media",
"operation": "carouselPublish",
"access_token": "{{ credentials.instagram_token }}",
"media_urls": [
"{{ vars.product1_image_url }}",
"{{ vars.product2_image_url }}",
"{{ vars.product3_image_url }}",
"{{ vars.product4_image_url }}",
"{{ vars.product5_image_url }}"
],
"caption": "This week's top picks! Swipe to see our best sellers for the week of {{ vars.week_label }}.\n\nShop all at the link in bio.\n\n#weeklyfinds #bestsellers #{{ vars.brand_hashtag }}"
}
Expected outcome: A 5-image carousel is published every Friday automatically. The carousel showcases real sales data, making content both authentic and data-driven without any manual image selection or caption writing.