@pakoor/n8n-nodes-instagram 0.1.10 → 0.1.12
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.
- package/dist/credentials/InstagramAccessTokenApi.credentials.js +3 -3
- package/dist/credentials/InstagramOAuth2Api.credentials.d.ts +0 -2
- package/dist/credentials/InstagramOAuth2Api.credentials.d.ts.map +1 -1
- package/dist/credentials/InstagramOAuth2Api.credentials.js +33 -18
- package/dist/credentials/InstagramOAuth2Api.credentials.js.map +1 -1
- package/dist/services/InstagramApiClient.d.ts +1 -1
- package/dist/services/InstagramApiClient.js +1 -1
- package/dist/services/InstagramHelpers.js +3 -3
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ class InstagramAccessTokenApi {
|
|
|
36
36
|
};
|
|
37
37
|
this.test = {
|
|
38
38
|
request: {
|
|
39
|
-
baseURL: 'https://graph.facebook.com/
|
|
39
|
+
baseURL: 'https://graph.facebook.com/v24.0',
|
|
40
40
|
url: '/me',
|
|
41
41
|
qs: {
|
|
42
42
|
fields: 'id,name',
|
|
@@ -63,7 +63,7 @@ class InstagramAccessTokenApi {
|
|
|
63
63
|
// First, try a simple API call to validate the token
|
|
64
64
|
await this.helpers.httpRequest({
|
|
65
65
|
method: 'GET',
|
|
66
|
-
url: 'https://graph.facebook.com/
|
|
66
|
+
url: 'https://graph.facebook.com/v24.0/me',
|
|
67
67
|
qs: {
|
|
68
68
|
fields: 'id,name',
|
|
69
69
|
access_token: accessToken,
|
|
@@ -76,7 +76,7 @@ class InstagramAccessTokenApi {
|
|
|
76
76
|
// Get pages connected to the user
|
|
77
77
|
const pagesResponse = await this.helpers.httpRequest({
|
|
78
78
|
method: 'GET',
|
|
79
|
-
url: 'https://graph.facebook.com/
|
|
79
|
+
url: 'https://graph.facebook.com/v24.0/me/accounts',
|
|
80
80
|
qs: {
|
|
81
81
|
fields: 'instagram_business_account,id,name',
|
|
82
82
|
access_token: accessToken,
|
|
@@ -7,12 +7,10 @@ export declare class InstagramOAuth2Api implements ICredentialType {
|
|
|
7
7
|
properties: INodeProperties[];
|
|
8
8
|
/**
|
|
9
9
|
* Authenticate requests by adding access token to query string
|
|
10
|
-
* Uses longLivedToken if available, otherwise falls back to oauthTokenData.access_token
|
|
11
10
|
*/
|
|
12
11
|
authenticate: IAuthenticateGeneric;
|
|
13
12
|
/**
|
|
14
13
|
* Pre-authentication hook that exchanges short-lived OAuth token for a long-lived token
|
|
15
|
-
* and refreshes it when near expiration.
|
|
16
14
|
*/
|
|
17
15
|
preAuthentication(this: IHttpRequestHelper, credentials: ICredentialDataDecryptedObject): Promise<IDataObject>;
|
|
18
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstagramOAuth2Api.credentials.d.ts","sourceRoot":"","sources":["../../src/credentials/InstagramOAuth2Api.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,qBAAa,kBAAmB,YAAW,eAAe;IACxD,IAAI,SAAwB;IAC5B,OAAO,WAAiB;IACxB,WAAW,SAA0B;IACrC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"InstagramOAuth2Api.credentials.d.ts","sourceRoot":"","sources":["../../src/credentials/InstagramOAuth2Api.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,qBAAa,kBAAmB,YAAW,eAAe;IACxD,IAAI,SAAwB;IAC5B,OAAO,WAAiB;IACxB,WAAW,SAA0B;IACrC,gBAAgB,SAA+G;IAE/H,UAAU,EAAE,eAAe,EAAE,CAqF3B;IAEF;;OAEG;IACH,YAAY,EAAE,oBAAoB,CAOhC;IAEF;;OAEG;IACG,iBAAiB,CACrB,IAAI,EAAE,kBAAkB,EACxB,WAAW,EAAE,8BAA8B,GAC1C,OAAO,CAAC,WAAW,CAAC;IAsEvB;;OAEG;IACH,IAAI,EAAE,sBAAsB,CAS1B;CACH"}
|
|
@@ -6,7 +6,7 @@ class InstagramOAuth2Api {
|
|
|
6
6
|
this.name = 'instagramOAuth2Api';
|
|
7
7
|
this.extends = ['oAuth2Api'];
|
|
8
8
|
this.displayName = 'Instagram OAuth2 API';
|
|
9
|
-
this.documentationUrl = 'https://developers.facebook.com/docs/instagram-api/
|
|
9
|
+
this.documentationUrl = 'https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/business-login';
|
|
10
10
|
this.properties = [
|
|
11
11
|
{
|
|
12
12
|
displayName: 'Grant Type',
|
|
@@ -18,25 +18,25 @@ class InstagramOAuth2Api {
|
|
|
18
18
|
displayName: 'Authorization URL',
|
|
19
19
|
name: 'authUrl',
|
|
20
20
|
type: 'hidden',
|
|
21
|
-
default: 'https://www.facebook.com/
|
|
21
|
+
default: 'https://www.facebook.com/v24.0/dialog/oauth',
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
displayName: 'Access Token URL',
|
|
25
25
|
name: 'accessTokenUrl',
|
|
26
26
|
type: 'hidden',
|
|
27
|
-
default: 'https://graph.facebook.com/
|
|
27
|
+
default: 'https://graph.facebook.com/v24.0/oauth/access_token',
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
displayName: 'Scope',
|
|
31
31
|
name: 'scope',
|
|
32
32
|
type: 'hidden',
|
|
33
|
-
default: 'instagram_basic,instagram_content_publish,instagram_manage_comments,instagram_manage_messages,pages_show_list,pages_read_engagement
|
|
33
|
+
default: 'instagram_basic,instagram_content_publish,instagram_manage_comments,instagram_manage_messages,pages_show_list,pages_read_engagement',
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
displayName: 'Auth URI Query Parameters',
|
|
37
37
|
name: 'authQueryParameters',
|
|
38
38
|
type: 'hidden',
|
|
39
|
-
default: '',
|
|
39
|
+
default: 'display=page&extras={"setup":{"channel":"IG_API_ONBOARDING"}}',
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
displayName: 'Authentication',
|
|
@@ -45,11 +45,28 @@ class InstagramOAuth2Api {
|
|
|
45
45
|
default: 'body',
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
displayName: '
|
|
49
|
-
name: '
|
|
48
|
+
displayName: 'Client ID (App ID)',
|
|
49
|
+
name: 'clientId',
|
|
50
|
+
type: 'string',
|
|
51
|
+
default: '',
|
|
52
|
+
required: true,
|
|
53
|
+
description: 'The App ID from your Meta Developer Console. Go to App Settings > Basic to find it.',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Client Secret (App Secret)',
|
|
57
|
+
name: 'clientSecret',
|
|
58
|
+
type: 'string',
|
|
59
|
+
typeOptions: { password: true },
|
|
60
|
+
default: '',
|
|
61
|
+
required: true,
|
|
62
|
+
description: 'The App Secret from your Meta Developer Console. Go to App Settings > Basic to find it.',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
displayName: 'Setup Instructions',
|
|
66
|
+
name: 'setupNotice',
|
|
50
67
|
type: 'notice',
|
|
51
68
|
default: '',
|
|
52
|
-
description: '
|
|
69
|
+
description: 'Before connecting: 1) In Meta Developer Console, add "Facebook Login for Business" product. 2) Go to Facebook Login > Settings and add your n8n OAuth callback URL to "Valid OAuth Redirect URIs". 3) Make sure your app has instagram_basic and pages_show_list permissions.',
|
|
53
70
|
},
|
|
54
71
|
{
|
|
55
72
|
displayName: 'Webhook Verify Token',
|
|
@@ -59,7 +76,6 @@ class InstagramOAuth2Api {
|
|
|
59
76
|
default: '',
|
|
60
77
|
required: false,
|
|
61
78
|
description: 'Optional: Custom verification token for webhook setup. Only needed if using Instagram Trigger node.',
|
|
62
|
-
placeholder: 'my_custom_verify_token_2024',
|
|
63
79
|
},
|
|
64
80
|
{
|
|
65
81
|
displayName: 'Long-Lived Token',
|
|
@@ -79,7 +95,6 @@ class InstagramOAuth2Api {
|
|
|
79
95
|
];
|
|
80
96
|
/**
|
|
81
97
|
* Authenticate requests by adding access token to query string
|
|
82
|
-
* Uses longLivedToken if available, otherwise falls back to oauthTokenData.access_token
|
|
83
98
|
*/
|
|
84
99
|
this.authenticate = {
|
|
85
100
|
type: 'generic',
|
|
@@ -94,7 +109,7 @@ class InstagramOAuth2Api {
|
|
|
94
109
|
*/
|
|
95
110
|
this.test = {
|
|
96
111
|
request: {
|
|
97
|
-
baseURL: 'https://graph.facebook.com/
|
|
112
|
+
baseURL: 'https://graph.facebook.com/v24.0',
|
|
98
113
|
url: '/me',
|
|
99
114
|
method: 'GET',
|
|
100
115
|
qs: {
|
|
@@ -105,12 +120,12 @@ class InstagramOAuth2Api {
|
|
|
105
120
|
}
|
|
106
121
|
/**
|
|
107
122
|
* Pre-authentication hook that exchanges short-lived OAuth token for a long-lived token
|
|
108
|
-
* and refreshes it when near expiration.
|
|
109
123
|
*/
|
|
110
124
|
async preAuthentication(credentials) {
|
|
111
125
|
const now = Math.floor(Date.now() / 1000);
|
|
112
126
|
const longLivedToken = credentials.longLivedToken;
|
|
113
127
|
const tokenExpiresAt = credentials.tokenExpiresAt || 0;
|
|
128
|
+
const clientId = credentials.clientId;
|
|
114
129
|
const clientSecret = credentials.clientSecret;
|
|
115
130
|
const oauthTokenData = credentials.oauthTokenData;
|
|
116
131
|
const shortLivedToken = oauthTokenData?.access_token;
|
|
@@ -120,17 +135,17 @@ class InstagramOAuth2Api {
|
|
|
120
135
|
if (tokenExpiresAt > now + sevenDaysInSeconds) {
|
|
121
136
|
return {};
|
|
122
137
|
}
|
|
123
|
-
// Token near expiration, try to refresh
|
|
138
|
+
// Token near expiration, try to refresh
|
|
124
139
|
const totalLifetime = 60 * 24 * 60 * 60;
|
|
125
140
|
const tokenAge = now - (tokenExpiresAt - totalLifetime);
|
|
126
141
|
if (tokenAge >= 24 * 60 * 60) {
|
|
127
142
|
try {
|
|
128
143
|
const refreshed = (await this.helpers.httpRequest({
|
|
129
144
|
method: 'GET',
|
|
130
|
-
url: 'https://graph.facebook.com/
|
|
145
|
+
url: 'https://graph.facebook.com/v24.0/oauth/access_token',
|
|
131
146
|
qs: {
|
|
132
147
|
grant_type: 'fb_exchange_token',
|
|
133
|
-
client_id:
|
|
148
|
+
client_id: clientId,
|
|
134
149
|
client_secret: clientSecret,
|
|
135
150
|
fb_exchange_token: longLivedToken,
|
|
136
151
|
},
|
|
@@ -146,17 +161,17 @@ class InstagramOAuth2Api {
|
|
|
146
161
|
}
|
|
147
162
|
return {};
|
|
148
163
|
}
|
|
149
|
-
// No long-lived token - exchange short-lived for long-lived
|
|
164
|
+
// No long-lived token - exchange short-lived for long-lived
|
|
150
165
|
if (!shortLivedToken) {
|
|
151
166
|
return {};
|
|
152
167
|
}
|
|
153
168
|
try {
|
|
154
169
|
const exchanged = (await this.helpers.httpRequest({
|
|
155
170
|
method: 'GET',
|
|
156
|
-
url: 'https://graph.facebook.com/
|
|
171
|
+
url: 'https://graph.facebook.com/v24.0/oauth/access_token',
|
|
157
172
|
qs: {
|
|
158
173
|
grant_type: 'fb_exchange_token',
|
|
159
|
-
client_id:
|
|
174
|
+
client_id: clientId,
|
|
160
175
|
client_secret: clientSecret,
|
|
161
176
|
fb_exchange_token: shortLivedToken,
|
|
162
177
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstagramOAuth2Api.credentials.js","sourceRoot":"","sources":["../../src/credentials/InstagramOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAUA,MAAa,kBAAkB;IAA/B;QACE,SAAI,GAAG,oBAAoB,CAAC;QAC5B,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QACxB,gBAAW,GAAG,sBAAsB,CAAC;QACrC,qBAAgB,GAAG,
|
|
1
|
+
{"version":3,"file":"InstagramOAuth2Api.credentials.js","sourceRoot":"","sources":["../../src/credentials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BACP,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,4DAA4D;QAC5D,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;gBAChD,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,qDAAqD;gBAC1D,EAAE,EAAE;oBACF,UAAU,EAAE,mBAAmB;oBAC/B,SAAS,EAAE,QAAQ;oBACnB,aAAa,EAAE,YAAY;oBAC3B,iBAAiB,EAAE,eAAe;iBACnC;aACF,CAAC,CAAqE,CAAC;YAExE,OAAO;gBACL,cAAc,EAAE,SAAS,CAAC,YAAY;gBACtC,cAAc,EAAE,GAAG,GAAG,SAAS,CAAC,UAAU;aAC3C,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CAeF;AAlMD,gDAkMC"}
|
|
@@ -129,7 +129,7 @@ export declare class InstagramApiError extends Error {
|
|
|
129
129
|
toJSON(): IInstagramError;
|
|
130
130
|
}
|
|
131
131
|
export declare class InstagramApiClient {
|
|
132
|
-
protected readonly baseUrl = "https://graph.facebook.com/
|
|
132
|
+
protected readonly baseUrl = "https://graph.facebook.com/v24.0";
|
|
133
133
|
protected readonly accessToken: string;
|
|
134
134
|
protected readonly accountId: string;
|
|
135
135
|
constructor(accessToken: string, accountId: string);
|
|
@@ -34,7 +34,7 @@ class InstagramApiError extends Error {
|
|
|
34
34
|
exports.InstagramApiError = InstagramApiError;
|
|
35
35
|
class InstagramApiClient {
|
|
36
36
|
constructor(accessToken, accountId) {
|
|
37
|
-
this.baseUrl = 'https://graph.facebook.com/
|
|
37
|
+
this.baseUrl = 'https://graph.facebook.com/v24.0';
|
|
38
38
|
this.accessToken = accessToken;
|
|
39
39
|
this.accountId = accountId;
|
|
40
40
|
}
|
|
@@ -100,7 +100,7 @@ async function getInstagramBusinessAccountId() {
|
|
|
100
100
|
try {
|
|
101
101
|
const directResponse = (await this.helpers.request({
|
|
102
102
|
method: 'GET',
|
|
103
|
-
url: 'https://graph.instagram.com/
|
|
103
|
+
url: 'https://graph.instagram.com/v24.0/me',
|
|
104
104
|
qs: {
|
|
105
105
|
fields: 'id,username',
|
|
106
106
|
access_token: accessToken,
|
|
@@ -117,7 +117,7 @@ async function getInstagramBusinessAccountId() {
|
|
|
117
117
|
// Get pages connected to the user via Facebook Graph API
|
|
118
118
|
const pagesResponse = (await this.helpers.request({
|
|
119
119
|
method: 'GET',
|
|
120
|
-
url: 'https://graph.facebook.com/
|
|
120
|
+
url: 'https://graph.facebook.com/v24.0/me/accounts',
|
|
121
121
|
qs: {
|
|
122
122
|
fields: 'instagram_business_account{id,username},id,name',
|
|
123
123
|
access_token: accessToken,
|
|
@@ -163,7 +163,7 @@ async function instagramApiRequest(method, endpoint, body = {}, qs = {}) {
|
|
|
163
163
|
access_token: accessToken,
|
|
164
164
|
},
|
|
165
165
|
// Use Facebook Graph API for Instagram Business accounts
|
|
166
|
-
url: `https://graph.facebook.com/
|
|
166
|
+
url: `https://graph.facebook.com/v24.0${endpoint}`,
|
|
167
167
|
json: true,
|
|
168
168
|
};
|
|
169
169
|
if (Object.keys(body).length === 0) {
|