@activepieces/piece-feedhive 0.0.3 → 0.0.5

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 (49) hide show
  1. package/package.json +7 -12
  2. package/src/index.js +40 -47
  3. package/src/index.d.ts +0 -4
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/create-label.d.ts +0 -4
  7. package/src/lib/actions/create-label.d.ts.map +0 -1
  8. package/src/lib/actions/create-label.js +0 -39
  9. package/src/lib/actions/create-label.js.map +0 -1
  10. package/src/lib/actions/create-post.d.ts +0 -10
  11. package/src/lib/actions/create-post.d.ts.map +0 -1
  12. package/src/lib/actions/create-post.js +0 -80
  13. package/src/lib/actions/create-post.js.map +0 -1
  14. package/src/lib/actions/delete-post.d.ts +0 -4
  15. package/src/lib/actions/delete-post.d.ts.map +0 -1
  16. package/src/lib/actions/delete-post.js +0 -30
  17. package/src/lib/actions/delete-post.js.map +0 -1
  18. package/src/lib/actions/fire-workflow-trigger.d.ts +0 -12
  19. package/src/lib/actions/fire-workflow-trigger.d.ts.map +0 -1
  20. package/src/lib/actions/fire-workflow-trigger.js +0 -95
  21. package/src/lib/actions/fire-workflow-trigger.js.map +0 -1
  22. package/src/lib/actions/get-post.d.ts +0 -4
  23. package/src/lib/actions/get-post.d.ts.map +0 -1
  24. package/src/lib/actions/get-post.js +0 -30
  25. package/src/lib/actions/get-post.js.map +0 -1
  26. package/src/lib/actions/list-posts.d.ts +0 -6
  27. package/src/lib/actions/list-posts.d.ts.map +0 -1
  28. package/src/lib/actions/list-posts.js +0 -60
  29. package/src/lib/actions/list-posts.js.map +0 -1
  30. package/src/lib/actions/update-post.d.ts +0 -11
  31. package/src/lib/actions/update-post.d.ts.map +0 -1
  32. package/src/lib/actions/update-post.js +0 -80
  33. package/src/lib/actions/update-post.js.map +0 -1
  34. package/src/lib/common/auth.d.ts +0 -2
  35. package/src/lib/common/auth.d.ts.map +0 -1
  36. package/src/lib/common/auth.js +0 -33
  37. package/src/lib/common/auth.js.map +0 -1
  38. package/src/lib/common/index.d.ts +0 -18
  39. package/src/lib/common/index.d.ts.map +0 -1
  40. package/src/lib/common/index.js +0 -144
  41. package/src/lib/common/index.js.map +0 -1
  42. package/src/lib/triggers/comment-notification.d.ts +0 -11
  43. package/src/lib/triggers/comment-notification.d.ts.map +0 -1
  44. package/src/lib/triggers/comment-notification.js +0 -96
  45. package/src/lib/triggers/comment-notification.js.map +0 -1
  46. package/src/lib/triggers/post-notification.d.ts +0 -15
  47. package/src/lib/triggers/post-notification.d.ts.map +0 -1
  48. package/src/lib/triggers/post-notification.js +0 -119
  49. package/src/lib/triggers/post-notification.js.map +0 -1
