@xnkee/n8n-nodes-instagram 1.7.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/{LICENSE.md → LICENSE} +21 -21
  2. package/README.md +132 -437
  3. package/dist/credentials/InstagramApi.credentials.d.ts +10 -0
  4. package/dist/credentials/InstagramApi.credentials.js +55 -0
  5. package/dist/credentials/InstagramApi.credentials.js.map +1 -0
  6. package/dist/credentials/InstagramOAuth2Api.credentials.d.ts +2 -2
  7. package/dist/credentials/InstagramOAuth2Api.credentials.js +33 -113
  8. package/dist/credentials/InstagramOAuth2Api.credentials.js.map +1 -1
  9. package/dist/credentials/InstagramUnifiedLoginOAuth2Api.credentials.d.ts +17 -0
  10. package/dist/credentials/InstagramUnifiedLoginOAuth2Api.credentials.js +116 -0
  11. package/dist/credentials/InstagramUnifiedLoginOAuth2Api.credentials.js.map +1 -0
  12. package/dist/credentials/instagram.svg +1 -0
  13. package/dist/index.d.ts +5 -0
  14. package/dist/index.js +22 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/nodes/Instagram/GenericFunctions.d.ts +27 -23
  17. package/dist/nodes/Instagram/GenericFunctions.js +182 -223
  18. package/dist/nodes/Instagram/GenericFunctions.js.map +1 -1
  19. package/dist/nodes/Instagram/Instagram.node.d.ts +1 -1
  20. package/dist/nodes/Instagram/Instagram.node.js +109 -2353
  21. package/dist/nodes/Instagram/Instagram.node.js.map +1 -1
  22. package/dist/nodes/Instagram/Instagram.node.json +17 -0
  23. package/dist/nodes/Instagram/InstagramChatTrigger.node.d.ts +17 -0
  24. package/dist/nodes/Instagram/InstagramChatTrigger.node.js +415 -0
  25. package/dist/nodes/Instagram/InstagramChatTrigger.node.js.map +1 -0
  26. package/dist/nodes/Instagram/InstagramChatTrigger.node.json +16 -0
  27. package/dist/nodes/Instagram/descriptions/comment/Comment.fields.d.ts +2 -0
  28. package/dist/nodes/Instagram/descriptions/comment/Comment.fields.js +161 -0
  29. package/dist/nodes/Instagram/descriptions/comment/Comment.fields.js.map +1 -0
  30. package/dist/nodes/Instagram/descriptions/comment/Comment.operations.d.ts +2 -0
  31. package/dist/nodes/Instagram/descriptions/comment/Comment.operations.js +62 -0
  32. package/dist/nodes/Instagram/descriptions/comment/Comment.operations.js.map +1 -0
  33. package/dist/nodes/Instagram/descriptions/comment/index.d.ts +2 -0
  34. package/dist/nodes/Instagram/descriptions/comment/index.js +8 -0
  35. package/dist/nodes/Instagram/descriptions/comment/index.js.map +1 -0
  36. package/dist/nodes/Instagram/descriptions/custom/Custom.fields.d.ts +2 -0
  37. package/dist/nodes/Instagram/descriptions/custom/Custom.fields.js +65 -0
  38. package/dist/nodes/Instagram/descriptions/custom/Custom.fields.js.map +1 -0
  39. package/dist/nodes/Instagram/descriptions/custom/Custom.operations.d.ts +2 -0
  40. package/dist/nodes/Instagram/descriptions/custom/Custom.operations.js +26 -0
  41. package/dist/nodes/Instagram/descriptions/custom/Custom.operations.js.map +1 -0
  42. package/dist/nodes/Instagram/descriptions/custom/index.d.ts +2 -0
  43. package/dist/nodes/Instagram/descriptions/custom/index.js +8 -0
  44. package/dist/nodes/Instagram/descriptions/custom/index.js.map +1 -0
  45. package/dist/nodes/Instagram/descriptions/index.d.ts +7 -0
  46. package/dist/nodes/Instagram/descriptions/index.js +24 -0
  47. package/dist/nodes/Instagram/descriptions/index.js.map +1 -0
  48. package/dist/nodes/Instagram/descriptions/insight/AccountInsight.fields.d.ts +2 -0
  49. package/dist/nodes/Instagram/descriptions/insight/AccountInsight.fields.js +164 -0
  50. package/dist/nodes/Instagram/descriptions/insight/AccountInsight.fields.js.map +1 -0
  51. package/dist/nodes/Instagram/descriptions/insight/Insight.operations.d.ts +2 -0
  52. package/dist/nodes/Instagram/descriptions/insight/Insight.operations.js +32 -0
  53. package/dist/nodes/Instagram/descriptions/insight/Insight.operations.js.map +1 -0
  54. package/dist/nodes/Instagram/descriptions/insight/MediaInsight.fields.d.ts +2 -0
  55. package/dist/nodes/Instagram/descriptions/insight/MediaInsight.fields.js +87 -0
  56. package/dist/nodes/Instagram/descriptions/insight/MediaInsight.fields.js.map +1 -0
  57. package/dist/nodes/Instagram/descriptions/insight/index.d.ts +4 -0
  58. package/dist/nodes/Instagram/descriptions/insight/index.js +12 -0
  59. package/dist/nodes/Instagram/descriptions/insight/index.js.map +1 -0
  60. package/dist/nodes/Instagram/descriptions/media/Media.operations.d.ts +2 -0
  61. package/dist/nodes/Instagram/descriptions/media/Media.operations.js +62 -0
  62. package/dist/nodes/Instagram/descriptions/media/Media.operations.js.map +1 -0
  63. package/dist/nodes/Instagram/descriptions/media/MediaGet.fields.d.ts +2 -0
  64. package/dist/nodes/Instagram/descriptions/media/MediaGet.fields.js +163 -0
  65. package/dist/nodes/Instagram/descriptions/media/MediaGet.fields.js.map +1 -0
  66. package/dist/nodes/Instagram/descriptions/media/MediaPublish.fields.d.ts +2 -0
  67. package/dist/nodes/Instagram/descriptions/media/MediaPublish.fields.js +285 -0
  68. package/dist/nodes/Instagram/descriptions/media/MediaPublish.fields.js.map +1 -0
  69. package/dist/nodes/Instagram/descriptions/media/index.d.ts +4 -0
  70. package/dist/nodes/Instagram/descriptions/media/index.js +12 -0
  71. package/dist/nodes/Instagram/descriptions/media/index.js.map +1 -0
  72. package/dist/nodes/Instagram/descriptions/mention/Mention.fields.d.ts +2 -0
  73. package/dist/nodes/Instagram/descriptions/mention/Mention.fields.js +122 -0
  74. package/dist/nodes/Instagram/descriptions/mention/Mention.fields.js.map +1 -0
  75. package/dist/nodes/Instagram/descriptions/mention/Mention.operations.d.ts +2 -0
  76. package/dist/nodes/Instagram/descriptions/mention/Mention.operations.js +38 -0
  77. package/dist/nodes/Instagram/descriptions/mention/Mention.operations.js.map +1 -0
  78. package/dist/nodes/Instagram/descriptions/mention/index.d.ts +2 -0
  79. package/dist/nodes/Instagram/descriptions/mention/index.js +8 -0
  80. package/dist/nodes/Instagram/descriptions/mention/index.js.map +1 -0
  81. package/dist/nodes/Instagram/descriptions/message/Message.fields.d.ts +2 -0
  82. package/dist/nodes/Instagram/descriptions/message/Message.fields.js +123 -0
  83. package/dist/nodes/Instagram/descriptions/message/Message.fields.js.map +1 -0
  84. package/dist/nodes/Instagram/descriptions/message/Message.operations.d.ts +2 -0
  85. package/dist/nodes/Instagram/descriptions/message/Message.operations.js +44 -0
  86. package/dist/nodes/Instagram/descriptions/message/Message.operations.js.map +1 -0
  87. package/dist/nodes/Instagram/descriptions/message/index.d.ts +2 -0
  88. package/dist/nodes/Instagram/descriptions/message/index.js +8 -0
  89. package/dist/nodes/Instagram/descriptions/message/index.js.map +1 -0
  90. package/dist/nodes/Instagram/descriptions/user/User.operations.d.ts +2 -0
  91. package/dist/nodes/Instagram/descriptions/user/User.operations.js +38 -0
  92. package/dist/nodes/Instagram/descriptions/user/User.operations.js.map +1 -0
  93. package/dist/nodes/Instagram/descriptions/user/UserInsights.fields.d.ts +2 -0
  94. package/dist/nodes/Instagram/descriptions/user/UserInsights.fields.js +164 -0
  95. package/dist/nodes/Instagram/descriptions/user/UserInsights.fields.js.map +1 -0
  96. package/dist/nodes/Instagram/descriptions/user/UserProfile.fields.d.ts +2 -0
  97. package/dist/nodes/Instagram/descriptions/user/UserProfile.fields.js +83 -0
  98. package/dist/nodes/Instagram/descriptions/user/UserProfile.fields.js.map +1 -0
  99. package/dist/nodes/Instagram/descriptions/user/index.d.ts +4 -0
  100. package/dist/nodes/Instagram/descriptions/user/index.js +12 -0
  101. package/dist/nodes/Instagram/descriptions/user/index.js.map +1 -0
  102. package/dist/nodes/Instagram/handlers/CommentHandler.d.ts +2 -0
  103. package/dist/nodes/Instagram/handlers/CommentHandler.js +63 -0
  104. package/dist/nodes/Instagram/handlers/CommentHandler.js.map +1 -0
  105. package/dist/nodes/Instagram/handlers/CustomHandler.d.ts +2 -0
  106. package/dist/nodes/Instagram/handlers/CustomHandler.js +28 -0
  107. package/dist/nodes/Instagram/handlers/CustomHandler.js.map +1 -0
  108. package/dist/nodes/Instagram/handlers/InsightHandler.d.ts +2 -0
  109. package/dist/nodes/Instagram/handlers/InsightHandler.js +42 -0
  110. package/dist/nodes/Instagram/handlers/InsightHandler.js.map +1 -0
  111. package/dist/nodes/Instagram/handlers/MediaHandler.d.ts +2 -0
  112. package/dist/nodes/Instagram/handlers/MediaHandler.js +172 -0
  113. package/dist/nodes/Instagram/handlers/MediaHandler.js.map +1 -0
  114. package/dist/nodes/Instagram/handlers/MentionHandler.d.ts +2 -0
  115. package/dist/nodes/Instagram/handlers/MentionHandler.js +48 -0
  116. package/dist/nodes/Instagram/handlers/MentionHandler.js.map +1 -0
  117. package/dist/nodes/Instagram/handlers/MessageHandler.d.ts +2 -0
  118. package/dist/nodes/Instagram/handlers/MessageHandler.js +57 -0
  119. package/dist/nodes/Instagram/handlers/MessageHandler.js.map +1 -0
  120. package/dist/nodes/Instagram/handlers/UserHandler.d.ts +2 -0
  121. package/dist/nodes/Instagram/handlers/UserHandler.js +48 -0
  122. package/dist/nodes/Instagram/handlers/UserHandler.js.map +1 -0
  123. package/dist/nodes/Instagram/instagram.svg +1 -0
  124. package/package.json +34 -46
  125. package/API_REFERENCE.md +0 -907
  126. package/AUTHENTICATION_GUIDE.md +0 -718
  127. package/CHANGELOG.md +0 -391
  128. package/dist/credentials/InstagramUnifiedLoginApi.credentials.d.ts +0 -9
  129. package/dist/credentials/InstagramUnifiedLoginApi.credentials.js +0 -481
  130. package/dist/credentials/InstagramUnifiedLoginApi.credentials.js.map +0 -1
  131. package/dist/nodes/Instagram/InstagramTrigger.node.d.ts +0 -17
  132. package/dist/nodes/Instagram/InstagramTrigger.node.js +0 -398
  133. package/dist/nodes/Instagram/InstagramTrigger.node.js.map +0 -1
  134. package/dist/nodes/Instagram/instagram-large.svg +0 -27
  135. package/dist/nodes/Instagram/instagram-small.svg +0 -14
  136. package/dist/nodes/Instagram/types.d.ts +0 -171
  137. package/dist/nodes/Instagram/types.js +0 -3
  138. package/dist/nodes/Instagram/types.js.map +0 -1
  139. package/dist/package.json +0 -76
  140. package/dist/tsconfig.tsbuildinfo +0 -1
  141. package/index.js +0 -0
