@skillful-ai/piece-skai-instagram-business 0.0.3 → 0.0.4
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/README.md +7 -7
- package/package.json +1 -1
- package/src/index.js +10 -0
- package/src/index.js.map +1 -1
- package/src/lib/actions/get-comments.d.ts +12 -0
- package/src/lib/actions/get-comments.js +75 -0
- package/src/lib/actions/get-comments.js.map +1 -0
- package/src/lib/actions/get-media.d.ts +11 -0
- package/src/lib/actions/get-media.js +69 -0
- package/src/lib/actions/get-media.js.map +1 -0
- package/src/lib/actions/get-mentions.d.ts +13 -0
- package/src/lib/actions/get-mentions.js +130 -0
- package/src/lib/actions/get-mentions.js.map +1 -0
- package/src/lib/actions/post-comment.d.ts +11 -0
- package/src/lib/actions/post-comment.js +71 -0
- package/src/lib/actions/post-comment.js.map +1 -0
- package/src/lib/actions/reply-to-comment.d.ts +11 -0
- package/src/lib/actions/reply-to-comment.js +71 -0
- package/src/lib/actions/reply-to-comment.js.map +1 -0
- package/src/lib/actions/upload-photo.js +16 -16
- package/src/lib/actions/upload-reel.js +18 -18
- package/src/lib/auth/instagram-business.auth.js +25 -25
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# pieces-skai-instagram-business
|
|
2
|
-
|
|
3
|
-
This library was generated with [Nx](https://nx.dev).
|
|
4
|
-
|
|
5
|
-
## Building
|
|
6
|
-
|
|
7
|
-
Run `nx build pieces-skai-instagram-business` to build the library.
|
|
1
|
+
# pieces-skai-instagram-business
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
Run `nx build pieces-skai-instagram-business` to build the library.
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -8,6 +8,11 @@ const instagram_business_auth_1 = require("./lib/auth/instagram-business.auth");
|
|
|
8
8
|
const send_message_1 = require("./lib/actions/send-message");
|
|
9
9
|
const upload_photo_1 = require("./lib/actions/upload-photo");
|
|
10
10
|
const upload_reel_1 = require("./lib/actions/upload-reel");
|
|
11
|
+
const get_media_1 = require("./lib/actions/get-media");
|
|
12
|
+
const get_comments_1 = require("./lib/actions/get-comments");
|
|
13
|
+
const reply_to_comment_1 = require("./lib/actions/reply-to-comment");
|
|
14
|
+
const post_comment_1 = require("./lib/actions/post-comment");
|
|
15
|
+
const get_mentions_1 = require("./lib/actions/get-mentions");
|
|
11
16
|
// Triggers
|
|
12
17
|
const new_message_1 = require("./lib/triggers/new-message");
|
|
13
18
|
exports.skaiInstagramBusiness = (0, pieces_framework_1.createPiece)({
|
|
@@ -36,6 +41,11 @@ exports.skaiInstagramBusiness = (0, pieces_framework_1.createPiece)({
|
|
|
36
41
|
send_message_1.sendMessage,
|
|
37
42
|
upload_photo_1.uploadPhoto,
|
|
38
43
|
upload_reel_1.uploadReel,
|
|
44
|
+
get_media_1.getMedia,
|
|
45
|
+
get_comments_1.getComments,
|
|
46
|
+
reply_to_comment_1.replyToComment,
|
|
47
|
+
post_comment_1.postComment,
|
|
48
|
+
get_mentions_1.getMentions,
|
|
39
49
|
],
|
|
40
50
|
triggers: [
|
|
41
51
|
new_message_1.newInstagramMessage,
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/skai-instagram-business/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,gFAA2E;AAE3E,UAAU;AACV,6DAAyD;AACzD,6DAAyD;AACzD,2DAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/skai-instagram-business/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,gFAA2E;AAE3E,UAAU;AACV,6DAAyD;AACzD,6DAAyD;AACzD,2DAAuD;AACvD,uDAAmD;AACnD,6DAAyD;AACzD,qEAAgE;AAChE,6DAAyD;AACzD,6DAAyD;AAEzD,WAAW;AACX,4DAAiE;AAEpD,QAAA,qBAAqB,GAAG,IAAA,8BAAW,EAAC;IAC7C,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,+CAAqB;IAC3B,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,mDAAmD;IAC5D,OAAO,EAAE,CAAC,sBAAsB,EAAE,aAAa,CAAC;IAChD,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,EAAE,sBAAa,CAAC,SAAS,CAAC;IAClE,MAAM,EAAE;QACJ,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;;YAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAW,CAAC;YACjC,MAAM,WAAW,GAAG,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,0CAAE,EAAE,MAAI,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAG,CAAC,CAAC,0CAAE,EAAE,CAAA,CAAC;YAChE,OAAO;gBACH,KAAK,EAAE,uBAAuB;gBAC9B,eAAe,EAAE,WAAW;aAC/B,CAAC;QACN,CAAC;QACD,MAAM,EAAE,GAAG,EAAE;YACT,OAAO,IAAI,CAAC;QAChB,CAAC;KACJ;IACD,OAAO,EAAE;QACL,0BAAW;QACX,0BAAW;QACX,wBAAU;QACV,oBAAQ;QACR,0BAAW;QACX,iCAAc;QACd,0BAAW;QACX,0BAAW;KACd;IACD,QAAQ,EAAE;QACN,iCAAmB;KACtB;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const getComments: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
instagramAccountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
instagramUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenExpiresAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
refreshThresholdDays: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>, {
|
|
9
|
+
mediaId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
11
|
+
after: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getComments = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const instagram_business_auth_1 = require("../auth/instagram-business.auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const description = `
|
|
10
|
+
## Get Comments
|
|
11
|
+
|
|
12
|
+
Retrieve comments on a specific media post from your Instagram Business Account.
|
|
13
|
+
|
|
14
|
+
### Input Parameters
|
|
15
|
+
- **Media ID** (required): The ID of the media to get comments from
|
|
16
|
+
- **Limit**: Number of comments to retrieve (default: 50, max: 100)
|
|
17
|
+
- **After Cursor**: Pagination cursor for fetching next page
|
|
18
|
+
|
|
19
|
+
### Output
|
|
20
|
+
Returns an array of comment objects with id, text, username, timestamp, like_count, and replies.
|
|
21
|
+
`;
|
|
22
|
+
exports.getComments = (0, pieces_framework_1.createAction)({
|
|
23
|
+
auth: instagram_business_auth_1.instagramBusinessAuth,
|
|
24
|
+
name: 'get_comments',
|
|
25
|
+
displayName: 'Get Comments',
|
|
26
|
+
description: 'Get comments on a specific media post',
|
|
27
|
+
props: {
|
|
28
|
+
mediaId: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'Media ID',
|
|
30
|
+
description: 'The ID of the media post to get comments from',
|
|
31
|
+
required: true,
|
|
32
|
+
}),
|
|
33
|
+
limit: pieces_framework_1.Property.Number({
|
|
34
|
+
displayName: 'Limit',
|
|
35
|
+
description: 'Number of comments to retrieve (max 100)',
|
|
36
|
+
required: false,
|
|
37
|
+
defaultValue: 50,
|
|
38
|
+
}),
|
|
39
|
+
after: pieces_framework_1.Property.ShortText({
|
|
40
|
+
displayName: 'After Cursor',
|
|
41
|
+
description: 'Pagination cursor for fetching next page',
|
|
42
|
+
required: false,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
run(context) {
|
|
46
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const auth = context.auth;
|
|
48
|
+
const { mediaId, limit, after } = context.propsValue;
|
|
49
|
+
const { accessToken } = yield common_1.instagramTokenService.getValidToken({
|
|
50
|
+
auth,
|
|
51
|
+
server: context.server,
|
|
52
|
+
project: context.project,
|
|
53
|
+
});
|
|
54
|
+
const queryParams = {
|
|
55
|
+
access_token: accessToken,
|
|
56
|
+
fields: 'id,text,username,timestamp,like_count,replies{id,text,username,timestamp,like_count}',
|
|
57
|
+
limit: String(Math.min(limit || 50, 100)),
|
|
58
|
+
};
|
|
59
|
+
if (after) {
|
|
60
|
+
queryParams['after'] = after;
|
|
61
|
+
}
|
|
62
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
63
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
64
|
+
url: `${common_1.INSTAGRAM_GRAPH_API_BASE}/${mediaId}/comments`,
|
|
65
|
+
queryParams,
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
comments: response.body.data || [],
|
|
70
|
+
paging: response.body.paging || null,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=get-comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-comments.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-instagram-business/src/lib/actions/get-comments.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6EAAoG;AACpG,sCAA4E;AAE5E,MAAM,WAAW,GAAG;;;;;;;;;;;;CAYnB,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,+CAAqB;IAC3B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACH,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACnB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,KAAK;SAClB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,IAAI,GAAG,OAAO,CAAC,IAAkC,CAAC;YACxD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAErD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,8BAAqB,CAAC,aAAa,CAAC;gBAC9D,IAAI;gBACJ,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;aAC3B,CAAC,CAAC;YAEH,MAAM,WAAW,GAA2B;gBACxC,YAAY,EAAE,WAAW;gBACzB,MAAM,EAAE,sFAAsF;gBAC9F,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;aAC5C,CAAC;YAEF,IAAI,KAAK,EAAE,CAAC;gBACR,WAAW,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACjC,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,iCAAwB,IAAI,OAAO,WAAW;gBACtD,WAAW;aACd,CAAC,CAAC;YAEH,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE;gBAClC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI;aACvC,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const getMedia: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
instagramAccountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
instagramUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenExpiresAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
refreshThresholdDays: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>, {
|
|
9
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
10
|
+
after: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMedia = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const instagram_business_auth_1 = require("../auth/instagram-business.auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const description = `
|
|
10
|
+
## Get Media
|
|
11
|
+
|
|
12
|
+
Retrieve a list of media (posts, reels, carousels) from your Instagram Business Account.
|
|
13
|
+
|
|
14
|
+
### Input Parameters
|
|
15
|
+
- **Limit**: Number of media items to retrieve (default: 25, max: 100)
|
|
16
|
+
- **After Cursor**: Pagination cursor for fetching next page
|
|
17
|
+
|
|
18
|
+
### Output
|
|
19
|
+
Returns an array of media objects with id, caption, media_type, timestamp, permalink, and like/comment counts.
|
|
20
|
+
`;
|
|
21
|
+
exports.getMedia = (0, pieces_framework_1.createAction)({
|
|
22
|
+
auth: instagram_business_auth_1.instagramBusinessAuth,
|
|
23
|
+
name: 'get_media',
|
|
24
|
+
displayName: 'Get Media',
|
|
25
|
+
description: 'Get a list of media posts from your Instagram Business Account',
|
|
26
|
+
props: {
|
|
27
|
+
limit: pieces_framework_1.Property.Number({
|
|
28
|
+
displayName: 'Limit',
|
|
29
|
+
description: 'Number of media items to retrieve (max 100)',
|
|
30
|
+
required: false,
|
|
31
|
+
defaultValue: 25,
|
|
32
|
+
}),
|
|
33
|
+
after: pieces_framework_1.Property.ShortText({
|
|
34
|
+
displayName: 'After Cursor',
|
|
35
|
+
description: 'Pagination cursor for fetching next page',
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
run(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const auth = context.auth;
|
|
42
|
+
const { limit, after } = context.propsValue;
|
|
43
|
+
const { accessToken } = yield common_1.instagramTokenService.getValidToken({
|
|
44
|
+
auth,
|
|
45
|
+
server: context.server,
|
|
46
|
+
project: context.project,
|
|
47
|
+
});
|
|
48
|
+
const queryParams = {
|
|
49
|
+
access_token: accessToken,
|
|
50
|
+
fields: 'id,caption,media_type,media_url,thumbnail_url,permalink,timestamp,like_count,comments_count',
|
|
51
|
+
limit: String(Math.min(limit || 25, 100)),
|
|
52
|
+
};
|
|
53
|
+
if (after) {
|
|
54
|
+
queryParams['after'] = after;
|
|
55
|
+
}
|
|
56
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
57
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
58
|
+
url: `${common_1.INSTAGRAM_GRAPH_API_BASE}/${auth.instagramAccountId}/media`,
|
|
59
|
+
queryParams,
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
success: true,
|
|
63
|
+
media: response.body.data || [],
|
|
64
|
+
paging: response.body.paging || null,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=get-media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-media.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-instagram-business/src/lib/actions/get-media.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6EAAoG;AACpG,sCAA4E;AAE5E,MAAM,WAAW,GAAG;;;;;;;;;;;CAWnB,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACjC,IAAI,EAAE,+CAAqB;IAC3B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,gEAAgE;IAC7E,KAAK,EAAE;QACH,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAA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activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
instagramAccountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
instagramUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenExpiresAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
refreshThresholdDays: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>, {
|
|
9
|
+
includeTags: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
+
includeCaptionMentions: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
11
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
12
|
+
after: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMentions = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const instagram_business_auth_1 = require("../auth/instagram-business.auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const description = `
|
|
10
|
+
## Get Mentions
|
|
11
|
+
|
|
12
|
+
Retrieve posts where your Instagram Business Account has been tagged or @mentioned.
|
|
13
|
+
|
|
14
|
+
### Input Parameters
|
|
15
|
+
- **Include Tags**: Include posts where you are tagged in the photo
|
|
16
|
+
- **Include Caption Mentions**: Include posts where you are @mentioned in the caption
|
|
17
|
+
- **Limit**: Number of items to retrieve (default: 25, max: 100)
|
|
18
|
+
|
|
19
|
+
### Output
|
|
20
|
+
Returns arrays of tagged media and mentioned media with id, caption, media_type, timestamp, permalink, and owner info.
|
|
21
|
+
`;
|
|
22
|
+
exports.getMentions = (0, pieces_framework_1.createAction)({
|
|
23
|
+
auth: instagram_business_auth_1.instagramBusinessAuth,
|
|
24
|
+
name: 'get_mentions',
|
|
25
|
+
displayName: 'Get Mentions & Tags',
|
|
26
|
+
description: 'Get posts where your account was tagged or @mentioned',
|
|
27
|
+
props: {
|
|
28
|
+
includeTags: pieces_framework_1.Property.Checkbox({
|
|
29
|
+
displayName: 'Include Tags',
|
|
30
|
+
description: 'Include posts where you are tagged in the photo',
|
|
31
|
+
required: false,
|
|
32
|
+
defaultValue: true,
|
|
33
|
+
}),
|
|
34
|
+
includeCaptionMentions: pieces_framework_1.Property.Checkbox({
|
|
35
|
+
displayName: 'Include Caption Mentions',
|
|
36
|
+
description: 'Include posts where you are @mentioned in the caption (requires instagram_business_manage_messages permission)',
|
|
37
|
+
required: false,
|
|
38
|
+
defaultValue: true,
|
|
39
|
+
}),
|
|
40
|
+
limit: pieces_framework_1.Property.Number({
|
|
41
|
+
displayName: 'Limit',
|
|
42
|
+
description: 'Number of items to retrieve per type (max 100)',
|
|
43
|
+
required: false,
|
|
44
|
+
defaultValue: 25,
|
|
45
|
+
}),
|
|
46
|
+
after: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'After Cursor',
|
|
48
|
+
description: 'Pagination cursor for fetching next page',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
run(context) {
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const auth = context.auth;
|
|
55
|
+
const { includeTags, includeCaptionMentions, limit, after } = context.propsValue;
|
|
56
|
+
const { accessToken } = yield common_1.instagramTokenService.getValidToken({
|
|
57
|
+
auth,
|
|
58
|
+
server: context.server,
|
|
59
|
+
project: context.project,
|
|
60
|
+
});
|
|
61
|
+
const results = {
|
|
62
|
+
tags: [],
|
|
63
|
+
mentions: [],
|
|
64
|
+
tagsPaging: null,
|
|
65
|
+
mentionsPaging: null,
|
|
66
|
+
};
|
|
67
|
+
// Get tagged posts (where account is tagged in photo)
|
|
68
|
+
if (includeTags !== false) {
|
|
69
|
+
const tagsParams = {
|
|
70
|
+
access_token: accessToken,
|
|
71
|
+
fields: 'id,caption,media_type,media_url,permalink,timestamp,username',
|
|
72
|
+
limit: String(Math.min(limit || 25, 100)),
|
|
73
|
+
};
|
|
74
|
+
if (after) {
|
|
75
|
+
tagsParams['after'] = after;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const tagsResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
79
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
80
|
+
url: `${common_1.INSTAGRAM_GRAPH_API_BASE}/${auth.instagramAccountId}/tags`,
|
|
81
|
+
queryParams: tagsParams,
|
|
82
|
+
});
|
|
83
|
+
results.tags = tagsResponse.body.data || [];
|
|
84
|
+
results.tagsPaging = tagsResponse.body.paging || null;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
88
|
+
results.tags = [];
|
|
89
|
+
console.warn('Could not fetch tags:', errorMessage);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Get @mentioned posts (requires instagram_business_manage_messages permission)
|
|
93
|
+
if (includeCaptionMentions !== false) {
|
|
94
|
+
const mentionsParams = {
|
|
95
|
+
access_token: accessToken,
|
|
96
|
+
fields: 'id,caption,media_type,permalink,timestamp',
|
|
97
|
+
limit: String(Math.min(limit || 25, 100)),
|
|
98
|
+
};
|
|
99
|
+
if (after) {
|
|
100
|
+
mentionsParams['after'] = after;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const mentionsResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
104
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
105
|
+
url: `${common_1.INSTAGRAM_GRAPH_API_BASE}/${auth.instagramAccountId}/mentioned_media`,
|
|
106
|
+
queryParams: mentionsParams,
|
|
107
|
+
});
|
|
108
|
+
results.mentions = mentionsResponse.body.data || [];
|
|
109
|
+
results.mentionsPaging = mentionsResponse.body.paging || null;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
113
|
+
results.mentions = [];
|
|
114
|
+
console.warn('Could not fetch mentions (may require instagram_business_manage_messages permission):', errorMessage);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
success: true,
|
|
119
|
+
tags: results.tags,
|
|
120
|
+
mentions: results.mentions,
|
|
121
|
+
totalCount: results.tags.length + results.mentions.length,
|
|
122
|
+
paging: {
|
|
123
|
+
tags: results.tagsPaging,
|
|
124
|
+
mentions: results.mentionsPaging,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
//# sourceMappingURL=get-mentions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-mentions.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-instagram-business/src/lib/actions/get-mentions.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6EAAoG;AACpG,sCAA4E;AAE5E,MAAM,WAAW,GAAG;;;;;;;;;;;;CAYnB,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,+CAAqB;IAC3B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACH,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACrB,CAAC;QACF,sB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B;wBAC7E,WAAW,EAAE,cAAc;qBAC9B,CAAC,CAAC;oBACH,OAAO,CAAC,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;oBACpD,OAAO,CAAC,cAAc,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;gBAClE,CAAC;gBAAC,OAAO,KAAc,EAAE,CAAC;oBACtB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;oBAC9E,OAAO,CAAC,QAAQ,GAAG,EAAE,CAAC;oBACtB,OAAO,CAAC,IAAI,CAAC,uFAAuF,EAAE,YAAY,CAAC,CAAC;gBACxH,CAAC;YACL,CAAC;YAED,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM;gBACzD,MAAM,EAAE;oBACJ,IAAI,EAAE,OAAO,CAAC,UAAU;oBACxB,QAAQ,EAAE,OAAO,CAAC,cAAc;iBACnC;aACJ,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const postComment: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
instagramAccountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
instagramUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenExpiresAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
refreshThresholdDays: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>, {
|
|
9
|
+
mediaId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
message: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postComment = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const instagram_business_auth_1 = require("../auth/instagram-business.auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const description = `
|
|
10
|
+
## Post Comment
|
|
11
|
+
|
|
12
|
+
Post a new comment on a media post.
|
|
13
|
+
|
|
14
|
+
### Input Parameters
|
|
15
|
+
- **Media ID** (required): The ID of the media to comment on
|
|
16
|
+
- **Message** (required): The comment text
|
|
17
|
+
|
|
18
|
+
### Requirements
|
|
19
|
+
- Requires \`instagram_business_manage_comments\` permission
|
|
20
|
+
- Can comment on your own media
|
|
21
|
+
|
|
22
|
+
### Output
|
|
23
|
+
Returns the created comment ID on success.
|
|
24
|
+
`;
|
|
25
|
+
exports.postComment = (0, pieces_framework_1.createAction)({
|
|
26
|
+
auth: instagram_business_auth_1.instagramBusinessAuth,
|
|
27
|
+
name: 'post_comment',
|
|
28
|
+
displayName: 'Post Comment',
|
|
29
|
+
description: 'Post a new comment on a media post',
|
|
30
|
+
props: {
|
|
31
|
+
mediaId: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Media ID',
|
|
33
|
+
description: 'The ID of the media to comment on',
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
message: pieces_framework_1.Property.LongText({
|
|
37
|
+
displayName: 'Message',
|
|
38
|
+
description: 'The comment text',
|
|
39
|
+
required: true,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
run(context) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const auth = context.auth;
|
|
45
|
+
const { mediaId, message } = context.propsValue;
|
|
46
|
+
const { accessToken } = yield common_1.instagramTokenService.getValidToken({
|
|
47
|
+
auth,
|
|
48
|
+
server: context.server,
|
|
49
|
+
project: context.project,
|
|
50
|
+
});
|
|
51
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
52
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
53
|
+
url: `${common_1.INSTAGRAM_GRAPH_API_BASE}/${mediaId}/comments`,
|
|
54
|
+
queryParams: {
|
|
55
|
+
access_token: accessToken,
|
|
56
|
+
message: message,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
if (!response.body.id) {
|
|
60
|
+
throw new Error(`Failed to post comment: ${JSON.stringify(response.body)}`);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
commentId: response.body.id,
|
|
65
|
+
mediaId,
|
|
66
|
+
message,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=post-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-comment.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-instagram-business/src/lib/actions/post-comment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6EAAoG;AACpG,sCAA4E;AAE5E,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;CAenB,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,+CAAqB;IAC3B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACH,OAAO,EAAE,2B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epieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
instagramAccountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
instagramUsername: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenExpiresAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
refreshThresholdDays: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>, {
|
|
9
|
+
commentId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
message: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replyToComment = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const instagram_business_auth_1 = require("../auth/instagram-business.auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const description = `
|
|
10
|
+
## Reply to Comment
|
|
11
|
+
|
|
12
|
+
Reply to a specific comment on your Instagram media.
|
|
13
|
+
|
|
14
|
+
### Input Parameters
|
|
15
|
+
- **Comment ID** (required): The ID of the comment to reply to
|
|
16
|
+
- **Message** (required): The reply text
|
|
17
|
+
|
|
18
|
+
### Requirements
|
|
19
|
+
- Requires \`instagram_business_manage_comments\` permission
|
|
20
|
+
- Can only reply to comments on your own media
|
|
21
|
+
|
|
22
|
+
### Output
|
|
23
|
+
Returns the created reply comment ID on success.
|
|
24
|
+
`;
|
|
25
|
+
exports.replyToComment = (0, pieces_framework_1.createAction)({
|
|
26
|
+
auth: instagram_business_auth_1.instagramBusinessAuth,
|
|
27
|
+
name: 'reply_to_comment',
|
|
28
|
+
displayName: 'Reply to Comment',
|
|
29
|
+
description: 'Reply to a specific comment on your Instagram media',
|
|
30
|
+
props: {
|
|
31
|
+
commentId: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Comment ID',
|
|
33
|
+
description: 'The ID of the comment to reply to',
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
message: pieces_framework_1.Property.LongText({
|
|
37
|
+
displayName: 'Message',
|
|
38
|
+
description: 'The reply text',
|
|
39
|
+
required: true,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
run(context) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const auth = context.auth;
|
|
45
|
+
const { commentId, message } = context.propsValue;
|
|
46
|
+
const { accessToken } = yield common_1.instagramTokenService.getValidToken({
|
|
47
|
+
auth,
|
|
48
|
+
server: context.server,
|
|
49
|
+
project: context.project,
|
|
50
|
+
});
|
|
51
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
52
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
53
|
+
url: `${common_1.INSTAGRAM_GRAPH_API_BASE}/${commentId}/replies`,
|
|
54
|
+
queryParams: {
|
|
55
|
+
access_token: accessToken,
|
|
56
|
+
message: message,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
if (!response.body.id) {
|
|
60
|
+
throw new Error(`Failed to reply to comment: ${JSON.stringify(response.body)}`);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
replyId: response.body.id,
|
|
65
|
+
commentId,
|
|
66
|
+
message,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=reply-to-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply-to-comment.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces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;gBACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpF,CAAC;YAED,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACzB,SAAS;gBACT,OAAO;aACV,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -6,22 +6,22 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const instagram_business_auth_1 = require("../auth/instagram-business.auth");
|
|
8
8
|
const common_1 = require("../common");
|
|
9
|
-
const description = `
|
|
10
|
-
## Upload Photo
|
|
11
|
-
|
|
12
|
-
Upload a photo to your Instagram Business Account as a feed post.
|
|
13
|
-
|
|
14
|
-
### Input Parameters
|
|
15
|
-
- **Photo URL** (required): A publicly accessible URL to the image (JPG/PNG)
|
|
16
|
-
- **Caption**: Optional caption for the post
|
|
17
|
-
|
|
18
|
-
### Requirements
|
|
19
|
-
- The image URL must be publicly accessible
|
|
20
|
-
- Your Instagram account must be connected to a Facebook Page
|
|
21
|
-
- Requires \`instagram_business_content_publish\` permission
|
|
22
|
-
|
|
23
|
-
### Output
|
|
24
|
-
Returns the created media ID on success.
|
|
9
|
+
const description = `
|
|
10
|
+
## Upload Photo
|
|
11
|
+
|
|
12
|
+
Upload a photo to your Instagram Business Account as a feed post.
|
|
13
|
+
|
|
14
|
+
### Input Parameters
|
|
15
|
+
- **Photo URL** (required): A publicly accessible URL to the image (JPG/PNG)
|
|
16
|
+
- **Caption**: Optional caption for the post
|
|
17
|
+
|
|
18
|
+
### Requirements
|
|
19
|
+
- The image URL must be publicly accessible
|
|
20
|
+
- Your Instagram account must be connected to a Facebook Page
|
|
21
|
+
- Requires \`instagram_business_content_publish\` permission
|
|
22
|
+
|
|
23
|
+
### Output
|
|
24
|
+
Returns the created media ID on success.
|
|
25
25
|
`;
|
|
26
26
|
exports.uploadPhoto = (0, pieces_framework_1.createAction)({
|
|
27
27
|
auth: instagram_business_auth_1.instagramBusinessAuth,
|
|
@@ -6,24 +6,24 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const instagram_business_auth_1 = require("../auth/instagram-business.auth");
|
|
8
8
|
const common_1 = require("../common");
|
|
9
|
-
const description = `
|
|
10
|
-
## Upload Reel
|
|
11
|
-
|
|
12
|
-
Upload a video reel to your Instagram Business Account.
|
|
13
|
-
|
|
14
|
-
### Input Parameters
|
|
15
|
-
- **Video URL** (required): A publicly accessible URL to the video
|
|
16
|
-
- **Caption**: Optional caption for the reel
|
|
17
|
-
|
|
18
|
-
### Requirements
|
|
19
|
-
- The video URL must be publicly accessible
|
|
20
|
-
- Video must be between 3-90 seconds
|
|
21
|
-
- Maximum file size: 1GB
|
|
22
|
-
- Your Instagram account must be connected to a Facebook Page
|
|
23
|
-
- Requires \`instagram_business_content_publish\` permission
|
|
24
|
-
|
|
25
|
-
### Output
|
|
26
|
-
Returns the created media ID on success.
|
|
9
|
+
const description = `
|
|
10
|
+
## Upload Reel
|
|
11
|
+
|
|
12
|
+
Upload a video reel to your Instagram Business Account.
|
|
13
|
+
|
|
14
|
+
### Input Parameters
|
|
15
|
+
- **Video URL** (required): A publicly accessible URL to the video
|
|
16
|
+
- **Caption**: Optional caption for the reel
|
|
17
|
+
|
|
18
|
+
### Requirements
|
|
19
|
+
- The video URL must be publicly accessible
|
|
20
|
+
- Video must be between 3-90 seconds
|
|
21
|
+
- Maximum file size: 1GB
|
|
22
|
+
- Your Instagram account must be connected to a Facebook Page
|
|
23
|
+
- Requires \`instagram_business_content_publish\` permission
|
|
24
|
+
|
|
25
|
+
### Output
|
|
26
|
+
Returns the created media ID on success.
|
|
27
27
|
`;
|
|
28
28
|
// Helper to wait for video processing
|
|
29
29
|
function waitForVideoProcessing(instagramAccountId_1, containerId_1, accessToken_1) {
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.instagramBusinessAuth = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const markdown = `
|
|
6
|
-
## Authentication
|
|
7
|
-
|
|
8
|
-
### Embedded Signup (Recommended)
|
|
9
|
-
Click "Connect" to authenticate via Instagram Business Login. This will automatically:
|
|
10
|
-
1. Redirect to Instagram for authorization
|
|
11
|
-
2. Exchange the authorization code for tokens (server-side)
|
|
12
|
-
3. Fetch your Instagram Account ID and username
|
|
13
|
-
4. Set the token expiration date
|
|
14
|
-
|
|
15
|
-
### Manual Setup
|
|
16
|
-
To manually obtain credentials:
|
|
17
|
-
1. Go to https://developers.facebook.com/
|
|
18
|
-
2. Create app → Select **Other** → Choose **Business** type
|
|
19
|
-
3. Add Product → **Instagram**
|
|
20
|
-
4. Configure **Instagram Business Login** settings
|
|
21
|
-
5. Generate User Access Token with scopes:
|
|
22
|
-
- instagram_business_basic
|
|
23
|
-
- instagram_business_manage_messages
|
|
24
|
-
- instagram_business_content_publish
|
|
25
|
-
6. Exchange for long-lived token (60 days)
|
|
26
|
-
7. Get Instagram Account ID from /me endpoint
|
|
27
|
-
|
|
28
|
-
### Token Refresh
|
|
29
|
-
Tokens are automatically refreshed when nearing expiration (within 10 days).
|
|
5
|
+
const markdown = `
|
|
6
|
+
## Authentication
|
|
7
|
+
|
|
8
|
+
### Embedded Signup (Recommended)
|
|
9
|
+
Click "Connect" to authenticate via Instagram Business Login. This will automatically:
|
|
10
|
+
1. Redirect to Instagram for authorization
|
|
11
|
+
2. Exchange the authorization code for tokens (server-side)
|
|
12
|
+
3. Fetch your Instagram Account ID and username
|
|
13
|
+
4. Set the token expiration date
|
|
14
|
+
|
|
15
|
+
### Manual Setup
|
|
16
|
+
To manually obtain credentials:
|
|
17
|
+
1. Go to https://developers.facebook.com/
|
|
18
|
+
2. Create app → Select **Other** → Choose **Business** type
|
|
19
|
+
3. Add Product → **Instagram**
|
|
20
|
+
4. Configure **Instagram Business Login** settings
|
|
21
|
+
5. Generate User Access Token with scopes:
|
|
22
|
+
- instagram_business_basic
|
|
23
|
+
- instagram_business_manage_messages
|
|
24
|
+
- instagram_business_content_publish
|
|
25
|
+
6. Exchange for long-lived token (60 days)
|
|
26
|
+
7. Get Instagram Account ID from /me endpoint
|
|
27
|
+
|
|
28
|
+
### Token Refresh
|
|
29
|
+
Tokens are automatically refreshed when nearing expiration (within 10 days).
|
|
30
30
|
`;
|
|
31
31
|
exports.instagramBusinessAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
32
32
|
required: true,
|