@@ -1,144 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.feedhiveCommon = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const auth_1 = require("./auth");
8
- const BASE_URL = 'https://api.feedhive.com';
9
- const socialsMultiDropdown = pieces_framework_1.Property.MultiSelectDropdown({
10
- displayName: 'Social Accounts',
11
- description: 'Select the social media accounts to publish this post to.',
12
- refreshers: [],
13
- required: false,
14
- auth: auth_1.feedhiveAuth,
15
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
16
- var _b;
17
- if (!auth) {
18
- return { disabled: true, options: [], placeholder: 'Please connect your account first' };
19
- }
20
- try {
21
- const response = yield apiCall({ token: auth.secret_text, method: pieces_common_1.HttpMethod.GET, path: '/socials' });
22
- return {
23
- disabled: false,
24
- options: ((_b = response.body.data) !== null && _b !== void 0 ? _b : [])
25
- .filter((a) => a.status === 'active')
26
- .map((a) => ({
27
- label: `${a.display_name} (@${a.handle}) — ${a.platform}`,
28
- value: a.id,
29
- })),
30
- };
31
- }
32
- catch (_c) {
33
- return {
34
- disabled: true,
35
- options: [],
36
- placeholder: 'Failed to load social accounts. Check your connection.',
37
- };
38
- }
39
- }),
40
- });
41
- const labelsMultiDropdown = pieces_framework_1.Property.MultiSelectDropdown({
42
- displayName: 'Labels',
43
- description: 'Optionally assign labels to organise this post in FeedHive.',
44
- refreshers: [],
45
- required: false,
46
- auth: auth_1.feedhiveAuth,
47
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
48
- var _b, _c;
49
- if (!auth) {
50
- return { disabled: true, options: [], placeholder: 'Please connect your account first' };
51
- }
52
- try {
53
- const response = yield apiCall({ token: auth.secret_text, method: pieces_common_1.HttpMethod.GET, path: '/labels' });
54
- return {
55
- disabled: false,
56
- options: ((_c = (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.items) !== null && _c !== void 0 ? _c : []).map((l) => ({
57
- label: l.title,
58
- value: l.id,
59
- })),
60
- };
61
- }
62
- catch (_d) {
63
- return { disabled: true, options: [], placeholder: 'Failed to load labels. Check your connection.' };
64
- }
65
- }),
66
- });
67
- const postDropdown = pieces_framework_1.Property.Dropdown({
68
- displayName: 'Post',
69
- description: 'Select the post you want to act on.',
70
- refreshers: [],
71
- required: true,
72
- auth: auth_1.feedhiveAuth,
73
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
74
- var _b, _c;
75
- if (!auth) {
76
- return { disabled: true, options: [], placeholder: 'Please connect your account first' };
77
- }
78
- try {
79
- const response = yield apiCall({
80
- token: auth.secret_text,
81
- method: pieces_common_1.HttpMethod.GET,
82
- path: '/posts',
83
- queryParams: { limit: '100' },
84
- });
85
- return {
86
- disabled: false,
87
- options: ((_c = (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.items) !== null && _c !== void 0 ? _c : []).map((p) => {
88
- const preview = p.text ? p.text.slice(0, 60) + (p.text.length > 60 ? '…' : '') : '(no text)';
89
- return { label: `${preview} [${p.status}]`, value: p.id };
90
- }),
91
- };
92
- }
93
- catch (_d) {
94
- return { disabled: true, options: [], placeholder: 'Failed to load posts. Check your connection.' };
95
- }
96
- }),
97
- });
98
- exports.feedhiveCommon = {
99
- socialsMultiDropdown,
100
- labelsMultiDropdown,
101
- postDropdown,
102
- apiCall,
103
- flattenPost,
104
- };
105
- function apiCall(_a) {
106
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ token, method, path, body, queryParams, }) {
107
- return pieces_common_1.httpClient.sendRequest({
108
- method,
109
- url: `${BASE_URL}${path}`,
110
- authentication: { type: pieces_common_1.AuthenticationType.BEARER_TOKEN, token },
111
- queryParams,
112
- body,
113
- });
114
- });
115
- }
116
- function flattenPost(post) {
117
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
118
- const approval = post['approval'];
119
- return {
120
- id: (_a = post['id']) !== null && _a !== void 0 ? _a : null,
121
- status: (_b = post['status']) !== null && _b !== void 0 ? _b : null,
122
- text: (_c = post['text']) !== null && _c !== void 0 ? _c : null,
123
- accounts: Array.isArray(post['accounts']) && post['accounts'].length > 0
124
- ? post['accounts'].join(', ')
125
- : null,
126
- labels: Array.isArray(post['labels']) && post['labels'].length > 0
127
- ? post['labels'].join(', ')
128
- : null,
129
- media: Array.isArray(post['media']) && post['media'].length > 0
130
- ? post['media'].join(', ')
131
- : null,
132
- notes: (_d = post['notes']) !== null && _d !== void 0 ? _d : null,
133
- short_link_enabled: (_e = post['short_link_enabled']) !== null && _e !== void 0 ? _e : null,
134
- scheduled_at: (_f = post['scheduled_at']) !== null && _f !== void 0 ? _f : null,
135
- published_at: (_g = post['published_at']) !== null && _g !== void 0 ? _g : null,
136
- slot_id: (_h = post['slot_id']) !== null && _h !== void 0 ? _h : null,
137
- approval_status: (_j = approval === null || approval === void 0 ? void 0 : approval.status) !== null && _j !== void 0 ? _j : null,
138
- approval_is_approved: (_k = approval === null || approval === void 0 ? void 0 : approval.is_approved) !== null && _k !== void 0 ? _k : null,
139
- approval_approved_at: (_l = approval === null || approval === void 0 ? void 0 : approval.approved_at) !== null && _l !== void 0 ? _l : null,
140
- created_at: (_m = post['created_at']) !== null && _m !== void 0 ? _m : null,
141
- updated_at: (_o = post['updated_at']) !== null && _o !== void 0 ? _o : null,
142
- };
143
- }
144
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,+DAMqC;AACrC,qEAA0D;AAC1D,iCAAsC;AAEtC,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAE5C,MAAM,oBAAoB,GAAG,2BAAQ,CAAC,mBAAmB,CAAC;IACxD,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,2DAA2D;IACxE,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,mBAAY;IAClB,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;QAC3F,CAAC;QACD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAE3B,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,0BAAU,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAC1E,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,CAAC,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC;qBAChC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC;qBACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACX,KAAK,EAAE,GAAG,CAAC,CAAC,YAAY,MAAM,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,QAAQ,EAAE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AM,GAAG,CAAC;YAC9E,CAAC,CAAE,IAAI,CAAC,QAAQ,CAAc,CAAC,IAAI,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,IAAI;QACR,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAK,IAAI,CAAC,OAAO,CAAc,CAAC,MAAM,GAAG,CAAC;YAC3E,CAAC,CAAE,IAAI,CAAC,OAAO,CAAc,CAAC,IAAI,CAAC,IAAI,CAAC;YACxC,CAAC,CAAC,IAAI;QACR,KAAK,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,mCAAI,IAAI;QAC5B,kBAAkB,EAAE,MAAA,IAAI,CAAC,oBAAoB,CAAC,mCAAI,IAAI;QACtD,YAAY,EAAE,MAAA,IAAI,CAAC,cAAc,CAAC,mCAAI,IAAI;QAC1C,YAAY,EAAE,MAAA,IAAI,CAAC,cAAc,CAAC,mCAAI,IAAI;QAC1C,OAAO,EAAE,MAAA,IAAI,CAAC,SAAS,CAAC,mCAAI,IAAI;QAChC,eAAe,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,mCAAI,IAAI;QACzC,oBAAoB,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,mCAAI,IAAI;QACnD,oBAAoB,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,mCAAI,IAAI;QACnD,UAAU,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,mCAAI,IAAI;QACtC,UAAU,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,mCAAI,IAAI;KACvC,CAAC;AACJ,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const commentNotificationTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
10
- }>;
11
- //# sourceMappingURL=comment-notification.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"comment-notification.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/comment-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAK1F,eAAO,MAAM,0BAA0B;;;;;;;;EAsFrC,CAAC"}
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.commentNotificationTrigger = 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 auth_1 = require("../common/auth");
8
- const common_1 = require("../common");
9
- exports.commentNotificationTrigger = (0, pieces_framework_1.createTrigger)({
10
- auth: auth_1.feedhiveAuth,
11
- name: 'comment_notification',
12
- displayName: 'Comment Notification',
13
- description: 'Triggers when a comment is added to one of your posts.',
14
- aiMetadata: {
15
- description: 'Fires via webhook when a new comment is added to one of your FeedHive posts. Represents a single incoming comment, carrying the comment text and author details along with the related post.',
16
- },
17
- props: {
18
- instructions: pieces_framework_1.Property.MarkDown({
19
- value: `### Setup Instructions
20
-
21
- 1. Enable this flow and copy the **Webhook URL** shown below.
22
- \`\`\`text
23
- {{webhookUrl}}
24
- \`\`\`
25
- 2. In FeedHive, go to **Settings → Automation → Notifications**.
26
- 3. Click **Create New Notification**.
27
- 4. Choose **Comment Added** and paste the Webhook URL, then click **Save**.`,
28
- }),
29
- },
30
- sampleData: {
31
- post_id: 'xxxx-abcd-1234',
32
- comment_id: 'yyyy-zxyw-4321',
33
- commented_at: '2024-08-01T12:00:00.000Z',
34
- commented_by: 'zzzz-efgh-5678',
35
- commented_by_name: 'John Doe',
36
- commented_by_email: 'johndoe@gmail.com',
37
- comment_text: 'Great post. Perhaps add another image?',
38
- post_excerpt: 'This is the first part of the post caption...',
39
- post: {
40
- content: [{ text: 'Full post caption.', media: [] }],
41
- labels: ['Marketing'],
42
- postNotes: 'Internal notes',
43
- },
44
- },
45
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
46
- onEnable(_context) {
47
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
- // Webhook URL must be configured manually in FeedHive: Settings → Automation → Notifications
49
- });
50
- },
51
- onDisable(_context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- // Nothing to unregister
54
- });
55
- },
56
- run(context) {
57
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
- return [context.payload.body];
59
- });
60
- },
61
- test(context) {
62
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
63
- var _a, _b;
64
- // No dedicated comments endpoint — fetch recent published posts and approximate the payload shape
65
- const response = yield common_1.feedhiveCommon.apiCall({
66
- token: context.auth.secret_text,
67
- method: pieces_common_1.HttpMethod.GET,
68
- path: '/posts',
69
- queryParams: { limit: '5', status: 'published' },
70
- });
71
- const posts = (_b = (_a = response.body.data) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : [];
72
- return posts.map((post) => {
73
- var _a, _b, _c, _d, _e;
74
- const postExcerpt = typeof post['text'] === 'string'
75
- ? post['text'].slice(0, 100) + (post['text'].length > 100 ? '...' : '')
76
- : '(no text)';
77
- return {
78
- post_id: (_a = post['id']) !== null && _a !== void 0 ? _a : null,
79
- comment_id: null,
80
- commented_at: null,
81
- commented_by: null,
82
- commented_by_name: '(see FeedHive notification)',
83
- commented_by_email: '(see FeedHive notification)',
84
- comment_text: '(see FeedHive notification)',
85
- post_excerpt: postExcerpt,
86
- post: {
87
- content: [{ text: (_b = post['text']) !== null && _b !== void 0 ? _b : '', media: (_c = post['media']) !== null && _c !== void 0 ? _c : [] }],
88
- labels: (_d = post['labels']) !== null && _d !== void 0 ? _d : [],
89
- postNotes: (_e = post['notes']) !== null && _e !== void 0 ? _e : '',
90
- },
91
- };
92
- });
93
- });
94
- },
95
- });
96
- //# sourceMappingURL=comment-notification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"comment-notification.js","sourceRoot":"","sources":["../../../../src/lib/triggers/comment-notification.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,+DAAyD;AACzD,yCAA8C;AAC9C,sCAA2C;AAE9B,QAAA,0BAA0B,GAAG,IAAA,gCAAa,EAAC;IACtD,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,wDAAwD;IACrE,UAAU,EAAE;QACV,WAAW,EAAE,8LAA8L;KAC5M;IACD,KAAK,EAAE;QACL,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC9B,KAAK,EAAE;;;;;;;;4EAQ+D;SACvE,CAAC;KACH;IACD,UAAU,EAAE;QACV,OAAO,EAAE,gBAAgB;QACzB,UAAU,EAAE,gBAAgB;QAC5B,YAAY,EAAE,0BAA0B;QACxC,YAAY,EAAE,gBAAgB;QAC9B,iBAAiB,EAAE,UAAU;QAC7B,kBAAkB,EAAE,mBAAmB;QACvC,YAAY,EAAE,wCAAwC;QACtD,YAAY,EAAE,+CAA+C;QAC7D,IAAI,EAAE;YACJ,OAA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,CAAC,mCAAI,IAAI;oBAC3B,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,IAAI;oBAClB,YAAY,EAAE,IAAI;oBAClB,iBAAiB,EAAE,6BAA6B;oBAChD,kBAAkB,EAAE,6BAA6B;oBACjD,YAAY,EAAE,6BAA6B;oBAC3C,YAAY,EAAE,WAAW;oBACzB,IAAI,EAAE;wBACJ,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,mCAAI,EAAE,EAAE,KAAK,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,mCAAI,EAAE,EAAE,CAAC;wBACnE,MAAM,EAAE,MAAA,IAAI,CAAC,QAAQ,CAAC,mCAAI,EAAE;wBAC5B,SAAS,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,mCAAI,EAAE;qBAC/B;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const postNotificationTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- event_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
4
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
5
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
6
- event_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
7
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- event_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
11
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
12
- event_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
13
- instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
14
- }>;
15
- //# sourceMappingURL=post-notification.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post-notification.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/post-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAW1F,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EA+ElC,CAAC"}
@@ -1,119 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.postNotificationTrigger = 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 auth_1 = require("../common/auth");
8
- const common_1 = require("../common");
9
- const EVENT_TYPE_STATUS_MAP = {
10
- post_published: 'published',
11
- post_scheduled: 'scheduled',
12
- post_failed: 'failed',
13
- };
14
- exports.postNotificationTrigger = (0, pieces_framework_1.createTrigger)({
15
- auth: auth_1.feedhiveAuth,
16
- name: 'post_notification',
17
- displayName: 'Post Notification',
18
- description: 'Triggers when a post is published, scheduled, or fails.',
19
- aiMetadata: {
20
- description: 'Fires via webhook when a FeedHive post changes state — published, scheduled, or failed — depending on which notification event type is configured in FeedHive. Represents a lifecycle event for a single post, carrying its ID, excerpt, and target social account.',
21
- },
22
- props: {
23
- event_type: pieces_framework_1.Property.StaticDropdown({
24
- displayName: 'Event Type',
25
- description: 'Choose the event type you will configure in FeedHive. This is used to load sample data when testing the trigger — it does not filter incoming webhooks.',
26
- required: true,
27
- defaultValue: 'post_published',
28
- options: {
29
- options: [
30
- { label: 'Post Published', value: 'post_published' },
31
- { label: 'Post Scheduled', value: 'post_scheduled' },
32
- { label: 'Post Failed', value: 'post_failed' },
33
- ],
34
- },
35
- }),
36
- instructions: pieces_framework_1.Property.MarkDown({
37
- value: `### Setup Instructions
38
-
39
- 1. Enable this flow and copy the **Webhook URL** shown below.
40
- \`\`\`text
41
- {{webhookUrl}}
42
- \`\`\`
43
- 2. In FeedHive, go to **Settings → Automation → Notifications**.
44
- 3. Click **Create New Notification**.
45
- 4. Choose the matching event type and paste the Webhook URL, then click **Save**.`,
46
- }),
47
- },
48
- sampleData: {
49
- post_id: 'xxxx-abcd-1234',
50
- post_excerpt: 'This is the first part of the post caption...',
51
- social_type: 'Facebook',
52
- social_name: 'My Facebook Page',
53
- public_id: '123456789101112_1314151617181920',
54
- public_url: 'https://www.facebook.com/xxxx/posts/yyyy',
55
- post: {
56
- content: [{ text: 'Full post caption.', media: [] }],
57
- labels: ['Marketing'],
58
- postNotes: 'Internal notes',
59
- },
60
- },
61
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
62
- onEnable(_context) {
63
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
64
- // Webhook URL must be configured manually in FeedHive: Settings → Automation → Notifications
65
- });
66
- },
67
- onDisable(_context) {
68
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
69
- // Nothing to unregister
70
- });
71
- },
72
- run(context) {
73
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
74
- return [context.payload.body];
75
- });
76
- },
77
- test(context) {
78
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
- var _a, _b, _c, _d;
80
- const eventType = (_a = context.propsValue.event_type) !== null && _a !== void 0 ? _a : 'post_published';
81
- const status = (_b = EVENT_TYPE_STATUS_MAP[eventType]) !== null && _b !== void 0 ? _b : 'published';
82
- const response = yield common_1.feedhiveCommon.apiCall({
83
- token: context.auth.secret_text,
84
- method: pieces_common_1.HttpMethod.GET,
85
- path: '/posts',
86
- queryParams: { limit: '5', status },
87
- });
88
- const posts = (_d = (_c = response.body.data) === null || _c === void 0 ? void 0 : _c.items) !== null && _d !== void 0 ? _d : [];
89
- return posts.map((post) => buildSamplePayload(eventType, post));
90
- });
91
- },
92
- });
93
- function buildSamplePayload(eventType, post) {
94
- var _a, _b, _c, _d, _e, _f, _g;
95
- const postExcerpt = typeof post['text'] === 'string'
96
- ? post['text'].slice(0, 100) + (post['text'].length > 100 ? '...' : '')
97
- : '(no text)';
98
- const notificationPost = {
99
- content: [{ text: (_a = post['text']) !== null && _a !== void 0 ? _a : '', media: (_b = post['media']) !== null && _b !== void 0 ? _b : [] }],
100
- labels: (_c = post['labels']) !== null && _c !== void 0 ? _c : [],
101
- postNotes: (_d = post['notes']) !== null && _d !== void 0 ? _d : '',
102
- };
103
- const base = {
104
- post_id: (_e = post['id']) !== null && _e !== void 0 ? _e : null,
105
- post_excerpt: postExcerpt,
106
- post: notificationPost,
107
- };
108
- switch (eventType) {
109
- case 'post_published':
110
- return Object.assign(Object.assign({}, base), { social_type: '(see FeedHive notification)', social_name: '(see FeedHive notification)', public_id: null, public_url: null });
111
- case 'post_scheduled':
112
- return Object.assign(Object.assign({}, base), { schedule_at: (_f = post['scheduled_at']) !== null && _f !== void 0 ? _f : null, pending_approval: false, social_types: '(see FeedHive notification)' });
113
- case 'post_failed':
114
- return Object.assign(Object.assign({}, base), { failed_at: (_g = post['updated_at']) !== null && _g !== void 0 ? _g : null, message: '(see FeedHive notification)', social_type: '(see FeedHive notification)', social_name: '(see FeedHive notification)' });
115
- default:
116
- return base;
117
- }
118
- }
119
- //# sourceMappingURL=post-notification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post-notification.js","sourceRoot":"","sources":["../../../../src/lib/triggers/post-notification.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,+DAAyD;AACzD,yCAA8C;AAC9C,sCAA2C;AAE3C,MAAM,qBAAqB,GAA2B;IACpD,cAAc,EAAE,WAAW;IAC3B,cAAc,EAAE,WAAW;IAC3B,WAAW,EAAE,QA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