Instagram DM Automation - Messages Not Delivering via Facebook Graph API

Describe the problem/Bad request -

I’ve built an Instagram DM automation workflow that successfully receives webhook messages and generates AI responses, but the replies fail to send back to Instagram users through the Facebook Graph API node.

The core issue: The Facebook Graph API node places the message payload in query parameters instead of the request body, causing a (#100) The parameter recipient is required error.

When I switched to HTTP Request node with proper body configuration, I encountered two different errors depending on which endpoint I used:

  • Using Instagram Account ID (17841478653005064): (#3) Application does not have the capability to make this API call

  • Using Page/User ID (950715291451772): (#200) App does not have Advanced Access to instagram_manage_messages permission and recipient user does not have role on app

Question: What’s the correct n8n node configuration (Facebook Graph API vs HTTP Request) and endpoint structure for sending Instagram DM replies? Is the Facebook Graph API node compatible with Instagram Messaging API, or should I exclusively use HTTP Request node with specific Meta app permissions?

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
  "nodes": [
    {
      "parameters": {
        "jsCode": "// Facebook webhook verification logic\n\nconst query = $json.query;\n\n// Replace this with the SAME token you set in Meta Dashboard\nconst VERIFY_TOKEN = \"Mirror\";\n\nif (\n  query[\"hub.mode\"] === \"subscribe\" &&\n  query[\"hub.verify_token\"] === VERIFY_TOKEN\n) {\n  // Valid request → return challenge\n  return [\n    {\n      json: {\n        challenge: query[\"hub.challenge\"]\n      }\n    }\n  ];\n}\n\n// Invalid token or request\nthrow new Error(\"Invalid verification token\");\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -1168,
        112
      ],
      "id": "979296c0-bf40-424b-89cd-f13241f08208",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "={{ $json.challenge }}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        -976,
        112
      ],
      "id": "5da5df33-0960-4206-840c-65c23d5798cb",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "multipleMethods": true,
        "path": "aa9acbb1-2695-4113-83c5-0c3b7e5917fc",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -1360,
        256
      ],
      "id": "d1ba3b3e-59c4-464b-9948-f2d8a9719a54",
      "name": "Webhook",
      "webhookId": "aa9acbb1-2695-4113-83c5-0c3b7e5917fc"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.entry[0].messaging[0].message.text }}",
        "options": {
          "systemMessage": "You are an official Instagram DM AI assistant for the brand “Mirror Organics”, an organic hair care brand based in India.\n\nYour role is to assist customers by providing accurate product information, verified links, active offers, and customer support, while maintaining brand trust and professionalism.\n\nYou MUST rely on tools for all factual data.\nNever guess, invent, or assume information.\n\n────────────────────\nAVAILABLE TOOLS\n────────────────────\n\n1) mirror_organics_links\nUse this tool for:\n• Website links\n• Shop / Buy now links\n• Policy pages (terms, shipping, privacy, about)\n• Instagram or Pinterest links\n\n2) mirror_organics_coupons\nUse this tool for:\n• Coupon codes\n• Discounts\n• Sale price explanations\n• Best price / offers\n\n3) mirror_organics_products\nUse this tool for:\n• Product details\n• Ingredients\n• Benefits\n• How to use\n• Price\n• Product comparison\n• Hair Growth Oil or Hair Fall Control Oil information\n\n4) mirror_organics_support\nUse this tool for:\n• Customer support\n• Contact details\n• Order issues\n• Refunds, returns, delivery concerns\n• Email, phone, or WhatsApp support\n\nAlways call the relevant tool before answering.\nNever provide factual answers without tool data.\n\n────────────────────\nBRAND TONE & STYLE\n────────────────────\n• Warm, friendly, and trustworthy\n• Premium but approachable\n• Short, Instagram-friendly responses\n• Minimal emojis only when appropriate (🌿✨)\n• Helpful, never pushy or salesy\n\n────────────────────\nCONVERSATION RULES\n────────────────────\n• Be concise and clear\n• Do not exaggerate results\n• Do not make medical claims\n• Do not guarantee outcomes\n• Never ask for OTPs, passwords, or payment details\n• Do not share internal or technical details\n• If unsure, escalate politely to human support\n\n────────────────────\nSALES & OFFERS RULES\n────────────────────\n• Clearly explain how discounts stack\n• Mention pre-applied sale discount separately\n• Share coupon codes only via coupon tool\n• Encourage purchase gently, not aggressively\n\n────────────────────\nSUPPORT & ESCALATION\n────────────────────\nFor order-related issues:\n• Ask for Order ID and registered phone number\n• Inform that a human support agent will assist\n• Share official support contacts via support tool\n\nIf a query is outside your knowledge:\n• Say you will connect them to support\n• Do not guess or fabricate answers\n\n────────────────────\nDEFAULT BEHAVIOR\n────────────────────\n• If user intent is unclear, ask one polite clarifying question\n• If user asks “price”, “coupon”, or “best offer” → call coupons tool\n• If user asks “how to use”, “ingredients”, “benefits” → call products tool\n• If user asks “where to buy” → call links tool\n• If user asks “help”, “contact”, “order issue” → call support tool\n\nYou are a brand representative of Mirror Organics.\nAccuracy, trust, and clarity are more important than creativity."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -1072,
        352
      ],
      "id": "c8fd00f3-279f-4c2f-8e69-709e167880e9",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "content": "Mirror organics tools link\n(https://docs.n8n.io/workflows/components/sticky-notes/)",
        "height": 256,
        "width": 720
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        544
      ],
      "typeVersion": 1,
      "id": "88181da0-6e09-4bc9-9a89-67a9686a13a4",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -1232,
        624
      ],
      "id": "5a775d8a-4096-43cc-b8d4-6b1f59bf1866",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "id": "FSVdfJkrgdkJKELd",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.body.entry[0].messaging[0].sender.id }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -1040,
        624
      ],
      "id": "98be16ac-db5c-4a3f-9214-f74e5407aac4",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "description": "Use this tool to fetch official and verified Mirror Organics links.\nThis tool should be called whenever the user asks for:\n- Website link\n- Shop / Buy now link\n- Product purchase link\n- Terms & conditions\n- Shipping & returns policy\n- Privacy policy\n- About us page\n- Instagram or Pinterest social media links\n\nAlways use the URLs returned by this tool.\nNever invent or guess links.",
        "jsCode": "/**\n * Mirror Organics – Official Links Tool\n * This tool returns verified and trusted URLs only.\n */\n\nconst links = {\n  website: \"https://themirrororganics.com/\",\n  shop: \"https://themirrororganics.com/#shop\",\n  terms_and_conditions: \"https://themirrororganics.com/terms-and-conditions/\",\n  shipping_and_returns: \"https://themirrororganics.com/shipping-returns/\",\n  privacy_policy: \"https://themirrororganics.com/privacy-policy/\",\n  about_us: \"https://themirrororganics.com/about-us/\",\n  instagram: \"https://www.instagram.com/mirrorganics/\",\n  pinterest: \"https://in.pinterest.com/mirrororganicssolutions/?actingBusinessId=994592036365846627\"\n};\n\n// If request_type is provided, return only that link\nconst requestType = $json.request_type;\n\nif (requestType && links[requestType]) {\n  return [\n    {\n      json: {\n        type: requestType,\n        url: links[requestType]\n      }\n    }\n  ];\n}\n\n// Default: return all links\nreturn [\n  {\n    json: {\n      brand: \"Mirror Organics\",\n      links\n    }\n  }\n];"
      },
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.3,
      "position": [
        -816,
        640
      ],
      "id": "c7d9683c-dfad-4119-be02-cc65dd0b5333",
      "name": "mirror_organics_links"
    },
    {
      "parameters": {
        "description": "Use this tool to fetch the currently active and verified discount offers and coupon codes for Mirror Organics.\n\nCall this tool when the user asks about:\n- Coupon codes\n- Discounts\n- Offers\n- Sale price\n- Payment offers\n- Promo codes\n- Best price\n\nNever invent or guess coupon codes.\nOnly use the data returned by this tool.",
        "jsCode": "/**\n * Mirror Organics – Coupon & Offers Tool\n * Returns only verified, currently active discounts.\n */\n\nconst couponData = {\n  brand: \"Mirror Organics\",\n  offers: {\n    sale_discount: {\n      description: \"5% OFF sale price\",\n      applied: true\n    },\n    coupon_code: {\n      code: \"XMAS10\",\n      discount: \"10% OFF\",\n      description: \"Apply coupon XMAS10 at checkout\",\n      applied: false\n    },\n    payment_offer: {\n      description: \"Extra 5% OFF on online prepaid payment\",\n      applied: false\n    }\n  },\n  notes: [\n    \"Sale discount is already applied to the product price\",\n    \"Coupon code and prepaid discount can be combined\",\n    \"Offers are subject to change based on availability\"\n  ]\n};\n\nreturn [\n  {\n    json: couponData\n  }\n];"
      },
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.3,
      "position": [
        -640,
        640
      ],
      "id": "a8850704-c13f-4c36-920a-a4562a006c65",
      "name": "mirror_organics_coupons"
    },
    {
      "parameters": {
        "description": "Use this tool to fetch official and verified product information for Mirror Organics.\n\nCall this tool whenever the user asks about:\n- Product details\n- Ingredients\n- Benefits\n- How to use\n- Price\n- Net quantity\n- Where the product is made\n- Hair growth oil or hair fall control oil\n- Comparison between products\n\nNever invent product details.\nAlways rely only on the data returned by this tool.",
        "jsCode": "/**\n * Mirror Organics – Product Information Tool\n * Returns verified product data only.\n */\n\nconst products = {\n  hair_growth_oil: {\n    name: \"Mirror Organics Hair Growth Oil\",\n    category: \"Hair Growth Oil\",\n    net_quantity: \"50ml\",\n    made_in: \"Mysuru, India\",\n    description:\n      \"Luxurious organic hair growth oil crafted with Ayurvedic wisdom and organic botanicals to nourish the scalp, strengthen hair, and promote healthy natural growth.\",\n    price: {\n      original: \"₹1,299.00\",\n      current: \"₹1,234.00\",\n      discount: \"5% OFF\"\n    },\n    key_benefits: [\n      \"Stimulates natural hair growth\",\n      \"Strengthens hair from root to tip\",\n      \"Nourishes and moisturizes scalp\",\n      \"100% natural & chemical-free\",\n      \"Suitable for all hair types\"\n    ],\n    how_to_use: [\n      \"Pre-wash: Apply 2–3 tablespoons, massage for 5–10 minutes\",\n      \"Overnight treatment: Apply and leave overnight, wash in the morning\",\n      \"Weekly ritual: Use 2–3 times per week\",\n      \"Styling protection: Apply a few drops to damp hair before styling\"\n    ],\n    ingredients: [\n      {\n        name: \"Hibiscus\",\n        benefit: \"Boosts shine, conditions deeply, stimulates dormant hair follicles\"\n      },\n      {\n        name: \"Moringa Oil\",\n        benefit: \"Strengthens follicles, reduces breakage, supports growth\"\n      },\n      {\n        name: \"Grapeseed Oil\",\n        benefit: \"Lightweight nourishment, reduces frizz, improves elasticity\"\n      },\n      {\n        name: \"Safflower Oil\",\n        benefit: \"Improves scalp circulation and supports thicker hair\"\n      },\n      {\n        name: \"Jojoba Oil\",\n        benefit: \"Balances scalp oils and deeply moisturizes\"\n      }\n    ],\n    tags: [\n      \"100% Natural\",\n      \"Cruelty-Free\",\n      \"Paraben & Sulphate Free\"\n    ],\n    product_url: \"https://themirrororganics.com/product/hair-growth-oil/\"\n  },\n\n  hair_fall_control_oil: {\n    name: \"Mirror Organics Hair Fall Control Oil\",\n    category: \"Hair Fall Control Oil\",\n    net_quantity: \"50ml\",\n    made_in: \"Mysuru, India\",\n    description:\n      \"Premium organic hair oil designed to reduce hair fall, strengthen roots, and promote healthier, thicker hair without harsh chemicals.\",\n    price: {\n      original: \"₹1,099.00\",\n      current: \"₹1,044.00\",\n      discount: \"5% OFF\"\n    },\n    key_benefits: [\n      \"Reduces hair fall effectively\",\n      \"Stimulates natural hair growth\",\n      \"Deep scalp hydration\",\n      \"100% chemical-free formula\",\n      \"Suitable for all hair types\"\n    ],\n    how_to_use: [\n      \"Pre-shampoo: Apply 30 minutes before washing\",\n      \"Scalp massage: Use gentle circular motions\",\n      \"Weekly treatment: Use 2–3 times per week\",\n      \"Overnight application: Leave overnight for intensive care\"\n    ],\n    ingredients: [\n      {\n        name: \"Almond Oil\",\n        benefit: \"Strengthens hair, reduces breakage, nourishes scalp\"\n      },\n      {\n        name: \"Olive Oil\",\n        benefit: \"Locks moisture, improves elasticity, soothes scalp\"\n      },\n      {\n        name: \"Safflower Oil\",\n        benefit: \"Stimulates growth, enhances scalp circulation\"\n      }\n    ],\n    tags: [\n      \"100% Natural\",\n      \"Cruelty-Free\",\n      \"Paraben & Sulphate Free\"\n    ],\n    product_url:\n      \"https://themirrororganics.com/product/hair-fall-control-oil/\"\n  }\n};\n\n// Return specific product if requested\nconst productKey = $json.product_key;\n\nif (productKey && products[productKey]) {\n  return [\n    {\n      json: products[productKey]\n    }\n  ];\n}\n\n// Default: return all products\nreturn [\n  {\n    json: {\n      brand: \"Mirror Organics\",\n      products\n    }\n  }\n];"
      },
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.3,
      "position": [
        -464,
        640
      ],
      "id": "4f8e8e36-9994-4b67-b6b3-6a8285c07943",
      "name": "mirror_organics_products"
    },
    {
      "parameters": {
        "description": "Use this tool to provide official Mirror Organics customer support contact details.\n\nCall this tool whenever the user asks about:\n- Customer support\n- Contact details\n- Help or assistance\n- Order issues\n- Refunds or returns\n- Delivery problems\n- Complaints\n- Phone number, WhatsApp, or email support\n\nNever guess or invent contact information.\nOnly share the details returned by this tool.",
        "jsCode": "/**\n * Mirror Organics – Customer Support Tool\n * Returns verified and official support contact details only.\n */\n\nconst supportDetails = {\n  brand: \"Mirror Organics\",\n  support_channels: {\n    email: {\n      address: \"[email protected]\",\n      description: \"For order queries, refunds, returns, and general support\"\n    },\n    phone: {\n      number: \"8088963974\",\n      description: \"Call for immediate assistance during business hours\"\n    },\n    whatsapp: {\n      number: \"8088963974\",\n      description: \"WhatsApp support for quick help and order updates\"\n    }\n  },\n  support_guidelines: [\n    \"Please keep your Order ID ready for faster support\",\n    \"Support responses may take up to 24 hours during peak times\",\n    \"Avoid sharing OTPs, passwords, or payment details\"\n  ]\n};\n\n// If support_type is provided, return only that channel\nconst supportType = $json.support_type;\n\nif (supportType && supportDetails.support_channels[supportType]) {\n  return [\n    {\n      json: {\n        type: supportType,\n        details: supportDetails.support_channels[supportType]\n      }\n    }\n  ];\n}\n\n// Default: return all support details\nreturn [\n  {\n    json: supportDetails\n  }\n];"
      },
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "typeVersion": 1.3,
      "position": [
        -288,
        640
      ],
      "id": "2101c529-8f70-4d6e-83f3-e369c212f23b",
      "name": "mirror_organics_support"
    },
    {
      "parameters": {
        "httpRequestMethod": "POST",
        "graphApiVersion": "v23.0",
        "node": "950715291451772",
        "edge": "messages",
        "options": {
          "queryParametersJson": "={\n  \"messaging_type\": \"RESPONSE\",\n  \"recipient\": {\n    \"id\": \" {{ $('Webhook').item.json.body.entry[0].messaging[0].sender.id }} \"\n  },\n  \"message\": {\n    \"text\": \" {{ $json.output }} \"\n  }\n}\n"
        }
      },
      "type": "n8n-nodes-base.facebookGraphApi",
      "typeVersion": 1,
      "position": [
        -176,
        128
      ],
      "id": "9a1bc9ee-4657-4e09-8e51-9039ada0ca44",
      "name": "Facebook Graph API",
      "credentials": {
        "facebookGraphApi": {
          "id": "ce8dhJ3breBKSoip",
          "name": "Facebook Graph account 2"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://graph.facebook.com/v23.0/17841478653005064/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer EAAhmkjPZCLZAABQaA0LGskBobxvmsN2qSNchsUZC8W8VP9AGKYTekKNwCjWOvaOhLdrhZCte9bOjflZBqvLTPGRg4V3fVq7SHmVeEOGYx4wPzauzCplh1ohmY7T0jvvDoZCIR0MApusGtfauF5i6CbUFI7m8g1YxiKZBYoZCZBZC520H08LomwvDbrPcCiaxlOPsvnvfDSl3ELtc3lQt7jGKSIDfBUPfvSt869ltVg7JeD2vr2cCkxjDcKg6gZD"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"messaging_type\": \"RESPONSE\",\n  \"recipient\": {\n    \"id\": \"{{ $('Webhook').item.json.body.entry[0].messaging[0].sender.id }}\"\n  },\n  \"message\": {\n    \"text\": \"{{ $json.output }}\"\n  }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -720,
        352
      ],
      "id": "ef97f970-a90d-430c-971b-f2786ced515a",
      "name": "HTTP Request"
    }
  ],
  "connections": {
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "mirror_organics_links": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "mirror_organics_coupons": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "mirror_organics_products": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "mirror_organics_support": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {
    "Webhook": [
      {
        "headers": {
          "host": "n8n.srv1218014.hstgr.cloud",
          "user-agent": "facebookexternalua",
          "content-length": "393",
          "accept": "*/*",
          "accept-encoding": "deflate, gzip",
          "content-type": "application/json",
          "instagram-api-version": "v24.0",
          "x-forwarded-for": "172.18.0.1",
          "x-forwarded-host": "n8n.srv1218014.hstgr.cloud",
          "x-forwarded-port": "443",
          "x-forwarded-proto": "https",
          "x-forwarded-server": "7bc247fff6c3",
          "x-hub-signature": "sha1=0f8e9d8da7cb9cd9184f64a2f72517c2b805cabe",
          "x-hub-signature-256": "sha256=835cc13d7aab3012a30155b4c89e36f25e7e7e63e2c208411e60145b4135161b",
          "x-real-ip": "172.18.0.1"
        },
        "params": {},
        "query": {},
        "body": {
          "object": "instagram",
          "entry": [
            {
              "time": 1766739035395,
              "id": "17841478653005064",
              "messaging": [
                {
                  "sender": {
                    "id": "1401566798020894"
                  },
                  "recipient": {
                    "id": "17841478653005064"
                  },
                  "timestamp": 1766739034854,
                  "message": {
                    "mid": "aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEOjE3ODQxNDc4NjUzMDA1MDY0OjM0MDI4MjM2Njg0MTcxMDMwMTI0NDI2MDExNjExNzIwNzcwOTAxMzozMjU5MDU4MjgyMDk5NzI1MTczMTY4MDQ1OTAwMDY0MzU4NAZDZD",
                    "text": "Hi"
                  }
                }
              ]
            }
          ]
        },
        "webhookUrl": "https://n8n.srv1218014.hstgr.cloud/webhook/aa9acbb1-2695-4113-83c5-0c3b7e5917fc",
        "executionMode": "production"
      }
    ]
  },
  "meta": {
    "instanceId": "5e96f5c1cb65ac1dccbd6546e30116f2af9b9b78d84adcc6b3d04ea3ca1da31b"
  }
}

Share the output returned by the last node

Forbidden - perhaps check your credentials?

(#200) App does not have Advanced Access to instagram_manage_messages permission and recipient user does not have role on app.
Bad request - please check your parameters
(#3) Application does not have the capability to make this API call.

n8n version: 2.1.3

  1. Database (default: SQLite): SQLite
  2. n8n EXECUTIONS_PROCESS setting (default: own, main): own
  3. Running n8n via (Docker, npm, n8n cloud, desktop app): Docker (hosted on Hostinger VPS)
  4. Operating system: Linux

I believe your errors lie in the credential setup in the facebook graph api. Whatever key your using doesen’t have the correct scopes to do send messages.