@memberjunction/actions-bizapps-social 2.111.0 → 2.112.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +6 -6
- package/dist/base/base-social.action.d.ts.map +1 -1
- package/dist/base/base-social.action.js +18 -24
- package/dist/base/base-social.action.js.map +1 -1
- package/dist/providers/buffer/buffer-base.action.d.ts.map +1 -1
- package/dist/providers/buffer/buffer-base.action.js +35 -34
- package/dist/providers/buffer/buffer-base.action.js.map +1 -1
- package/dist/providers/facebook/actions/boost-post.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/boost-post.action.js +33 -33
- package/dist/providers/facebook/actions/boost-post.action.js.map +1 -1
- package/dist/providers/facebook/actions/create-album.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/create-album.action.js +34 -36
- package/dist/providers/facebook/actions/create-album.action.js.map +1 -1
- package/dist/providers/facebook/actions/create-post.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/create-post.action.js +20 -20
- package/dist/providers/facebook/actions/create-post.action.js.map +1 -1
- package/dist/providers/facebook/actions/get-page-insights.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/get-page-insights.action.js +25 -27
- package/dist/providers/facebook/actions/get-page-insights.action.js.map +1 -1
- package/dist/providers/facebook/actions/get-page-posts.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/get-page-posts.action.js +19 -23
- package/dist/providers/facebook/actions/get-page-posts.action.js.map +1 -1
- package/dist/providers/facebook/actions/get-post-insights.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/get-post-insights.action.js +28 -32
- package/dist/providers/facebook/actions/get-post-insights.action.js.map +1 -1
- package/dist/providers/facebook/actions/respond-to-comments.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/respond-to-comments.action.js +42 -44
- package/dist/providers/facebook/actions/respond-to-comments.action.js.map +1 -1
- package/dist/providers/facebook/actions/schedule-post.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/schedule-post.action.js +29 -29
- package/dist/providers/facebook/actions/schedule-post.action.js.map +1 -1
- package/dist/providers/facebook/actions/search-posts.action.d.ts.map +1 -1
- package/dist/providers/facebook/actions/search-posts.action.js +37 -39
- package/dist/providers/facebook/actions/search-posts.action.js.map +1 -1
- package/dist/providers/facebook/facebook-base.action.d.ts.map +1 -1
- package/dist/providers/facebook/facebook-base.action.js +44 -59
- package/dist/providers/facebook/facebook-base.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js +33 -31
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.js +28 -32
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js +19 -19
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/get-analytics.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/get-analytics.action.js +24 -26
- package/dist/providers/hootsuite/actions/get-analytics.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js +22 -22
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/get-social-profiles.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/get-social-profiles.action.js +32 -34
- package/dist/providers/hootsuite/actions/get-social-profiles.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/search-posts.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/search-posts.action.js +43 -52
- package/dist/providers/hootsuite/actions/search-posts.action.js.map +1 -1
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.js +30 -28
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.js.map +1 -1
- package/dist/providers/hootsuite/hootsuite-base.action.d.ts.map +1 -1
- package/dist/providers/hootsuite/hootsuite-base.action.js +18 -20
- package/dist/providers/hootsuite/hootsuite-base.action.js.map +1 -1
- package/dist/providers/instagram/actions/create-post.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/create-post.action.js +27 -26
- package/dist/providers/instagram/actions/create-post.action.js.map +1 -1
- package/dist/providers/instagram/actions/create-story.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/create-story.action.js +35 -35
- package/dist/providers/instagram/actions/create-story.action.js.map +1 -1
- package/dist/providers/instagram/actions/get-account-insights.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/get-account-insights.action.js +38 -59
- package/dist/providers/instagram/actions/get-account-insights.action.js.map +1 -1
- package/dist/providers/instagram/actions/get-business-posts.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/get-business-posts.action.js +29 -29
- package/dist/providers/instagram/actions/get-business-posts.action.js.map +1 -1
- package/dist/providers/instagram/actions/get-comments.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/get-comments.action.js +36 -36
- package/dist/providers/instagram/actions/get-comments.action.js.map +1 -1
- package/dist/providers/instagram/actions/get-post-insights.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/get-post-insights.action.js +23 -25
- package/dist/providers/instagram/actions/get-post-insights.action.js.map +1 -1
- package/dist/providers/instagram/actions/schedule-post.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/schedule-post.action.js +25 -25
- package/dist/providers/instagram/actions/schedule-post.action.js.map +1 -1
- package/dist/providers/instagram/actions/search-posts.action.d.ts.map +1 -1
- package/dist/providers/instagram/actions/search-posts.action.js +56 -60
- package/dist/providers/instagram/actions/search-posts.action.js.map +1 -1
- package/dist/providers/instagram/instagram-base.action.d.ts.map +1 -1
- package/dist/providers/instagram/instagram-base.action.js +25 -27
- package/dist/providers/instagram/instagram-base.action.js.map +1 -1
- package/dist/providers/linkedin/actions/create-article.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/create-article.action.js +55 -45
- package/dist/providers/linkedin/actions/create-article.action.js.map +1 -1
- package/dist/providers/linkedin/actions/create-post.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/create-post.action.js +31 -29
- package/dist/providers/linkedin/actions/create-post.action.js.map +1 -1
- package/dist/providers/linkedin/actions/get-followers.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/get-followers.action.js +28 -28
- package/dist/providers/linkedin/actions/get-followers.action.js.map +1 -1
- package/dist/providers/linkedin/actions/get-organization-posts.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/get-organization-posts.action.js +20 -20
- package/dist/providers/linkedin/actions/get-organization-posts.action.js.map +1 -1
- package/dist/providers/linkedin/actions/get-personal-posts.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/get-personal-posts.action.js +19 -19
- package/dist/providers/linkedin/actions/get-personal-posts.action.js.map +1 -1
- package/dist/providers/linkedin/actions/get-post-analytics.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/get-post-analytics.action.js +25 -23
- package/dist/providers/linkedin/actions/get-post-analytics.action.js.map +1 -1
- package/dist/providers/linkedin/actions/schedule-post.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/schedule-post.action.js +32 -30
- package/dist/providers/linkedin/actions/schedule-post.action.js.map +1 -1
- package/dist/providers/linkedin/actions/search-posts.action.d.ts.map +1 -1
- package/dist/providers/linkedin/actions/search-posts.action.js +28 -30
- package/dist/providers/linkedin/actions/search-posts.action.js.map +1 -1
- package/dist/providers/linkedin/linkedin-base.action.d.ts.map +1 -1
- package/dist/providers/linkedin/linkedin-base.action.js +33 -38
- package/dist/providers/linkedin/linkedin-base.action.js.map +1 -1
- package/dist/providers/tiktok/tiktok-base.action.d.ts.map +1 -1
- package/dist/providers/tiktok/tiktok-base.action.js +25 -26
- package/dist/providers/tiktok/tiktok-base.action.js.map +1 -1
- package/dist/providers/twitter/actions/create-thread.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/create-thread.action.js +25 -29
- package/dist/providers/twitter/actions/create-thread.action.js.map +1 -1
- package/dist/providers/twitter/actions/create-tweet.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/create-tweet.action.js +23 -23
- package/dist/providers/twitter/actions/create-tweet.action.js.map +1 -1
- package/dist/providers/twitter/actions/delete-tweet.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/delete-tweet.action.js +19 -19
- package/dist/providers/twitter/actions/delete-tweet.action.js.map +1 -1
- package/dist/providers/twitter/actions/get-analytics.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/get-analytics.action.js +40 -47
- package/dist/providers/twitter/actions/get-analytics.action.js.map +1 -1
- package/dist/providers/twitter/actions/get-mentions.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/get-mentions.action.js +30 -31
- package/dist/providers/twitter/actions/get-mentions.action.js.map +1 -1
- package/dist/providers/twitter/actions/get-timeline.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/get-timeline.action.js +29 -29
- package/dist/providers/twitter/actions/get-timeline.action.js.map +1 -1
- package/dist/providers/twitter/actions/schedule-tweet.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/schedule-tweet.action.js +26 -26
- package/dist/providers/twitter/actions/schedule-tweet.action.js.map +1 -1
- package/dist/providers/twitter/actions/search-tweets.action.d.ts.map +1 -1
- package/dist/providers/twitter/actions/search-tweets.action.js +56 -58
- package/dist/providers/twitter/actions/search-tweets.action.js.map +1 -1
- package/dist/providers/twitter/twitter-base.action.d.ts.map +1 -1
- package/dist/providers/twitter/twitter-base.action.js +58 -68
- package/dist/providers/twitter/twitter-base.action.js.map +1 -1
- package/dist/providers/youtube/youtube-base.action.d.ts +1 -1
- package/dist/providers/youtube/youtube-base.action.d.ts.map +1 -1
- package/dist/providers/youtube/youtube-base.action.js +22 -25
- package/dist/providers/youtube/youtube-base.action.js.map +1 -1
- package/package.json +5 -6
- package/src/base/base-social.action.ts +217 -224
- package/src/providers/buffer/buffer-base.action.ts +435 -441
- package/src/providers/facebook/actions/boost-post.action.ts +350 -386
- package/src/providers/facebook/actions/create-album.action.ts +291 -307
- package/src/providers/facebook/actions/create-post.action.ts +224 -227
- package/src/providers/facebook/actions/get-page-insights.action.ts +383 -403
- package/src/providers/facebook/actions/get-page-posts.action.ts +214 -225
- package/src/providers/facebook/actions/get-post-insights.action.ts +300 -316
- package/src/providers/facebook/actions/respond-to-comments.action.ts +319 -336
- package/src/providers/facebook/actions/schedule-post.action.ts +289 -292
- package/src/providers/facebook/actions/search-posts.action.ts +399 -413
- package/src/providers/facebook/facebook-base.action.ts +653 -670
- package/src/providers/hootsuite/actions/bulk-schedule-posts.action.ts +257 -257
- package/src/providers/hootsuite/actions/create-scheduled-post.action.ts +184 -189
- package/src/providers/hootsuite/actions/delete-scheduled-post.action.ts +160 -161
- package/src/providers/hootsuite/actions/get-analytics.action.ts +249 -254
- package/src/providers/hootsuite/actions/get-scheduled-posts.action.ts +206 -207
- package/src/providers/hootsuite/actions/get-social-profiles.action.ts +206 -205
- package/src/providers/hootsuite/actions/search-posts.action.ts +351 -369
- package/src/providers/hootsuite/actions/update-scheduled-post.action.ts +211 -209
- package/src/providers/hootsuite/hootsuite-base.action.ts +301 -307
- package/src/providers/instagram/actions/create-post.action.ts +276 -296
- package/src/providers/instagram/actions/create-story.action.ts +378 -394
- package/src/providers/instagram/actions/get-account-insights.action.ts +384 -420
- package/src/providers/instagram/actions/get-business-posts.action.ts +233 -242
- package/src/providers/instagram/actions/get-comments.action.ts +365 -377
- package/src/providers/instagram/actions/get-post-insights.action.ts +265 -273
- package/src/providers/instagram/actions/schedule-post.action.ts +233 -235
- package/src/providers/instagram/actions/search-posts.action.ts +512 -538
- package/src/providers/instagram/instagram-base.action.ts +368 -393
- package/src/providers/linkedin/actions/create-article.action.ts +275 -266
- package/src/providers/linkedin/actions/create-post.action.ts +179 -177
- package/src/providers/linkedin/actions/get-followers.action.ts +211 -211
- package/src/providers/linkedin/actions/get-organization-posts.action.ts +146 -147
- package/src/providers/linkedin/actions/get-personal-posts.action.ts +138 -139
- package/src/providers/linkedin/actions/get-post-analytics.action.ts +190 -189
- package/src/providers/linkedin/actions/schedule-post.action.ts +191 -189
- package/src/providers/linkedin/actions/search-posts.action.ts +275 -283
- package/src/providers/linkedin/linkedin-base.action.ts +407 -421
- package/src/providers/tiktok/tiktok-base.action.ts +305 -320
- package/src/providers/twitter/actions/create-thread.action.ts +203 -207
- package/src/providers/twitter/actions/create-tweet.action.ts +187 -188
- package/src/providers/twitter/actions/delete-tweet.action.ts +128 -129
- package/src/providers/twitter/actions/get-analytics.action.ts +402 -411
- package/src/providers/twitter/actions/get-mentions.action.ts +218 -219
- package/src/providers/twitter/actions/get-timeline.action.ts +232 -233
- package/src/providers/twitter/actions/schedule-tweet.action.ts +221 -222
- package/src/providers/twitter/actions/search-tweets.action.ts +540 -543
- package/src/providers/twitter/twitter-base.action.ts +541 -560
- package/src/providers/youtube/youtube-base.action.ts +320 -333
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RegisterClass } from '@memberjunction/global';
|
|
2
2
|
import { HootSuiteBaseAction, HootSuitePost } from '../hootsuite-base.action';
|
|
3
3
|
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
4
|
-
import { LogStatus, LogError } from '@memberjunction/
|
|
4
|
+
import { LogStatus, LogError } from '@memberjunction/global';
|
|
5
5
|
import { SocialPost } from '../../../base/base-social.action';
|
|
6
6
|
import { BaseAction } from '@memberjunction/actions';
|
|
7
7
|
|
|
@@ -10,212 +10,211 @@ import { BaseAction } from '@memberjunction/actions';
|
|
|
10
10
|
*/
|
|
11
11
|
@RegisterClass(BaseAction, 'HootSuiteGetScheduledPostsAction')
|
|
12
12
|
export class HootSuiteGetScheduledPostsAction extends HootSuiteBaseAction {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Get scheduled posts from HootSuite
|
|
15
|
+
*/
|
|
16
|
+
protected async InternalRunAction(params: RunActionParams): Promise<ActionResultSimple> {
|
|
17
|
+
const { Params, ContextUser } = params;
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
// Initialize OAuth
|
|
21
|
+
const companyIntegrationId = this.getParamValue(Params, 'CompanyIntegrationID');
|
|
22
|
+
if (!(await this.initializeOAuth(companyIntegrationId))) {
|
|
23
|
+
throw new Error('Failed to initialize OAuth connection');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Extract parameters
|
|
27
|
+
const profileId = this.getParamValue(Params, 'ProfileID');
|
|
28
|
+
const startDate = this.getParamValue(Params, 'StartDate');
|
|
29
|
+
const endDate = this.getParamValue(Params, 'EndDate');
|
|
30
|
+
const limit = this.getParamValue(Params, 'Limit') || 100;
|
|
31
|
+
const includeAnalytics = this.getParamValue(Params, 'IncludeAnalytics') || false;
|
|
32
|
+
|
|
33
|
+
// Build query parameters
|
|
34
|
+
const queryParams: any = {
|
|
35
|
+
state: 'SCHEDULED',
|
|
36
|
+
limit: Math.min(limit, 100),
|
|
37
|
+
maxResults: limit,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (profileId) {
|
|
41
|
+
queryParams.socialProfileIds = profileId;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (startDate) {
|
|
45
|
+
queryParams.scheduledAfter = this.formatHootSuiteDate(startDate);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (endDate) {
|
|
49
|
+
queryParams.scheduledBefore = this.formatHootSuiteDate(endDate);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Get scheduled posts
|
|
53
|
+
const posts = await this.makePaginatedRequest<HootSuitePost>('/messages', queryParams);
|
|
54
|
+
|
|
55
|
+
// Convert to common format
|
|
56
|
+
const normalizedPosts: SocialPost[] = await Promise.all(
|
|
57
|
+
posts.map(async (post) => {
|
|
58
|
+
const normalized = this.normalizePost(post);
|
|
59
|
+
|
|
60
|
+
// Optionally include analytics
|
|
61
|
+
if (includeAnalytics && post.state === 'PUBLISHED') {
|
|
62
|
+
try {
|
|
63
|
+
const analytics = await this.getPostAnalytics(post.id);
|
|
64
|
+
normalized.analytics = this.normalizeAnalytics(analytics);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
LogStatus(`Failed to get analytics for post ${post.id}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
24
67
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
normalized.analytics = this.normalizeAnalytics(analytics);
|
|
65
|
-
} catch (error) {
|
|
66
|
-
LogStatus(`Failed to get analytics for post ${post.id}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return normalized;
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
// Create summary
|
|
75
|
-
const summary = {
|
|
76
|
-
totalPosts: normalizedPosts.length,
|
|
77
|
-
byProfile: this.groupByProfile(posts),
|
|
78
|
-
byDate: this.groupByDate(normalizedPosts),
|
|
79
|
-
dateRange: {
|
|
80
|
-
start: startDate || 'Not specified',
|
|
81
|
-
end: endDate || 'Not specified'
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Update output parameters
|
|
86
|
-
const outputParams = [...Params];
|
|
87
|
-
const postsParam = outputParams.find(p => p.Name === 'ScheduledPosts');
|
|
88
|
-
if (postsParam) postsParam.Value = normalizedPosts;
|
|
89
|
-
const summaryParam = outputParams.find(p => p.Name === 'Summary');
|
|
90
|
-
if (summaryParam) summaryParam.Value = summary;
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
Success: true,
|
|
94
|
-
ResultCode: 'SUCCESS',
|
|
95
|
-
Message: `Retrieved ${normalizedPosts.length} scheduled posts`,
|
|
96
|
-
Params: outputParams
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
} catch (error) {
|
|
100
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
Success: false,
|
|
104
|
-
ResultCode: 'ERROR',
|
|
105
|
-
Message: `Failed to get scheduled posts: ${errorMessage}`,
|
|
106
|
-
Params
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Convert HootSuite post to common format
|
|
113
|
-
*/
|
|
114
|
-
protected normalizePost(hootsuitePost: HootSuitePost): SocialPost {
|
|
115
|
-
return {
|
|
116
|
-
id: hootsuitePost.id,
|
|
117
|
-
platform: 'HootSuite',
|
|
118
|
-
profileId: hootsuitePost.socialProfileIds.join(','), // Multiple profiles possible
|
|
119
|
-
content: hootsuitePost.text,
|
|
120
|
-
mediaUrls: hootsuitePost.mediaIds || [],
|
|
121
|
-
publishedAt: this.parseHootSuiteDate(hootsuitePost.createdTime),
|
|
122
|
-
scheduledFor: hootsuitePost.scheduledTime ? this.parseHootSuiteDate(hootsuitePost.scheduledTime) : undefined,
|
|
123
|
-
platformSpecificData: {
|
|
124
|
-
state: hootsuitePost.state,
|
|
125
|
-
tags: hootsuitePost.tags,
|
|
126
|
-
location: hootsuitePost.location,
|
|
127
|
-
socialProfileIds: hootsuitePost.socialProfileIds
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Get analytics for a specific post
|
|
134
|
-
*/
|
|
135
|
-
private async getPostAnalytics(postId: string): Promise<any> {
|
|
136
|
-
try {
|
|
137
|
-
const response = await this.axiosInstance.get(`/analytics/posts/${postId}`);
|
|
138
|
-
return response.data;
|
|
139
|
-
} catch (error) {
|
|
140
|
-
// Analytics might not be available for all posts
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Group posts by profile
|
|
147
|
-
*/
|
|
148
|
-
private groupByProfile(posts: HootSuitePost[]): Record<string, number> {
|
|
149
|
-
const groups: Record<string, number> = {};
|
|
150
|
-
|
|
151
|
-
posts.forEach(post => {
|
|
152
|
-
post.socialProfileIds.forEach(profileId => {
|
|
153
|
-
groups[profileId] = (groups[profileId] || 0) + 1;
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
return groups;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return normalized;
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// Create summary
|
|
75
|
+
const summary = {
|
|
76
|
+
totalPosts: normalizedPosts.length,
|
|
77
|
+
byProfile: this.groupByProfile(posts),
|
|
78
|
+
byDate: this.groupByDate(normalizedPosts),
|
|
79
|
+
dateRange: {
|
|
80
|
+
start: startDate || 'Not specified',
|
|
81
|
+
end: endDate || 'Not specified',
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Update output parameters
|
|
86
|
+
const outputParams = [...Params];
|
|
87
|
+
const postsParam = outputParams.find((p) => p.Name === 'ScheduledPosts');
|
|
88
|
+
if (postsParam) postsParam.Value = normalizedPosts;
|
|
89
|
+
const summaryParam = outputParams.find((p) => p.Name === 'Summary');
|
|
90
|
+
if (summaryParam) summaryParam.Value = summary;
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
Success: true,
|
|
94
|
+
ResultCode: 'SUCCESS',
|
|
95
|
+
Message: `Retrieved ${normalizedPosts.length} scheduled posts`,
|
|
96
|
+
Params: outputParams,
|
|
97
|
+
};
|
|
98
|
+
} catch (error) {
|
|
99
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
Success: false,
|
|
103
|
+
ResultCode: 'ERROR',
|
|
104
|
+
Message: `Failed to get scheduled posts: ${errorMessage}`,
|
|
105
|
+
Params,
|
|
106
|
+
};
|
|
158
107
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{
|
|
193
|
-
Name: 'Limit',
|
|
194
|
-
Type: 'Input',
|
|
195
|
-
Value: null
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
Name: 'IncludeAnalytics',
|
|
199
|
-
Type: 'Input',
|
|
200
|
-
Value: null
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
Name: 'ScheduledPosts',
|
|
204
|
-
Type: 'Output',
|
|
205
|
-
Value: null
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
Name: 'Summary',
|
|
209
|
-
Type: 'Output',
|
|
210
|
-
Value: null
|
|
211
|
-
}
|
|
212
|
-
];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Get action description
|
|
217
|
-
*/
|
|
218
|
-
public get Description(): string {
|
|
219
|
-
return 'Retrieves scheduled posts from HootSuite with optional date filtering and analytics';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Convert HootSuite post to common format
|
|
112
|
+
*/
|
|
113
|
+
protected normalizePost(hootsuitePost: HootSuitePost): SocialPost {
|
|
114
|
+
return {
|
|
115
|
+
id: hootsuitePost.id,
|
|
116
|
+
platform: 'HootSuite',
|
|
117
|
+
profileId: hootsuitePost.socialProfileIds.join(','), // Multiple profiles possible
|
|
118
|
+
content: hootsuitePost.text,
|
|
119
|
+
mediaUrls: hootsuitePost.mediaIds || [],
|
|
120
|
+
publishedAt: this.parseHootSuiteDate(hootsuitePost.createdTime),
|
|
121
|
+
scheduledFor: hootsuitePost.scheduledTime ? this.parseHootSuiteDate(hootsuitePost.scheduledTime) : undefined,
|
|
122
|
+
platformSpecificData: {
|
|
123
|
+
state: hootsuitePost.state,
|
|
124
|
+
tags: hootsuitePost.tags,
|
|
125
|
+
location: hootsuitePost.location,
|
|
126
|
+
socialProfileIds: hootsuitePost.socialProfileIds,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Get analytics for a specific post
|
|
133
|
+
*/
|
|
134
|
+
private async getPostAnalytics(postId: string): Promise<any> {
|
|
135
|
+
try {
|
|
136
|
+
const response = await this.axiosInstance.get(`/analytics/posts/${postId}`);
|
|
137
|
+
return response.data;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
// Analytics might not be available for all posts
|
|
140
|
+
return null;
|
|
220
141
|
}
|
|
221
|
-
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Group posts by profile
|
|
146
|
+
*/
|
|
147
|
+
private groupByProfile(posts: HootSuitePost[]): Record<string, number> {
|
|
148
|
+
const groups: Record<string, number> = {};
|
|
149
|
+
|
|
150
|
+
posts.forEach((post) => {
|
|
151
|
+
post.socialProfileIds.forEach((profileId) => {
|
|
152
|
+
groups[profileId] = (groups[profileId] || 0) + 1;
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return groups;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Group posts by scheduled date
|
|
161
|
+
*/
|
|
162
|
+
private groupByDate(posts: SocialPost[]): Record<string, number> {
|
|
163
|
+
const groups: Record<string, number> = {};
|
|
164
|
+
|
|
165
|
+
posts.forEach((post) => {
|
|
166
|
+
if (post.scheduledFor) {
|
|
167
|
+
const dateKey = post.scheduledFor.toISOString().split('T')[0];
|
|
168
|
+
groups[dateKey] = (groups[dateKey] || 0) + 1;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return groups;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Define the parameters this action expects
|
|
177
|
+
*/
|
|
178
|
+
public get Params(): ActionParam[] {
|
|
179
|
+
return [
|
|
180
|
+
...this.commonSocialParams,
|
|
181
|
+
{
|
|
182
|
+
Name: 'StartDate',
|
|
183
|
+
Type: 'Input',
|
|
184
|
+
Value: null,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
Name: 'EndDate',
|
|
188
|
+
Type: 'Input',
|
|
189
|
+
Value: null,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
Name: 'Limit',
|
|
193
|
+
Type: 'Input',
|
|
194
|
+
Value: null,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
Name: 'IncludeAnalytics',
|
|
198
|
+
Type: 'Input',
|
|
199
|
+
Value: null,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
Name: 'ScheduledPosts',
|
|
203
|
+
Type: 'Output',
|
|
204
|
+
Value: null,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
Name: 'Summary',
|
|
208
|
+
Type: 'Output',
|
|
209
|
+
Value: null,
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Get action description
|
|
216
|
+
*/
|
|
217
|
+
public get Description(): string {
|
|
218
|
+
return 'Retrieves scheduled posts from HootSuite with optional date filtering and analytics';
|
|
219
|
+
}
|
|
220
|
+
}
|