@mookielianhd/n8n-nodes-instagram 3.3.0 → 3.4.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.
@@ -8,6 +8,30 @@ class InstagramApi {
8
8
  this.icon = 'file:instagram.svg';
9
9
  this.documentationUrl = 'https://github.com/MookieLian/n8n-nodes-instagram#credentials';
10
10
  this.properties = [
11
+ {
12
+ displayName: 'Auth Mode',
13
+ name: 'authMode',
14
+ type: 'options',
15
+ default: 'auto',
16
+ description: 'How to use the access token for authentication and which host to use for the connection test. Use Auto unless you know you need a specific API surface.',
17
+ options: [
18
+ {
19
+ name: 'Auto (Detect by Token Prefix)',
20
+ value: 'auto',
21
+ description: 'If the token starts with "IG", use graph.instagram.com (Bearer auth). Otherwise, use graph.facebook.com (access_token query).',
22
+ },
23
+ {
24
+ name: 'Graph API (graph.facebook.com)',
25
+ value: 'graph',
26
+ description: 'Use Facebook Graph API style (graph.facebook.com) with access_token query parameter. Common for Instagram Graph API publishing flows.',
27
+ },
28
+ {
29
+ name: 'Instagram API (graph.instagram.com)',
30
+ value: 'instagram',
31
+ description: 'Use Instagram API style (graph.instagram.com) with Authorization: Bearer <token>. Common for IG-prefixed tokens.',
32
+ },
33
+ ],
34
+ },
11
35
  {
12
36
  displayName: 'Access Token',
13
37
  name: 'accessToken',
@@ -21,6 +45,9 @@ class InstagramApi {
21
45
  this.authenticate = {
22
46
  type: 'generic',
23
47
  properties: {
48
+ headers: {
49
+ Authorization: '={{"Bearer " + $credentials.accessToken}}',
50
+ },
24
51
  qs: {
25
52
  access_token: '={{$credentials.accessToken}}',
26
53
  },
@@ -29,7 +56,15 @@ class InstagramApi {
29
56
  this.test = {
30
57
  request: {
31
58
  method: 'GET',
32
- url: 'https://graph.facebook.com/v22.0/me',
59
+ url: '={{(() => {\n' +
60
+ ' const token = String($credentials.accessToken || "");\n' +
61
+ ' const authMode = String($credentials.authMode || "auto");\n' +
62
+ ' const isIgPrefixed = token.startsWith("IG");\n' +
63
+ ' const mode = authMode === "auto" ? (isIgPrefixed ? "instagram" : "graph") : authMode;\n' +
64
+ ' return mode === "instagram"\n' +
65
+ ' ? "https://graph.instagram.com/v21.0/me"\n' +
66
+ ' : "https://graph.facebook.com/v22.0/me";\n' +
67
+ '})()}}',
33
68
  qs: {
34
69
  fields: 'id',
35
70
  },
@@ -1 +1 @@
1
- {"version":3,"file":"InstagramApi.credentials.js","sourceRoot":"","sources":["../../credentials/InstagramApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,eAAe,CAAC;QAC9B,SAAI,GAAS,oBAAoB,CAAC;QAClC,qBAAgB,GAAG,+DAA+D,CAAC;QACnF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,gEAAgE;aAC7E;SACD,CAAC;QACF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,EAAE,EAAE;oBACH,YAAY,EAAE,+BAA+B;iBAC7C;aACD;SACD,CAAC;QACF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,qCAAqC;gBAC1C,EAAE,EAAE;oBACH,MAAM,EAAE,IAAI;iBACZ;aACD;SACD,CAAC;IACH,CAAC;CAAA;AAjCD,oCAiCC"}
1
+ {"version":3,"file":"InstagramApi.credentials.js","sourceRoot":"","sources":["../../credentials/InstagramApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,eAAe,CAAC;QAC9B,SAAI,GAAS,oBAAoB,CAAC;QAClC,qBAAgB,GAAG,+DAA+D,CAAC;QACnF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,MAAM;gBACf,WAAW,EACV,yJAAyJ;gBAC1J,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,+BAA+B;wBACrC,KAAK,EAAE,MAAM;wBACb,WAAW,EACV,+HAA+H;qBAChI;oBACD;wBACC,IAAI,EAAE,gCAAgC;wBACtC,KAAK,EAAE,OAAO;wBACd,WAAW,EACV,uIAAuI;qBACxI;oBACD;wBACC,IAAI,EAAE,qCAAqC;wBAC3C,KAAK,EAAE,WAAW;wBAClB,WAAW,EACV,kHAAkH;qBACnH;iBACD;aACD;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,gEAAgE;aAC7E;SACD,CAAC;QACF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,2CAA2C;iBAC1D;gBACD,EAAE,EAAE;oBACH,YAAY,EAAE,+BAA+B;iBAC7C;aACD;SACD,CAAC;QACF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,MAAM,EAAE,KAAK;gBACb,GAAG,EACF,eAAe;oBACf,2DAA2D;oBAC3D,+DAA+D;oBAC/D,kDAAkD;oBAClD,2FAA2F;oBAC3F,iCAAiC;oBACjC,gDAAgD;oBAChD,gDAAgD;oBAChD,QAAQ;gBACT,EAAE,EAAE;oBACH,MAAM,EAAE,IAAI;iBACZ;aACD;SACD,CAAC;IACH,CAAC;CAAA;AAzED,oCAyEC"}
@@ -908,7 +908,7 @@ class Instagram {
908
908
  };
909
909
  }
910
910
  async execute() {
911
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
911
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
912
912
  const items = this.getInputData();
913
913
  const returnItems = [];
914
914
  const hostUrl = 'graph.facebook.com';
@@ -1106,7 +1106,14 @@ class Instagram {
1106
1106
  }
1107
1107
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to get message text parameter at item index ${itemIndex}: ${error instanceof Error ? error.message : String(error)}`, { itemIndex });
1108
1108
  }
1109
- const url = `https://${hostUrl}/${graphApiVersion}/${accountId}/messages`;
1109
+ const credentials = (await this.getCredentials('instagramApi'));
1110
+ const accessToken = (_a = credentials === null || credentials === void 0 ? void 0 : credentials.accessToken) !== null && _a !== void 0 ? _a : '';
1111
+ const authMode = (_b = credentials === null || credentials === void 0 ? void 0 : credentials.authMode) !== null && _b !== void 0 ? _b : 'auto';
1112
+ const isIgPrefixed = accessToken.startsWith('IG');
1113
+ const mode = authMode === 'auto' ? (isIgPrefixed ? 'instagram' : 'graph') : authMode;
1114
+ const url = mode === 'instagram'
1115
+ ? `https://graph.instagram.com/${graphApiVersion}/me/messages`
1116
+ : `https://${hostUrl}/${graphApiVersion}/${accountId}/messages`;
1110
1117
  const requestOptions = {
1111
1118
  headers: {
1112
1119
  accept: 'application/json,text/*;q=0.99',
@@ -1149,7 +1156,7 @@ class Instagram {
1149
1156
  let errorItem;
1150
1157
  const errorWithGraph = error;
1151
1158
  if (errorWithGraph.response !== undefined) {
1152
- const graphApiErrors = (_b = (_a = errorWithGraph.response.body) === null || _a === void 0 ? void 0 : _a.error) !== null && _b !== void 0 ? _b : {};
1159
+ const graphApiErrors = (_d = (_c = errorWithGraph.response.body) === null || _c === void 0 ? void 0 : _c.error) !== null && _d !== void 0 ? _d : {};
1153
1160
  errorItem = {
1154
1161
  statusCode: errorWithGraph.statusCode,
1155
1162
  ...graphApiErrors,
@@ -1166,7 +1173,7 @@ class Instagram {
1166
1173
  if (resource === 'auth') {
1167
1174
  try {
1168
1175
  if (operation === 'refreshAccessToken') {
1169
- let token = (_c = this.getNodeParameter('accessToken', itemIndex, '')) !== null && _c !== void 0 ? _c : '';
1176
+ let token = (_e = this.getNodeParameter('accessToken', itemIndex, '')) !== null && _e !== void 0 ? _e : '';
1170
1177
  if (!token) {
1171
1178
  let credentials;
1172
1179
  try {
@@ -1178,7 +1185,7 @@ class Instagram {
1178
1185
  if (!credentials) {
1179
1186
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Instagram API credentials not found. Please configure the Instagram API credential.', { itemIndex });
1180
1187
  }
1181
- token = (_d = credentials === null || credentials === void 0 ? void 0 : credentials.accessToken) !== null && _d !== void 0 ? _d : '';
1188
+ token = (_f = credentials === null || credentials === void 0 ? void 0 : credentials.accessToken) !== null && _f !== void 0 ? _f : '';
1182
1189
  }
1183
1190
  if (!token || typeof token !== 'string') {
1184
1191
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No access token provided and no access token found in the Instagram API credential. Please provide an access token or configure it in the credential.', { itemIndex });
@@ -1304,7 +1311,7 @@ class Instagram {
1304
1311
  let errorItem;
1305
1312
  const errorWithGraph = error;
1306
1313
  if (errorWithGraph.response !== undefined) {
1307
- const graphApiErrors = (_f = (_e = errorWithGraph.response.body) === null || _e === void 0 ? void 0 : _e.error) !== null && _f !== void 0 ? _f : {};
1314
+ const graphApiErrors = (_h = (_g = errorWithGraph.response.body) === null || _g === void 0 ? void 0 : _g.error) !== null && _h !== void 0 ? _h : {};
1308
1315
  errorItem = {
1309
1316
  statusCode: errorWithGraph.statusCode,
1310
1317
  ...graphApiErrors,
@@ -1386,7 +1393,7 @@ class Instagram {
1386
1393
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid carousel media array field name at item index ${itemIndex}. Field name must be a non-empty string.`, { itemIndex });
1387
1394
  }
1388
1395
  const mediaTypeMode = this.getNodeParameter('carouselMediaArrayType', itemIndex, 'auto');
1389
- const itemJson = (_g = items[itemIndex]) === null || _g === void 0 ? void 0 : _g.json;
1396
+ const itemJson = (_j = items[itemIndex]) === null || _j === void 0 ? void 0 : _j.json;
1390
1397
  const rawArray = resolveFieldPath(itemJson, fieldName);
1391
1398
  if (!Array.isArray(rawArray)) {
1392
1399
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid carousel media array at item index ${itemIndex}. The field "${fieldName}" must contain an array.`, { itemIndex });
@@ -1468,7 +1475,7 @@ class Instagram {
1468
1475
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to get carousel media parameter at item index ${itemIndex}: ${error instanceof Error ? error.message : String(error)}`, { itemIndex });
1469
1476
  }
1470
1477
  }
1471
- const mediaItems = (_h = carouselMedia === null || carouselMedia === void 0 ? void 0 : carouselMedia.mediaItem) !== null && _h !== void 0 ? _h : [];
1478
+ const mediaItems = (_k = carouselMedia === null || carouselMedia === void 0 ? void 0 : carouselMedia.mediaItem) !== null && _k !== void 0 ? _k : [];
1472
1479
  if (!Array.isArray(mediaItems)) {
1473
1480
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid carousel media items format at item index ${itemIndex}. Media items must be an array.`, { itemIndex });
1474
1481
  }
@@ -1492,7 +1499,7 @@ class Instagram {
1492
1499
  if (item.mediaType !== 'image' && item.mediaType !== 'video') {
1493
1500
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `${mediaLabel}: Invalid media type '${item.mediaType}'. Media type must be either 'image' or 'video'.`, { itemIndex });
1494
1501
  }
1495
- const url = isVideo ? ((_j = item.videoUrl) !== null && _j !== void 0 ? _j : '').trim() : ((_k = item.imageUrl) !== null && _k !== void 0 ? _k : '').trim();
1502
+ const url = isVideo ? ((_l = item.videoUrl) !== null && _l !== void 0 ? _l : '').trim() : ((_m = item.imageUrl) !== null && _m !== void 0 ? _m : '').trim();
1496
1503
  if (!url || typeof url !== 'string') {
1497
1504
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `${mediaLabel}: ${isVideo ? 'Video URL' : 'Image URL'} is required and must be a non-empty string.`, { itemIndex });
1498
1505
  }
@@ -1594,11 +1601,11 @@ class Instagram {
1594
1601
  const errorItem = errorWithGraph.response !== undefined
1595
1602
  ? {
1596
1603
  statusCode: errorWithGraph.statusCode,
1597
- ...((_m = (_l = errorWithGraph.response.body) === null || _l === void 0 ? void 0 : _l.error) !== null && _m !== void 0 ? _m : {}),
1604
+ ...((_p = (_o = errorWithGraph.response.body) === null || _o === void 0 ? void 0 : _o.error) !== null && _p !== void 0 ? _p : {}),
1598
1605
  headers: errorWithGraph.response.headers,
1599
1606
  }
1600
1607
  : error;
1601
- const contextMessage = error instanceof Error ? error.message : String((_o = error.message) !== null && _o !== void 0 ? _o : error);
1608
+ const contextMessage = error instanceof Error ? error.message : String((_q = error.message) !== null && _q !== void 0 ? _q : error);
1602
1609
  returnItems.push({
1603
1610
  json: { ...errorItem, carouselErrorContext: contextMessage },
1604
1611
  pairedItem: { item: itemIndex },
@@ -1768,13 +1775,13 @@ class Instagram {
1768
1775
  }
1769
1776
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to fetch ${edge} for hashtag ${hashtagId} at page ${pageNumber}: ${error instanceof Error ? error.message : String(error)}`, { itemIndex });
1770
1777
  }
1771
- const pageData = (_p = response.data) !== null && _p !== void 0 ? _p : [];
1778
+ const pageData = (_r = response.data) !== null && _r !== void 0 ? _r : [];
1772
1779
  if (!Array.isArray(pageData)) {
1773
1780
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid data format in response from ${edge} API at page ${pageNumber}. Expected array, got: ${typeof pageData}. Response: ${JSON.stringify(response)}`, { itemIndex });
1774
1781
  }
1775
1782
  accumulated.push(...pageData);
1776
1783
  const paging = response.paging;
1777
- after = (_q = paging === null || paging === void 0 ? void 0 : paging.cursors) === null || _q === void 0 ? void 0 : _q.after;
1784
+ after = (_s = paging === null || paging === void 0 ? void 0 : paging.cursors) === null || _s === void 0 ? void 0 : _s.after;
1778
1785
  if ((!returnAll && accumulated.length >= hardCap) || !after) {
1779
1786
  hasMore = false;
1780
1787
  }
@@ -1792,7 +1799,7 @@ class Instagram {
1792
1799
  let errorItem;
1793
1800
  const errorWithGraph = error;
1794
1801
  if (errorWithGraph.response !== undefined) {
1795
- const graphApiErrors = (_s = (_r = errorWithGraph.response.body) === null || _r === void 0 ? void 0 : _r.error) !== null && _s !== void 0 ? _s : {};
1802
+ const graphApiErrors = (_u = (_t = errorWithGraph.response.body) === null || _t === void 0 ? void 0 : _t.error) !== null && _u !== void 0 ? _u : {};
1796
1803
  errorItem = {
1797
1804
  statusCode: errorWithGraph.statusCode,
1798
1805
  ...graphApiErrors,
@@ -1872,7 +1879,7 @@ class Instagram {
1872
1879
  let errorItem;
1873
1880
  const errorWithGraph = error;
1874
1881
  if (errorWithGraph.response !== undefined) {
1875
- const graphApiErrors = (_u = (_t = errorWithGraph.response.body) === null || _t === void 0 ? void 0 : _t.error) !== null && _u !== void 0 ? _u : {};
1882
+ const graphApiErrors = (_w = (_v = errorWithGraph.response.body) === null || _v === void 0 ? void 0 : _v.error) !== null && _w !== void 0 ? _w : {};
1876
1883
  errorItem = {
1877
1884
  statusCode: errorWithGraph.statusCode,
1878
1885
  ...graphApiErrors,
@@ -2029,13 +2036,13 @@ class Instagram {
2029
2036
  }
2030
2037
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to fetch media for account ${accountId} at page ${pageNumber}: ${error instanceof Error ? error.message : String(error)}`, { itemIndex });
2031
2038
  }
2032
- const pageData = (_v = response.data) !== null && _v !== void 0 ? _v : [];
2039
+ const pageData = (_x = response.data) !== null && _x !== void 0 ? _x : [];
2033
2040
  if (!Array.isArray(pageData)) {
2034
2041
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid data format in response from IG User media API at page ${pageNumber}. Expected array, got: ${typeof pageData}. Response: ${JSON.stringify(response)}`, { itemIndex });
2035
2042
  }
2036
2043
  accumulated.push(...pageData);
2037
2044
  const paging = response.paging;
2038
- after = (_w = paging === null || paging === void 0 ? void 0 : paging.cursors) === null || _w === void 0 ? void 0 : _w.after;
2045
+ after = (_y = paging === null || paging === void 0 ? void 0 : paging.cursors) === null || _y === void 0 ? void 0 : _y.after;
2039
2046
  if ((!returnAll && accumulated.length >= hardCap) || !after) {
2040
2047
  hasMore = false;
2041
2048
  }
@@ -2053,7 +2060,7 @@ class Instagram {
2053
2060
  let errorItem;
2054
2061
  const errorWithGraph = error;
2055
2062
  if (errorWithGraph.response !== undefined) {
2056
- const graphApiErrors = (_y = (_x = errorWithGraph.response.body) === null || _x === void 0 ? void 0 : _x.error) !== null && _y !== void 0 ? _y : {};
2063
+ const graphApiErrors = (_0 = (_z = errorWithGraph.response.body) === null || _z === void 0 ? void 0 : _z.error) !== null && _0 !== void 0 ? _0 : {};
2057
2064
  errorItem = {
2058
2065
  statusCode: errorWithGraph.statusCode,
2059
2066
  ...graphApiErrors,
@@ -2286,7 +2293,14 @@ class Instagram {
2286
2293
  }
2287
2294
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to get private reply text parameter at item index ${itemIndex}: ${error instanceof Error ? error.message : String(error)}`, { itemIndex });
2288
2295
  }
2289
- const url = `https://${hostUrl}/${graphApiVersion}/${accountId}/messages`;
2296
+ const credentials = (await this.getCredentials('instagramApi'));
2297
+ const accessToken = (_1 = credentials === null || credentials === void 0 ? void 0 : credentials.accessToken) !== null && _1 !== void 0 ? _1 : '';
2298
+ const authMode = (_2 = credentials === null || credentials === void 0 ? void 0 : credentials.authMode) !== null && _2 !== void 0 ? _2 : 'auto';
2299
+ const isIgPrefixed = accessToken.startsWith('IG');
2300
+ const mode = authMode === 'auto' ? (isIgPrefixed ? 'instagram' : 'graph') : authMode;
2301
+ const url = mode === 'instagram'
2302
+ ? `https://graph.instagram.com/${graphApiVersion}/me/messages`
2303
+ : `https://${hostUrl}/${graphApiVersion}/${accountId}/messages`;
2290
2304
  const requestOptions = {
2291
2305
  headers: {
2292
2306
  accept: 'application/json,text/*;q=0.99',
@@ -2329,7 +2343,7 @@ class Instagram {
2329
2343
  let errorItem;
2330
2344
  const errorWithGraph = error;
2331
2345
  if (errorWithGraph.response !== undefined) {
2332
- const graphApiErrors = (_0 = (_z = errorWithGraph.response.body) === null || _z === void 0 ? void 0 : _z.error) !== null && _0 !== void 0 ? _0 : {};
2346
+ const graphApiErrors = (_4 = (_3 = errorWithGraph.response.body) === null || _3 === void 0 ? void 0 : _3.error) !== null && _4 !== void 0 ? _4 : {};
2333
2347
  errorItem = {
2334
2348
  statusCode: errorWithGraph.statusCode,
2335
2349
  ...graphApiErrors,
@@ -2404,7 +2418,7 @@ class Instagram {
2404
2418
  }
2405
2419
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to get additional fields parameter at item index ${itemIndex}: ${error instanceof Error ? error.message : String(error)}`, { itemIndex });
2406
2420
  }
2407
- const altText = (_1 = additionalFields.altText) !== null && _1 !== void 0 ? _1 : '';
2421
+ const altText = (_5 = additionalFields.altText) !== null && _5 !== void 0 ? _5 : '';
2408
2422
  const rawLocationId = additionalFields.locationId;
2409
2423
  const userTagsCollection = additionalFields.userTags;
2410
2424
  const productTagsCollection = additionalFields.productTags;
@@ -2548,7 +2562,7 @@ class Instagram {
2548
2562
  let errorCode;
2549
2563
  let errorType;
2550
2564
  const err = error;
2551
- if ((_3 = (_2 = err.response) === null || _2 === void 0 ? void 0 : _2.body) === null || _3 === void 0 ? void 0 : _3.error) {
2565
+ if ((_7 = (_6 = err.response) === null || _6 === void 0 ? void 0 : _6.body) === null || _7 === void 0 ? void 0 : _7.error) {
2552
2566
  const graphError = err.response.body.error;
2553
2567
  errorMessage = graphError.message || errorMessage;
2554
2568
  errorCode = graphError.code;
@@ -2574,7 +2588,7 @@ class Instagram {
2574
2588
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to create media container: The ${videoUrl ? 'video' : 'image'} URL appears to be invalid or unreachable. Error: ${errorMessage}${errorCode ? ` (Code: ${errorCode})` : ''}. Please verify that the URL is accessible and points to a valid ${videoUrl ? 'video' : 'image'} file. URL: ${urlToCheck.substring(0, 100)}${urlToCheck.length > 100 ? '...' : ''}`, { itemIndex });
2575
2589
  }
2576
2590
  if (!this.continueOnFail()) {
2577
- const errorObj = (_5 = (_4 = err.response) === null || _4 === void 0 ? void 0 : _4.body) === null || _5 === void 0 ? void 0 : _5.error;
2591
+ const errorObj = (_9 = (_8 = err.response) === null || _8 === void 0 ? void 0 : _8.body) === null || _9 === void 0 ? void 0 : _9.error;
2578
2592
  const detailedError = {
2579
2593
  message: errorMessage,
2580
2594
  ...(errorCode && { code: errorCode }),
@@ -2597,7 +2611,7 @@ class Instagram {
2597
2611
  }
2598
2612
  let errorItem;
2599
2613
  if (err.response !== undefined) {
2600
- const graphApiErrors = (_7 = (_6 = err.response.body) === null || _6 === void 0 ? void 0 : _6.error) !== null && _7 !== void 0 ? _7 : {};
2614
+ const graphApiErrors = (_11 = (_10 = err.response.body) === null || _10 === void 0 ? void 0 : _10.error) !== null && _11 !== void 0 ? _11 : {};
2601
2615
  errorItem = {
2602
2616
  statusCode: err.statusCode,
2603
2617
  ...graphApiErrors,
@@ -2708,7 +2722,7 @@ class Instagram {
2708
2722
  let errorItem;
2709
2723
  const err = error;
2710
2724
  if (err.response !== undefined) {
2711
- const graphApiErrors = (_9 = (_8 = err.response.body) === null || _8 === void 0 ? void 0 : _8.error) !== null && _9 !== void 0 ? _9 : {};
2725
+ const graphApiErrors = (_13 = (_12 = err.response.body) === null || _12 === void 0 ? void 0 : _12.error) !== null && _13 !== void 0 ? _13 : {};
2712
2726
  errorItem = {
2713
2727
  statusCode: err.statusCode,
2714
2728
  ...graphApiErrors,
@@ -2754,7 +2768,7 @@ class Instagram {
2754
2768
  let errorItem;
2755
2769
  const errorWithGraph = error;
2756
2770
  if (errorWithGraph.response !== undefined) {
2757
- const graphApiErrors = (_11 = (_10 = errorWithGraph.response.body) === null || _10 === void 0 ? void 0 : _10.error) !== null && _11 !== void 0 ? _11 : {};
2771
+ const graphApiErrors = (_15 = (_14 = errorWithGraph.response.body) === null || _14 === void 0 ? void 0 : _14.error) !== null && _15 !== void 0 ? _15 : {};
2758
2772
  errorItem = {
2759
2773
  statusCode: errorWithGraph.statusCode,
2760
2774
  ...graphApiErrors,