@@ -1,21 +1,21 @@
1
- # MIT License
2
-
3
- Copyright (c) 2025 Mohammad Mahdi Samei
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,484 +1,179 @@
1
1
  # @xnkee/n8n-nodes-instagram
2
2
 
3
- ![Instagram Banner](https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white)
4
- [![npm version](https://img.shields.io/npm/v/@xnkee/n8n-nodes-instagram.svg)](https://www.npmjs.com/package/@xnkee/n8n-nodes-instagram)
3
+ [![npm version](https://badge.fury.io/js/@xnkee%2Fn8n-nodes-instagram.svg)](https://badge.fury.io/js/@xnkee%2Fn8n-nodes-instagram)
4
+ [![Documentation](https://img.shields.io/badge/docs-Website-blue)](https://instagram-n8n-node.rizkifirmansyah.com/)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![n8n](https://img.shields.io/badge/n8n-community-FF6D5A?logo=n8n)](https://n8n.io)
7
- [![Downloads](https://img.shields.io/npm/dt/@xnkee/n8n-nodes-instagram.svg)](https://www.npmjs.com/package/@xnkee/n8n-nodes-instagram)
8
6
 
9
- Professional N8N community nodes for seamless Instagram Messaging API integration with Unified Login (Instagram or Facebook) and automatic token renewal.
7
+ An official community node for **n8n** that integrates with **Instagram API with Instagram Login** (Business Login for Instagram) powered by Meta Graph API `v26.0`.
10
8
 
11
- > Fork of [n8n-nodes-instagram-integrations](https://github.com/Msameim181/n8n-nodes-instagram-integrations) by Mohammad Mahdi Samei (MIT), adding the Instagram API with Unified Login.
9
+ 📖 **Official Documentation**: https://instagram-n8n-node.rizkifirmansyah.com/
12
10
 
13
- [Installation](#installation) • [Features](#features) • [Prerequisites](#prerequisites) • [Quick Start](#quick-start) • [Documentation](#documentation) • [Support](#support)
11
+ This node enables automated interactions with Instagram Professional accounts (Business & Creator) directly via Instagram Login, **without requiring the account to be connected to a Facebook Page**.
14
12
 
15
13
  ---
16
14
 
17
- ## 📖 Overview
18
-
19
- This package provides comprehensive Instagram integration for n8n workflows, enabling automated messaging, media management, and webhook-based event handling through the official Instagram Graph API.
20
-
21
- **Perfect for:**
22
- - 🤖 Automated customer support via Instagram DM
23
- - 📢 Marketing campaigns and notifications
24
- - 🎯 Lead generation and engagement
25
- - 📊 Customer interaction tracking
26
- - 🔄 Multi-platform messaging automation
15
+ ## 🌟 Key Features
16
+
17
+ - **🔐 Three Authentication Methods**:
18
+ - **OAuth2 (Instagram Business Login)**: Standard Meta OAuth 2.0 authorization flow.
19
+ - **Access Token (Direct / Long-Lived Token)**: Direct token-based authentication (supporting 60-day long-lived tokens).
20
+ - **Unified Login (Instagram or Facebook Login)**: Instagram API with Unified Login via a login configuration (`config_id`), calling `graph.facebook.com` with a Business Integration System User Access Token.
21
+ - **👤 User & Profile**:
22
+ - Retrieve authenticated user profile (`/me`) or look up other accounts (`biography`, `followers_count`, `media_count`, `website`, etc.).
23
+ - Retrieve user-level account insights.
24
+ - **📸 Media & Publishing**:
25
+ - **Single Photo**: Publish images to the feed.
26
+ - **Video & Reels**: Publish video posts and Instagram Reels with automatic asynchronous container status polling until ready (`FINISHED`).
27
+ - **Carousel**: Multi-item carousel posts (mixed photos and videos, 2–10 items).
28
+ - **Story**: Publish photos or videos as Instagram Stories.
29
+ - **Get & Delete**: Retrieve detailed media metadata or delete posts.
30
+ - **💬 Comment Moderation & Management**:
31
+ - Retrieve comments and replies for any media post.
32
+ - Post top-level comments and reply directly to existing comments.
33
+ - Moderation: Hide or unhide comments.
34
+ - Delete comments.
35
+ - **✉️ Direct Messaging (Instagram Messaging API)**:
36
+ - Send text DMs to users using their Instagram-Scoped ID (IGSID).
37
+ - Send media messages with attachments (image, video, audio, file).
38
+ - Retrieve active conversation threads and message histories.
39
+ - **📊 Insights & Analytics**:
40
+ - Account-level metrics: *reach*, *views*, *profile views*, *accounts engaged*, *total interactions*, *follower count*, *website clicks*, etc.
41
+ - Media-level metrics: *reach*, *views*, *engagement*, *saved*, *shares*, *likes*, *comments*, *plays*, *profile visits*.
42
+ - Flexible **All Metrics (Select All)** or specific selection mode.
43
+ - **🤖 AI Agent Tool Support (LangChain / n8n AI)**:
44
+ - Connect directly to the **AI Agent** node's `Tool` connector using the dedicated **Instagram Tool** sub-node.
45
+ - Allows autonomous AI agents to browse profiles, reply to comments, send DMs, publish content, and retrieve insights on demand.
46
+ - **⚡ Custom Graph API Call**:
47
+ - Execute custom HTTP requests (GET, POST, DELETE) to any Meta Graph API `v26.0` endpoint with automated authentication.
27
48
 
28
49
  ---
29
50
 
30
- ## ✨ Features
31
-
32
- ### 🔑 Instagram API with Unified Login (NEW in v1.7.0!)
33
- - **Log in with Instagram or Facebook** - Meta's recommended setup; no Facebook Page required
34
- - **Automatic token renewal** - Expiring tokens are renewed before expiration and persisted in the credential
35
- - **Auto-discovery** - Client business ID and shared Instagram account are discovered automatically
36
- - **`graph.facebook.com/v27.0`** endpoints, `appsecret_proof` on every request
37
- - **Webhook subscription** - The trigger subscribes the account to the selected fields on activation
38
- - See [Unified Login setup](AUTHENTICATION_GUIDE.md#instagram-api-with-unified-login-recommended-v170)
39
-
40
- ### 🔐 OAuth2 Authentication
41
- - **One-click authentication** - Secure OAuth2 flow similar to Google Drive
42
- - **🆕 Automatic long-lived tokens** - Short-lived tokens (1 hour) automatically exchanged for long-lived tokens (60 days)
43
- - **🆕 Automatic token refresh** - Tokens refresh automatically before expiration (zero configuration)
44
- - **🆕 No more "refreshToken is required" errors** - Smart token lifecycle management prevents expiration issues
45
- - **Multiple credential types** - OAuth2 or manual access token
46
- - **Auto-discovery** - Automatically fetches Instagram Business Account ID
47
-
48
- ### 📬 Instagram Messaging Node
49
-
50
- **Message Types:**
51
- - 💬 **Text Messages** - Send formatted text with up to 1000 characters
52
- - 🖼️ **Image Messages** - Share images via public HTTPS URLs
53
- - 🎵 **Audio Messages** - Send voice messages and audio files
54
- - 🎬 **Video Messages** - Share video content
55
- - 📤 **Media Upload** - Upload and publish photos, videos, reels, and stories
56
-
57
- **Interactive Templates:**
58
- - 🔘 **Button Templates** - Up to 3 action buttons (web links or postbacks)
59
- - 🎴 **Generic Templates** - Carousel cards with images and buttons
60
- - ⚡ **Quick Replies** - Up to 13 quick response options
61
-
62
- **User Management:**
63
- - 👤 **Get User Profile** - Retrieve user information (name, username, profile picture)
64
-
65
- ### 💬 Comment Management (NEW in v1.6.0!)
66
-
67
- **Comment Moderation:**
68
- - 📜 **Get Comments** - Retrieve all comments on your media posts with pagination
69
- - 💬 **Get Replies** - Fetch replies to specific comments
70
- - ↩️ **Reply to Comment** - Post public replies to comments on your media
71
- - 🔒 **Send Private Reply** - Send a DM to users who commented (7-day window)
72
- - 🗑️ **Delete Comment** - Remove unwanted comments from your posts
73
- - 👁️ **Hide/Unhide Comment** - Toggle comment visibility without deletion
74
-
75
- **Perfect for:**
76
- - 🤝 Engaging with your audience through comment replies
77
- - 📧 Sending exclusive offers via private DM to commenters
78
- - 🛡️ Moderating spam and unwanted comments
79
- - 🔄 Automating comment response workflows (Manychat alternative!)
80
-
81
- ### � Instagram Content Publishing (NEW!)
82
-
83
- **Post Creation:**
84
- - 📷 **Single Posts** - Create image or video feed posts
85
- - 🎞️ **Carousel Posts** - Multi-media posts (2-10 images/videos)
86
- - 🎬 **Reels** - Short-form videos up to 60 seconds
87
- - 📋 **Stories** - 24-hour temporary content
88
-
89
- **Advanced Features:**
90
- - 🏷️ **User Tagging** - Tag up to 20 users with precise positioning
91
- - 🛍️ **Product Tagging** - Tag products from Facebook catalog
92
- - 🤝 **Collaborators** - Tag other accounts as collaborators
93
- - 📍 **Location Tagging** - Add location stickers to posts
94
- - 🎨 **Custom Thumbnails** - Set video thumbnail positions
95
- - 🎵 **Audio Attribution** - Name audio tracks in reels
96
-
97
- **Media Management:**
98
- - 📊 **List Media** - Get paginated list of your media
99
- - 🔍 **Get Media Details** - Retrieve specific media information
100
- - 👶 **Get Carousel Children** - Access individual carousel items
101
-
102
- ### Instagram Trigger Node
103
-
104
- **Webhook Events:**
105
- - 💬 **New Messages** - Trigger on incoming messages
106
- - 🔘 **Postback Events** - Handle button clicks and interactions
107
- - ✅ **Opt-in Events** - Process user consent actions
108
- - 💭 **Comments** (NEW!) - Trigger when someone comments on your media
109
- - 🏷️ **Mentions** (NEW!) - Trigger when someone mentions you in comments or stories
110
-
111
- **Dual Output System:**
112
- - **Output 1** (Messages/Postbacks/Opt-ins) - Direct messaging events
113
- - **Output 2** (Comments/Mentions) - Content engagement events
114
-
115
- **Security Features:**
116
- - 🔒 Webhook signature validation (X-Hub-Signature-256)
117
- - ✓ Verify token authentication
118
- - 🛡️ HMAC SHA256 cryptographic verification
51
+ ## 🔑 How to Setup OAuth & Get Instagram Client ID and Secret
119
52
 
120
- ---
53
+ Follow these step-by-step instructions to get your **Instagram Client ID** and **Instagram Client Secret** from the Meta App Dashboard:
121
54
 
122
- ## 📋 Prerequisites
55
+ ### 1. Create a Meta Developer App
56
+ 1. Go to [Meta for Developers Portal](https://developers.facebook.com/apps) and log in (or sign up).
57
+ 2. Click **Create App** (choose **Other** or **Business** as the app type).
123
58
 
124
- ### Required Accounts
125
- 1. **Facebook Page** - Active Facebook page
126
- 2. **Instagram Business Account** - Connected to your Facebook page
127
- 3. **Meta Developer Account** - Access to Facebook Developer Console
128
- 4. **n8n Instance** - Self-hosted or cloud (version 0.196.0+)
59
+ ### 2. Add Instagram Use Case / Product
60
+ 1. In the app dashboard, navigate to **Use Cases** or **Add Product**.
61
+ 2. Select **Manage messaging & content on Instagram** (or **Instagram Platform** > **Instagram API with Instagram Login**).
129
62
 
130
- ### Required Permissions
63
+ ### 3. Retrieve Instagram Client ID & Secret
64
+ 1. In the left sidebar, navigate to:
65
+ **Instagram Platform** > **API setup with Instagram login** > **3. Set up Instagram business login** > **Business login settings** (or **Customize use case > Instagram**).
66
+ 2. On this page, you will find:
67
+ - 🔑 **Instagram App ID**: This is your **Client ID** for n8n.
68
+ - 🔒 **Instagram App Secret**: Click **Show** (enter your account password if prompted). This is your **Client Secret** for n8n.
131
69
 
132
- **For Messaging:**
133
- - `instagram_basic` - Basic profile access
134
- - `instagram_manage_messages` - Send and receive messages
135
- - `pages_manage_metadata` - Webhook subscriptions
136
- - `pages_read_engagement` - Read engagement data
70
+ > [!IMPORTANT]
71
+ > **Do NOT use the Facebook App ID** from the top header of the Meta Dashboard. You must use the specific **Instagram App ID** found inside the Instagram Platform settings.
137
72
 
138
- **For Content Publishing (NEW):**
139
- - `instagram_content_publish` - Create and publish posts, reels, and stories
140
- - `pages_show_list` - List Facebook pages
141
- - `catalog_management` - Product tagging (optional, for Instagram Shopping)
142
-
143
- ### Technical Requirements
144
- - Node.js 18.15+ or 20.10+
145
- - n8n version 0.196.0 or higher
146
- - HTTPS webhook endpoint (for trigger node)
73
+ ### 4. Add n8n OAuth Callback URL
74
+ 1. Open n8n and create a new **Instagram OAuth2 API** credential.
75
+ 2. Copy the **OAuth Callback URL** displayed in the modal (e.g. `https://your-n8n-instance.com/rest/oauth2-credential/callback`).
76
+ 3. Back in Meta App Dashboard under **Business login settings > Valid OAuth Redirect URIs**, paste the callback URL.
77
+ 4. Click **Save Changes**.
147
78
 
148
79
  ---
149
80
 
150
- ## 🚀 Installation
151
-
152
- ### Option 1: n8n Community Nodes (Recommended)
153
-
154
- 1. Open n8n
155
- 2. Go to **Settings** → **Community Nodes**
156
- 3. Search for `@xnkee/n8n-nodes-instagram`
157
- 4. Click **Install**
158
- 5. Restart n8n
159
-
160
- ### Option 2: npm Installation
161
-
162
- ```bash
163
- cd ~/.n8n/nodes
164
- npm install @xnkee/n8n-nodes-instagram
165
- ```
166
-
167
- ### Option 3: Docker
168
-
169
- Add to your `docker-compose.yml`:
81
+ ## 🔒 Required OAuth Permissions / Scopes
170
82
 
171
- ```yaml
172
- services:
173
- n8n:
174
- environment:
175
- - N8N_COMMUNITY_PACKAGES=@xnkee/n8n-nodes-instagram
176
- ```
83
+ The node uses the latest official Instagram Business Login scopes:
84
+ * `instagram_business_basic`: Read profile info and basic media data.
85
+ * `instagram_business_content_publish`: Upload and publish photos, videos, reels, stories, and carousels.
86
+ * `instagram_business_manage_messages`: Send and receive direct messages.
87
+ * `instagram_business_manage_comments`: Moderate, create, reply to, and delete comments.
177
88
 
178
89
  ---
179
90
 
180
- ## 🎯 Quick Start
181
-
182
- ### Step 1: Create Meta App
183
-
184
- 1. Visit [Meta for Developers](https://developers.facebook.com/apps/)
185
- 2. Click **Create App**
186
- 3. Select **Business** type
187
- 4. Add **Instagram** product
188
- 5. Note your **App ID** and **App Secret**
189
-
190
- ### Step 2: Connect Facebook Page
191
-
192
- 1. In App Dashboard → **Instagram** → **Basic Display**
193
- 2. Add your Instagram Business Account
194
- 3. Generate a **Page Access Token** with required permissions
195
- 4. Copy the **Instagram Business Account ID**
196
-
197
- ### Step 3: Configure n8n Credentials
198
-
199
- **Using Unified Login (Recommended, v1.7.0+):**
200
-
201
- 1. In the App Dashboard: **Use cases → Manage messaging & content on Instagram → API setup with Unified login** → create a configuration, set the Redirect URL and copy the **Login URL**
202
- 2. The client opens the Login URL and logs in with Instagram or Facebook; copy the `code` from the Redirect URL
203
- 3. In n8n: **Credentials** → **New** → **Instagram Unified Login API** → Meta App ID, Meta App Secret, Authorization Code, Redirect URL
204
- 4. Save and run a node right away (codes expire in minutes)
205
- 5. ✅ Token stored and renewed automatically! Full guide: [AUTHENTICATION_GUIDE.md](AUTHENTICATION_GUIDE.md#instagram-api-with-unified-login-recommended-v170)
91
+ ## 🚀 Installation in n8n
206
92
 
207
- **Using OAuth2 (Instagram Login):**
93
+ ### Option 1: Community Nodes UI (Recommended)
94
+ 1. Open your **n8n instance**.
95
+ 2. Go to **Settings** > **Community Nodes**.
96
+ 3. Click **Install a community node**.
97
+ 4. Enter the package name: `@xnkee/n8n-nodes-instagram`
98
+ 5. Accept the risks and click **Install**.
208
99
 
209
- 1. In n8n: **Credentials** → **New** → **Instagram OAuth2 API**
210
- 2. Enter:
211
- - **Client ID**: Your App ID
212
- - **Client Secret**: Your App Secret
213
- 3. Click **Connect my account**
214
- 4. Authorize in popup window
215
- 5. ✅ Connection established!
216
-
217
- **Using Access Token:**
218
-
219
- 1. In n8n: **Credentials** → **New** → **Instagram Access Token API**
220
- 2. Enter:
221
- - **Access Token**: Your Page Access Token
222
- 3. Click **Save**
223
- 4. ✅ Account ID auto-discovered!
224
-
225
- ### Step 4: Build Your First Workflow
226
-
227
- 1. Create new workflow
228
- 2. Add **Instagram** node
229
- 3. Select **Message** → **Send Text Message**
230
- 4. Configure:
231
- - **Credential**: Your Instagram credential
232
- - **Recipient ID**: Target user's Instagram-scoped ID
233
- - **Message**: Your text content
234
- 5. Execute!
235
-
236
- ---
237
-
238
- ## 📚 Documentation
239
-
240
- ### Core Guides
241
- - 📘 [**CHANGELOG.md**](./CHANGELOG.md) - Version history and updates
242
- - 🔧 [**IMPLEMENTATION_GUIDE.md**](./IMPLEMENTATION_GUIDE.md) - Developer documentation
243
- - � [**AUTHENTICATION_GUIDE.md**](./AUTHENTICATION_GUIDE.md) - Setup and OAuth guide
244
- - �📋 [**Instruction Files**](./.github/instructions/) - Technical specifications
245
-
246
- ### Content Publishing Guides (NEW!)
247
- - 🚀 [**QUICKSTART.md**](./QUICKSTART.md) - Get started in 5 minutes
248
- - 📸 [**POST_STORY_GUIDE.md**](./POST_STORY_GUIDE.md) - Complete post/story creation guide
249
- - 💡 [**EXAMPLES.md**](./EXAMPLES.md) - Code examples and workflow patterns
250
- - 📊 [**FEATURE_SUMMARY.md**](./FEATURE_SUMMARY.md) - Technical implementation details
251
-
252
- ### Example Workflows
253
-
254
- **Messaging:**
255
- - Auto-Reply to Messages
256
- - Daily Announcements
257
- - Customer Support Bot
258
-
259
- **Content Publishing:**
260
- - Scheduled Daily Posts
261
- - Automated Carousels
262
- - Story Automation
263
- - Product Showcase Reels
264
-
265
- ### API Reference
266
-
267
- **Message Operations:**
268
- - `sendTextMessage` - Send text content
269
- - `sendImageMessage` - Send image via URL
270
- - `sendAudioMessage` - Send audio file
271
- - `sendVideoMessage` - Send video content
272
- - `sendButtonTemplate` - Interactive buttons
273
- - `sendGenericTemplate` - Carousel cards
274
- - `sendQuickReplies` - Quick response options
275
- - `uploadMedia` - Upload media files
276
-
277
- **Post Operations (NEW):**
278
- - `createSinglePost` - Create image/video posts
279
- - `createCarouselPost` - Multi-media carousels
280
- - `createReel` - Short-form videos
281
- - `publishPost` - Publish created content
282
-
283
- **Story Operations (NEW):**
284
- - `createStory` - Create and publish stories
285
-
286
- **Media Operations (NEW):**
287
- - `listMedia` - Get your media list
288
- - `getMedia` - Get media details
289
- - `getMediaChildren` - Get carousel children
290
-
291
- **User Operations:**
292
- - `getUserProfile` - Fetch user information
293
- - `getMyProfile` - Get authenticated account info
294
-
295
- **Comment Operations (NEW in v1.6.0):**
296
- - `getComments` - Get all comments on media
297
- - `getReplies` - Get replies to a comment
298
- - `replyToComment` - Post public reply
299
- - `sendPrivateReply` - Send DM to commenter
300
- - `deleteComment` - Remove a comment
301
- - `toggleVisibility` - Hide/unhide comment
302
-
303
- **Webhook Events:**
304
- - `messages` - Incoming messages
305
- - `messaging_postbacks` - Button interactions
306
- - `messaging_optins` - Consent events
307
-
308
- ---
309
-
310
- ## � Token Management (v1.5.0+)
311
-
312
- ### Automatic Long-Lived Token System
313
-
314
- Instagram uses a two-tier token system that this package **automatically manages** for you:
315
-
316
- | Token Type | Validity | Management |
317
- |------------|----------|------------|
318
- | Short-lived | 1 hour | Received from OAuth |
319
- | Long-lived | 60 days | **Auto-exchanged** on first use |
320
- | Refreshed | 60 days | **Auto-refreshed** before expiration |
100
+ ### Option 2: Manual / Local Development (with Bun)
101
+ ```bash
102
+ # Clone the repository
103
+ git clone https://github.com/legenhand/n8n-nodes-instagram-api.git
104
+ cd n8n-nodes-instagram-api
321
105
 
322
- ### How It Works
106
+ # Install dependencies and build
107
+ bun install
108
+ bun run build
323
109
 
110
+ # Link package globally
111
+ bun link
324
112
  ```
325
- OAuth Authentication (User action)
326
- ↓
327
- Short-lived Token (1 hour)
328
- ↓
329
- First API Call (automatic)
330
- ↓
331
- Long-lived Token Exchange (automatic)
332
- ↓
333
- Token Valid for 60 Days
334
- ↓
335
- Auto-refresh at 53 Days (automatic)
336
- ↓
337
- Another 60 Days of Validity
338
- ```
339
-
340
- ### Key Features
341
-
342
- ✅ **Zero Configuration** - Everything happens automatically
343
- ✅ **No More Errors** - "refreshToken is required" error is eliminated
344
- ✅ **Smart Refresh** - Tokens refresh when at least 24 hours old and expiring within 7 days
345
- ✅ **Fallback Protection** - If refresh fails, attempts to exchange current OAuth token
346
- ✅ **Secure Storage** - All tokens encrypted in N8N credential system
347
-
348
- ### Best Practices
349
-
350
- 1. **Keep Workflows Active**: Run at least once every 50 days to maintain token validity
351
- 2. **Monitor Health**: Create a weekly health-check workflow (optional)
352
- 3. **Handle Errors Gracefully**: Use `continueOnFail` for robust error handling
353
113
 
354
- ### Token Lifecycle Example
355
-
356
- ```typescript
357
- // Day 1: OAuth authentication
358
- User authenticates → Short-lived token (expires in 1 hour)
359
-
360
- // Day 1: First workflow run
361
- First API call → Automatic exchange → Long-lived token (expires in 60 days)
362
-
363
- // Day 53: Automatic refresh (7 days before expiry)
364
- API call → Token check → Auto-refresh → New long-lived token (expires in 60 days)
365
-
366
- // Repeat cycle every ~53 days as long as workflows are active
114
+ In your n8n root / custom nodes folder:
115
+ ```bash
116
+ npm link @xnkee/n8n-nodes-instagram
367
117
  ```
368
118
 
369
- ### What If Token Expires?
370
-
371
- If a workflow is inactive for 60+ days:
372
- 1. Token expires and cannot be refreshed
373
- 2. Workflow shows error: "Instagram access token has expired"
374
- 3. **Solution**: Reconnect your Instagram OAuth2 credential (takes 30 seconds)
375
-
376
- ### Learn More
377
-
378
- 📘 [**TOKEN_MANAGEMENT.md**](./docs/TOKEN_MANAGEMENT.md) - Comprehensive token management guide
379
- 🔧 [**TOKEN_MANAGEMENT_IMPLEMENTATION.md**](./docs/TOKEN_MANAGEMENT_IMPLEMENTATION.md) - Technical implementation details
380
-
381
119
  ---
382
120
 
383
- ## �🔧 Configuration
384
-
385
- ### Webhook Setup
121
+ ## 🛠️ Credentials Configuration in n8n
386
122
 
387
- 1. In Meta App Dashboard → **Instagram** → **Webhooks**
388
- 2. Subscribe to `messages` field
389
- 3. Callback URL: Your n8n webhook URL
390
- ```
391
- https://your-n8n.com/webhook/instagram
392
- ```
393
- 4. Verify Token: Enter in both Meta and n8n credentials
394
- 5. Click **Verify and Save**
123
+ ### 1. Instagram OAuth2 API (Business Login - Recommended)
124
+ - **Client ID (Instagram App ID)**: Your Instagram App ID from Meta Dashboard.
125
+ - **Client Secret (Instagram App Secret)**: Your Instagram App Secret.
126
+ - **Scope**: `instagram_business_basic,instagram_business_content_publish,instagram_business_manage_messages,instagram_business_manage_comments` (editable).
127
+ - **API Version**: `v26.0` (default)
128
+ - **Base URL**: `https://graph.instagram.com`
395
129
 
396
- ### Rate Limits
397
-
398
- - **API Calls**: 200 requests per hour per user
399
- - **Messages**: 1000 characters max
400
- - **Buttons**: 3 per template, 20 characters per title
401
- - **Quick Replies**: 13 max per message
402
- - **Webhook Response**: Must respond within 20 seconds
130
+ ### 2. Instagram Access Token API
131
+ - **Access Token**: Short-lived or 60-day Long-Lived User Access Token.
132
+ - **API Version**: `v26.0` (default)
133
+ - **Base URL**: `https://graph.instagram.com`
403
134
 
404
135
  ---
405
136
 
406
- ## 🛠️ Troubleshooting
407
-
408
- ### Common Issues
409
-
410
- **"Invalid OAuth Access Token"**
411
- - Verify token hasn't expired
412
- - Check required permissions are granted
413
- - Regenerate token in Meta Developer Console
414
-
415
- **"Webhook Verification Failed"**
416
- - Ensure verify token matches in both Meta and n8n
417
- - Check n8n webhook is publicly accessible via HTTPS
418
- - Verify firewall allows Meta's IP ranges
419
-
420
- **"User Cannot Receive Messages"**
421
- - User must initiate conversation first (24-hour window)
422
- - Use message tags for out-of-window messaging
423
- - Verify Instagram Business Account is active
137
+ ## 📂 Project Structure
424
138
 
425
- **"Rate Limit Exceeded"**
426
- - Implement exponential backoff
427
- - Reduce request frequency
428
- - Use batch operations where possible
429
-
430
- ### Debug Mode
431
-
432
- Enable n8n debug logging:
433
- ```bash
434
- export N8N_LOG_LEVEL=debug
435
- n8n start
436
139
  ```
437
-
438
- ---
439
-
440
- ## 🤝 Support
441
-
442
- ### Resources
443
- - 📖 [Instagram Graph API Documentation](https://developers.facebook.com/docs/instagram-api)
444
- - 💬 [n8n Community Forum](https://community.n8n.io)
445
-
446
- ### Contributing
447
-
448
- Contributions are welcome! Please:
449
- 1. Fork the repository
450
- 2. Create a feature branch
451
- 3. Follow existing code style
452
- 4. Add tests for new features
453
- 5. Submit a pull request
454
-
455
- See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) for guidelines.
140
+ n8n-nodes-instagram-api/
141
+ ├── credentials/
142
+ │ ├── InstagramApi.credentials.ts # Access Token Credentials
143
+ │ ├── InstagramOAuth2Api.credentials.ts # OAuth2 Business Login Credentials
144
+ │ ├── InstagramUnifiedLoginOAuth2Api.credentials.ts # Unified Login OAuth2 Credentials
145
+ │ └── instagram.svg # Vector Logo
146
+ ├── nodes/
147
+ │ └── Instagram/
148
+ │ ├── Instagram.node.ts # Main Node Controller & AI Tool Handler
149
+ │ ├── Instagram.node.json # Community Node Metadata
150
+ │ ├── GenericFunctions.ts # API Request Helper, Polling & Pagination
151
+ │ ├── instagram.svg # Node Icon
152
+ │ ├── handlers/ # Modular Action & Execution Handlers
153
+ │ │ ├── UserHandler.ts # User Profile & Insights Execution
154
+ │ │ ├── MediaHandler.ts # Media & Publishing Execution
155
+ │ │ ├── CommentHandler.ts # Comment Moderation Execution
156
+ │ │ ├── MessageHandler.ts # Direct Messaging Execution
157
+ │ │ ├── InsightHandler.ts # Insights & Analytics Execution
158
+ │ │ ├── MentionHandler.ts # Mention & Tag Execution
159
+ │ │ └── CustomHandler.ts # Custom Graph API Execution
160
+ │ └── descriptions/ # Modular UI & Parameter Definitions
161
+ │ ├── user/ # User operations & fields
162
+ │ ├── media/ # Media operations & fields
163
+ │ ├── comment/ # Comment operations & fields
164
+ │ ├── message/ # Message operations & fields
165
+ │ ├── insight/ # Insight operations & fields
166
+ │ ├── mention/ # Mention operations & fields
167
+ │ ├── custom/ # Custom request operations & fields
168
+ │ └── index.ts # Master descriptions export
169
+ ├── index.ts # Package Entry Point
170
+ ├── package.json
171
+ ├── tsconfig.json
172
+ └── README.md
173
+ ```
456
174
 
457
175
  ---
458
176
 
459
177
  ## 📄 License
460
178
 
461
- MIT License - see [LICENSE.md](./LICENSE.md) for details.
462
-
463
- Copyright © 2025 Mohammad Mahdi Samei
464
-
465
- ---
466
-
467
- ## 🙏 Acknowledgments
468
-
469
- - Built with [n8n](https://n8n.io) - Fair-code workflow automation
470
- - Powered by [Instagram Graph API](https://developers.facebook.com/docs/instagram-api)
471
- - Icons by [Instagram Brand Guidelines](https://en.instagram-brand.com/)
472
-
473
- ---
474
-
475
- ## 📊 Stats
476
-
477
- ![npm](https://img.shields.io/npm/v/@xnkee/n8n-nodes-instagram)
478
- ![downloads](https://img.shields.io/npm/dt/@xnkee/n8n-nodes-instagram)
479
- ![license](https://img.shields.io/npm/l/@xnkee/n8n-nodes-instagram)
480
- ![node version](https://img.shields.io/node/v/@xnkee/n8n-nodes-instagram)
481
-
482
- ---
483
-
484
- **Made with ❤️ for the n8n community** | [npm](https://www.npmjs.com/package/@xnkee/n8n-nodes-instagram)
179
+ [MIT License](LICENSE) © 2026 Rizki Firmansyah