@memberjunction/actions-bizapps-social 2.112.0 → 2.113.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 +13 -0
- package/dist/base/base-social.action.d.ts.map +1 -1
- package/dist/base/base-social.action.js +24 -18
- 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 +34 -35
- 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 +36 -34
- 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 +27 -25
- 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 +23 -19
- 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 +32 -28
- 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 +44 -42
- 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 +39 -37
- 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 +59 -44
- 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 +31 -33
- 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 +32 -28
- 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 +26 -24
- 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 +34 -32
- 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 +52 -43
- 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 +28 -30
- 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 +20 -18
- 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 +26 -27
- 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 +59 -38
- 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 +25 -23
- 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 +60 -56
- 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 +27 -25
- 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 +45 -55
- 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 +29 -31
- 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 +23 -25
- 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 +30 -32
- 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 +30 -28
- 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 +38 -33
- 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 +26 -25
- 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 +29 -25
- 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 +47 -40
- 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 +31 -30
- 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 +58 -56
- 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 +68 -58
- 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 +25 -22
- package/dist/providers/youtube/youtube-base.action.js.map +1 -1
- package/package.json +6 -5
- package/src/base/base-social.action.ts +224 -217
- package/src/providers/buffer/buffer-base.action.ts +441 -435
- package/src/providers/facebook/actions/boost-post.action.ts +386 -350
- package/src/providers/facebook/actions/create-album.action.ts +307 -291
- package/src/providers/facebook/actions/create-post.action.ts +227 -224
- package/src/providers/facebook/actions/get-page-insights.action.ts +403 -383
- package/src/providers/facebook/actions/get-page-posts.action.ts +225 -214
- package/src/providers/facebook/actions/get-post-insights.action.ts +316 -300
- package/src/providers/facebook/actions/respond-to-comments.action.ts +336 -319
- package/src/providers/facebook/actions/schedule-post.action.ts +292 -289
- package/src/providers/facebook/actions/search-posts.action.ts +413 -399
- package/src/providers/facebook/facebook-base.action.ts +670 -653
- package/src/providers/hootsuite/actions/bulk-schedule-posts.action.ts +257 -257
- package/src/providers/hootsuite/actions/create-scheduled-post.action.ts +189 -184
- package/src/providers/hootsuite/actions/delete-scheduled-post.action.ts +161 -160
- package/src/providers/hootsuite/actions/get-analytics.action.ts +254 -249
- package/src/providers/hootsuite/actions/get-scheduled-posts.action.ts +207 -206
- package/src/providers/hootsuite/actions/get-social-profiles.action.ts +205 -206
- package/src/providers/hootsuite/actions/search-posts.action.ts +369 -351
- package/src/providers/hootsuite/actions/update-scheduled-post.action.ts +209 -211
- package/src/providers/hootsuite/hootsuite-base.action.ts +307 -301
- package/src/providers/instagram/actions/create-post.action.ts +296 -276
- package/src/providers/instagram/actions/create-story.action.ts +394 -378
- package/src/providers/instagram/actions/get-account-insights.action.ts +420 -384
- package/src/providers/instagram/actions/get-business-posts.action.ts +242 -233
- package/src/providers/instagram/actions/get-comments.action.ts +377 -365
- package/src/providers/instagram/actions/get-post-insights.action.ts +273 -265
- package/src/providers/instagram/actions/schedule-post.action.ts +235 -233
- package/src/providers/instagram/actions/search-posts.action.ts +538 -512
- package/src/providers/instagram/instagram-base.action.ts +393 -368
- package/src/providers/linkedin/actions/create-article.action.ts +266 -275
- package/src/providers/linkedin/actions/create-post.action.ts +177 -179
- package/src/providers/linkedin/actions/get-followers.action.ts +211 -211
- package/src/providers/linkedin/actions/get-organization-posts.action.ts +147 -146
- package/src/providers/linkedin/actions/get-personal-posts.action.ts +139 -138
- package/src/providers/linkedin/actions/get-post-analytics.action.ts +189 -190
- package/src/providers/linkedin/actions/schedule-post.action.ts +189 -191
- package/src/providers/linkedin/actions/search-posts.action.ts +283 -275
- package/src/providers/linkedin/linkedin-base.action.ts +421 -407
- package/src/providers/tiktok/tiktok-base.action.ts +320 -305
- package/src/providers/twitter/actions/create-thread.action.ts +207 -203
- package/src/providers/twitter/actions/create-tweet.action.ts +188 -187
- package/src/providers/twitter/actions/delete-tweet.action.ts +129 -128
- package/src/providers/twitter/actions/get-analytics.action.ts +411 -402
- package/src/providers/twitter/actions/get-mentions.action.ts +219 -218
- package/src/providers/twitter/actions/get-timeline.action.ts +233 -232
- package/src/providers/twitter/actions/schedule-tweet.action.ts +222 -221
- package/src/providers/twitter/actions/search-tweets.action.ts +543 -540
- package/src/providers/twitter/twitter-base.action.ts +560 -541
- package/src/providers/youtube/youtube-base.action.ts +333 -320
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RegisterClass } from '@memberjunction/global';
|
|
2
2
|
import { HootSuiteBaseAction } 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/core';
|
|
5
5
|
import { MediaFile } from '../../../base/base-social.action';
|
|
6
6
|
import { BaseAction } from '@memberjunction/actions';
|
|
7
7
|
|
|
@@ -10,193 +10,198 @@ import { BaseAction } from '@memberjunction/actions';
|
|
|
10
10
|
*/
|
|
11
11
|
@RegisterClass(BaseAction, 'HootSuiteCreateScheduledPostAction')
|
|
12
12
|
export class HootSuiteCreateScheduledPostAction extends HootSuiteBaseAction {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Create a scheduled post in 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 content = this.getParamValue(Params, 'Content');
|
|
28
|
+
const profileIds = this.getParamValue(Params, 'ProfileIDs');
|
|
29
|
+
const scheduledTime = this.getParamValue(Params, 'ScheduledTime');
|
|
30
|
+
const mediaFiles = this.getParamValue(Params, 'MediaFiles');
|
|
31
|
+
const tags = this.getParamValue(Params, 'Tags');
|
|
32
|
+
const location = this.getParamValue(Params, 'Location');
|
|
33
|
+
const targetingOptions = this.getParamValue(Params, 'TargetingOptions');
|
|
34
|
+
|
|
35
|
+
// Validate required parameters
|
|
36
|
+
if (!content) {
|
|
37
|
+
throw new Error('Content is required');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Get profile IDs - either from parameter or default profiles
|
|
41
|
+
let socialProfileIds: string[] = [];
|
|
42
|
+
if (profileIds && Array.isArray(profileIds)) {
|
|
43
|
+
socialProfileIds = profileIds;
|
|
44
|
+
} else if (profileIds && typeof profileIds === 'string') {
|
|
45
|
+
socialProfileIds = [profileIds];
|
|
46
|
+
} else {
|
|
47
|
+
// Get default profiles if none specified
|
|
48
|
+
const profiles = await this.getSocialProfiles();
|
|
49
|
+
if (profiles.length === 0) {
|
|
50
|
+
throw new Error('No social profiles found. Please specify ProfileIDs.');
|
|
51
|
+
}
|
|
52
|
+
socialProfileIds = profiles.map(p => p.id);
|
|
53
|
+
LogStatus(`Using ${socialProfileIds.length} default profiles`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Upload media if provided
|
|
57
|
+
let mediaIds: string[] = [];
|
|
58
|
+
if (mediaFiles && Array.isArray(mediaFiles)) {
|
|
59
|
+
LogStatus(`Uploading ${mediaFiles.length} media files...`);
|
|
60
|
+
mediaIds = await this.uploadMedia(mediaFiles as MediaFile[]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Build post data
|
|
64
|
+
const postData: any = {
|
|
65
|
+
text: content,
|
|
66
|
+
socialProfileIds: socialProfileIds,
|
|
67
|
+
scheduledTime: scheduledTime ? this.formatHootSuiteDate(scheduledTime) : undefined,
|
|
68
|
+
mediaIds: mediaIds.length > 0 ? mediaIds : undefined,
|
|
69
|
+
tags: tags && Array.isArray(tags) ? tags : undefined,
|
|
70
|
+
location: location ? {
|
|
71
|
+
latitude: location.latitude,
|
|
72
|
+
longitude: location.longitude
|
|
73
|
+
} : undefined
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Add targeting options if provided
|
|
77
|
+
if (targetingOptions) {
|
|
78
|
+
postData.targeting = targetingOptions;
|
|
74
79
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Success: false,
|
|
109
|
-
ResultCode: 'ERROR',
|
|
110
|
-
Message: `Failed to create scheduled post: ${errorMessage}`,
|
|
111
|
-
Params,
|
|
112
|
-
};
|
|
80
|
+
|
|
81
|
+
// Create the post
|
|
82
|
+
LogStatus('Creating scheduled post...');
|
|
83
|
+
const response = await this.axiosInstance.post('/messages', postData);
|
|
84
|
+
const createdPost = response.data;
|
|
85
|
+
|
|
86
|
+
// Normalize the created post
|
|
87
|
+
const normalizedPost = this.normalizePost(createdPost);
|
|
88
|
+
|
|
89
|
+
// Update output parameters
|
|
90
|
+
const outputParams = [...Params];
|
|
91
|
+
const postParam = outputParams.find(p => p.Name === 'CreatedPost');
|
|
92
|
+
if (postParam) postParam.Value = normalizedPost;
|
|
93
|
+
const postIdParam = outputParams.find(p => p.Name === 'PostID');
|
|
94
|
+
if (postIdParam) postIdParam.Value = createdPost.id;
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
Success: true,
|
|
98
|
+
ResultCode: 'SUCCESS',
|
|
99
|
+
Message: `Successfully created scheduled post (ID: ${createdPost.id})`,
|
|
100
|
+
Params: outputParams
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
} catch (error) {
|
|
104
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
Success: false,
|
|
108
|
+
ResultCode: 'ERROR',
|
|
109
|
+
Message: `Failed to create scheduled post: ${errorMessage}`,
|
|
110
|
+
Params
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
113
|
}
|
|
114
|
-
}
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Validate media files before upload
|
|
117
|
+
*/
|
|
118
|
+
protected validateMediaFile(file: MediaFile): void {
|
|
119
|
+
// HootSuite-specific media limits
|
|
120
|
+
const supportedTypes = [
|
|
121
|
+
'image/jpeg',
|
|
122
|
+
'image/png',
|
|
123
|
+
'image/gif',
|
|
124
|
+
'video/mp4',
|
|
125
|
+
'video/quicktime'
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
if (!supportedTypes.includes(file.mimeType)) {
|
|
129
|
+
throw new Error(`Unsupported media type: ${file.mimeType}. Supported types: ${supportedTypes.join(', ')}`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Check file sizes
|
|
133
|
+
const maxSizes: Record<string, number> = {
|
|
134
|
+
'image/jpeg': 10 * 1024 * 1024, // 10MB
|
|
135
|
+
'image/png': 10 * 1024 * 1024, // 10MB
|
|
136
|
+
'image/gif': 15 * 1024 * 1024, // 15MB
|
|
137
|
+
'video/mp4': 500 * 1024 * 1024, // 500MB
|
|
138
|
+
'video/quicktime': 500 * 1024 * 1024 // 500MB
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const maxSize = maxSizes[file.mimeType];
|
|
142
|
+
if (file.size > maxSize) {
|
|
143
|
+
throw new Error(`File size exceeds limit for ${file.mimeType}. Max: ${maxSize / 1024 / 1024}MB, Got: ${file.size / 1024 / 1024}MB`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
122
146
|
|
|
123
|
-
|
|
124
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Define the parameters this action expects
|
|
149
|
+
*/
|
|
150
|
+
public get Params(): ActionParam[] {
|
|
151
|
+
return [
|
|
152
|
+
...this.commonSocialParams,
|
|
153
|
+
{
|
|
154
|
+
Name: 'Content',
|
|
155
|
+
Type: 'Input',
|
|
156
|
+
Value: null
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
Name: 'ProfileIDs',
|
|
160
|
+
Type: 'Input',
|
|
161
|
+
Value: null
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
Name: 'ScheduledTime',
|
|
165
|
+
Type: 'Input',
|
|
166
|
+
Value: null
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
Name: 'MediaFiles',
|
|
170
|
+
Type: 'Input',
|
|
171
|
+
Value: null
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
Name: 'Tags',
|
|
175
|
+
Type: 'Input',
|
|
176
|
+
Value: null
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
Name: 'Location',
|
|
180
|
+
Type: 'Input',
|
|
181
|
+
Value: null
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
Name: 'TargetingOptions',
|
|
185
|
+
Type: 'Input',
|
|
186
|
+
Value: null
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
Name: 'CreatedPost',
|
|
190
|
+
Type: 'Output',
|
|
191
|
+
Value: null
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
Name: 'PostID',
|
|
195
|
+
Type: 'Output',
|
|
196
|
+
Value: null
|
|
197
|
+
}
|
|
198
|
+
];
|
|
125
199
|
}
|
|
126
200
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
'video/mp4': 500 * 1024 * 1024, // 500MB
|
|
133
|
-
'video/quicktime': 500 * 1024 * 1024, // 500MB
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const maxSize = maxSizes[file.mimeType];
|
|
137
|
-
if (file.size > maxSize) {
|
|
138
|
-
throw new Error(`File size exceeds limit for ${file.mimeType}. Max: ${maxSize / 1024 / 1024}MB, Got: ${file.size / 1024 / 1024}MB`);
|
|
201
|
+
/**
|
|
202
|
+
* Get action description
|
|
203
|
+
*/
|
|
204
|
+
public get Description(): string {
|
|
205
|
+
return 'Creates a scheduled post in HootSuite with support for multiple social profiles, media attachments, and scheduling';
|
|
139
206
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Define the parameters this action expects
|
|
144
|
-
*/
|
|
145
|
-
public get Params(): ActionParam[] {
|
|
146
|
-
return [
|
|
147
|
-
...this.commonSocialParams,
|
|
148
|
-
{
|
|
149
|
-
Name: 'Content',
|
|
150
|
-
Type: 'Input',
|
|
151
|
-
Value: null,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
Name: 'ProfileIDs',
|
|
155
|
-
Type: 'Input',
|
|
156
|
-
Value: null,
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
Name: 'ScheduledTime',
|
|
160
|
-
Type: 'Input',
|
|
161
|
-
Value: null,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
Name: 'MediaFiles',
|
|
165
|
-
Type: 'Input',
|
|
166
|
-
Value: null,
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
Name: 'Tags',
|
|
170
|
-
Type: 'Input',
|
|
171
|
-
Value: null,
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
Name: 'Location',
|
|
175
|
-
Type: 'Input',
|
|
176
|
-
Value: null,
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
Name: 'TargetingOptions',
|
|
180
|
-
Type: 'Input',
|
|
181
|
-
Value: null,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
Name: 'CreatedPost',
|
|
185
|
-
Type: 'Output',
|
|
186
|
-
Value: null,
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
Name: 'PostID',
|
|
190
|
-
Type: 'Output',
|
|
191
|
-
Value: null,
|
|
192
|
-
},
|
|
193
|
-
];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Get action description
|
|
198
|
-
*/
|
|
199
|
-
public get Description(): string {
|
|
200
|
-
return 'Creates a scheduled post in HootSuite with support for multiple social profiles, media attachments, and scheduling';
|
|
201
|
-
}
|
|
202
|
-
}
|
|
207
|
+
}
|