Skip to main content

Reply to Instagram DMs with keyword-based affiliate links via Meta Graph API

Workflow preview

Workflow preview
100%
Reply to Instagram DMs with keyword-based affiliate links via Meta Graph API preview
Open on n8n.io

1. Workflow Overview

This n8n workflow is an automated Instagram DM responder that checks messages and replies with affiliate links based on keywords. It runs on a schedule (every 15 minutes) or can be triggered manual...

Best for

  • Lead Nurturing automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.scheduletrigger, n8n-nodes-base.manualtrigger, n8n-nodes-base.set, n8n-nodes-base.httprequest, n8n-nodes-base.merge, n8n-nodes-base.code, n8n-nodes-base.splitinbatches

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Mihajlo.

Original n8n.io source

1.1 Workflow description

Title
Reply to Instagram DMs with keyword-based affiliate links via Meta Graph API
Workflow name
Reply to Instagram DMs with keyword-based affiliate links via Meta Graph API

This n8n workflow is an automated Instagram DM responder that checks messages and replies with affiliate links based on keywords.

It runs on a schedule (every 15 minutes) or can be triggered manually. First, it loads configuration values such as the Meta access token and Instagram user ID. It then fetches conversations from all Instagram DM folders (Inbox, General, Pending, and Message Requests), merges them, and removes duplicates.

Each conversation is processed one by one. The workflow retrieves messages and loads two local files: one containing previously replied message IDs, and another containing product definitions with keywords and affiliate URLs.

For each message, it skips those already replied to or sent by the account itself. It then checks if the message text contains any defined keyword. If a match is found, it prepares a reply using the corresponding product link.

The workflow sends the reply through the Meta Graph API and immediately logs the message ID to prevent duplicate responses in future runs.

Overall, it automates repetitive DM replies, supports multiple products via keyword matching, and ensures messages are only handled once.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 7 - Start Monitoring

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 8 - Configure Global Settings

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.3

Block 9 - Get Inbox Conversations

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 10 - Get General Conversations

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 11 - Get Pending Conversations

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 12 - Get Message Requests

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 13 - Merge All Conversations1

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 2.1

Block 14 - Merge All Conversations2

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 2.1

Block 15 - Merge All Conversations

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 2.1

Block 16 - Parse Conversations

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Split Conversations

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 1

Block 18 - Get Messages

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 19 - Read DM History

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 20 - Read products.json

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 21 - Filter New DMs

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 22 - Check If Should Reply

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 23 - Split DMs

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 1

Block 24 - NoOp - Skip

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Showing the first 24 of 28 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Reply to Instagram DMs with keyword-based affiliate links via Meta Graph API
Complexity advanced
Nodes 28
Categories Lead Nurturing, AI Chatbot
Author Mihajlo
Published 18 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15130/15130.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Reply to Instagram DMs with keyword-based affiliate links via Meta Graph API do?

This n8n workflow is an automated Instagram DM responder that checks messages and replies with affiliate links based on keywords. It runs on a schedule (every 15 minutes) or can be triggered manual...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Lead Nurturing, AI Chatbot use case.