@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,221 +1,222 @@
|
|
|
1
1
|
import { RegisterClass } from '@memberjunction/global';
|
|
2
2
|
import { HootSuiteBaseAction, HootSuiteProfile } 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 { BaseAction } from '@memberjunction/actions';
|
|
6
6
|
/**
|
|
7
7
|
* Action to retrieve social profiles connected to HootSuite account
|
|
8
8
|
*/
|
|
9
9
|
@RegisterClass(BaseAction, 'HootSuiteGetSocialProfilesAction')
|
|
10
10
|
export class HootSuiteGetSocialProfilesAction extends HootSuiteBaseAction {
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
// Get additional profile details if available
|
|
47
|
-
const details = await this.getProfileDetails(profile.id);
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
id: profile.id,
|
|
51
|
-
displayName: profile.displayName,
|
|
52
|
-
socialNetwork: this.mapSocialNetworkId(profile.socialNetworkId),
|
|
53
|
-
socialNetworkId: profile.socialNetworkId,
|
|
54
|
-
socialNetworkUserId: profile.socialNetworkUserId,
|
|
55
|
-
avatarUrl: profile.avatarUrl,
|
|
56
|
-
type: profile.type,
|
|
57
|
-
ownerId: profile.ownerId,
|
|
58
|
-
isActive: details?.isActive !== false,
|
|
59
|
-
followerCount: details?.followerCount,
|
|
60
|
-
followingCount: details?.followingCount,
|
|
61
|
-
postCount: details?.postCount,
|
|
62
|
-
profileUrl: details?.profileUrl,
|
|
63
|
-
verified: details?.verified || false
|
|
64
|
-
};
|
|
65
|
-
} catch (error) {
|
|
66
|
-
// If we can't get details, return basic info
|
|
67
|
-
LogStatus(`Could not get details for profile ${profile.id}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
68
|
-
return {
|
|
69
|
-
id: profile.id,
|
|
70
|
-
displayName: profile.displayName,
|
|
71
|
-
socialNetwork: this.mapSocialNetworkId(profile.socialNetworkId),
|
|
72
|
-
socialNetworkId: profile.socialNetworkId,
|
|
73
|
-
socialNetworkUserId: profile.socialNetworkUserId,
|
|
74
|
-
avatarUrl: profile.avatarUrl,
|
|
75
|
-
type: profile.type,
|
|
76
|
-
ownerId: profile.ownerId,
|
|
77
|
-
isActive: true
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
// Filter out inactive profiles if requested
|
|
84
|
-
const finalProfiles = includeInactive
|
|
85
|
-
? enrichedProfiles
|
|
86
|
-
: enrichedProfiles.filter(p => p.isActive);
|
|
87
|
-
|
|
88
|
-
// Create summary
|
|
89
|
-
const summary = {
|
|
90
|
-
totalProfiles: finalProfiles.length,
|
|
91
|
-
byNetwork: this.groupByNetwork(finalProfiles),
|
|
92
|
-
byType: this.groupByType(finalProfiles),
|
|
93
|
-
activeProfiles: finalProfiles.filter(p => p.isActive).length,
|
|
94
|
-
inactiveProfiles: finalProfiles.filter(p => !p.isActive).length,
|
|
95
|
-
verifiedProfiles: finalProfiles.filter(p => p.verified).length
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// Store default profile in custom attribute if not set
|
|
99
|
-
if (finalProfiles.length > 0 && !this.getCustomAttribute(1)) {
|
|
100
|
-
const defaultProfile = finalProfiles.find(p => p.isActive) || finalProfiles[0];
|
|
101
|
-
await this.setCustomAttribute(1, defaultProfile.id);
|
|
102
|
-
LogStatus(`Set default profile to: ${defaultProfile.displayName} (${defaultProfile.id})`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Update output parameters
|
|
106
|
-
const outputParams = [...Params];
|
|
107
|
-
const profilesParam = outputParams.find(p => p.Name === 'Profiles');
|
|
108
|
-
if (profilesParam) profilesParam.Value = finalProfiles;
|
|
109
|
-
const summaryParam = outputParams.find(p => p.Name === 'Summary');
|
|
110
|
-
if (summaryParam) summaryParam.Value = summary;
|
|
11
|
+
/**
|
|
12
|
+
* Get social profiles from HootSuite
|
|
13
|
+
*/
|
|
14
|
+
protected async InternalRunAction(params: RunActionParams): Promise<ActionResultSimple> {
|
|
15
|
+
const { Params, ContextUser } = params;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
// Initialize OAuth
|
|
19
|
+
const companyIntegrationId = this.getParamValue(Params, 'CompanyIntegrationID');
|
|
20
|
+
if (!(await this.initializeOAuth(companyIntegrationId))) {
|
|
21
|
+
throw new Error('Failed to initialize OAuth connection');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Extract parameters
|
|
25
|
+
const includeInactive = this.getParamValue(Params, 'IncludeInactive') || false;
|
|
26
|
+
const socialNetwork = this.getParamValue(Params, 'SocialNetwork');
|
|
27
|
+
|
|
28
|
+
// Get all profiles
|
|
29
|
+
LogStatus('Fetching social profiles...');
|
|
30
|
+
const profiles = await this.getSocialProfiles();
|
|
31
|
+
|
|
32
|
+
// Filter profiles based on parameters
|
|
33
|
+
let filteredProfiles = profiles;
|
|
34
|
+
|
|
35
|
+
// Filter by social network if specified
|
|
36
|
+
if (socialNetwork) {
|
|
37
|
+
filteredProfiles = filteredProfiles.filter((p) => p.socialNetworkId.toLowerCase() === socialNetwork.toLowerCase());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Process profiles to add additional information
|
|
41
|
+
const enrichedProfiles = await Promise.all(
|
|
42
|
+
filteredProfiles.map(async (profile) => {
|
|
43
|
+
try {
|
|
44
|
+
// Get additional profile details if available
|
|
45
|
+
const details = await this.getProfileDetails(profile.id);
|
|
111
46
|
|
|
112
47
|
return {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
48
|
+
id: profile.id,
|
|
49
|
+
displayName: profile.displayName,
|
|
50
|
+
socialNetwork: this.mapSocialNetworkId(profile.socialNetworkId),
|
|
51
|
+
socialNetworkId: profile.socialNetworkId,
|
|
52
|
+
socialNetworkUserId: profile.socialNetworkUserId,
|
|
53
|
+
avatarUrl: profile.avatarUrl,
|
|
54
|
+
type: profile.type,
|
|
55
|
+
ownerId: profile.ownerId,
|
|
56
|
+
isActive: details?.isActive !== false,
|
|
57
|
+
followerCount: details?.followerCount,
|
|
58
|
+
followingCount: details?.followingCount,
|
|
59
|
+
postCount: details?.postCount,
|
|
60
|
+
profileUrl: details?.profileUrl,
|
|
61
|
+
verified: details?.verified || false,
|
|
117
62
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
63
|
+
} catch (error) {
|
|
64
|
+
// If we can't get details, return basic info
|
|
65
|
+
LogStatus(`Could not get details for profile ${profile.id}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
122
66
|
return {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
67
|
+
id: profile.id,
|
|
68
|
+
displayName: profile.displayName,
|
|
69
|
+
socialNetwork: this.mapSocialNetworkId(profile.socialNetworkId),
|
|
70
|
+
socialNetworkId: profile.socialNetworkId,
|
|
71
|
+
socialNetworkUserId: profile.socialNetworkUserId,
|
|
72
|
+
avatarUrl: profile.avatarUrl,
|
|
73
|
+
type: profile.type,
|
|
74
|
+
ownerId: profile.ownerId,
|
|
75
|
+
isActive: true,
|
|
127
76
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Filter out inactive profiles if requested
|
|
82
|
+
const finalProfiles = includeInactive ? enrichedProfiles : enrichedProfiles.filter((p) => p.isActive);
|
|
83
|
+
|
|
84
|
+
// Create summary
|
|
85
|
+
const summary = {
|
|
86
|
+
totalProfiles: finalProfiles.length,
|
|
87
|
+
byNetwork: this.groupByNetwork(finalProfiles),
|
|
88
|
+
byType: this.groupByType(finalProfiles),
|
|
89
|
+
activeProfiles: finalProfiles.filter((p) => p.isActive).length,
|
|
90
|
+
inactiveProfiles: finalProfiles.filter((p) => !p.isActive).length,
|
|
91
|
+
verifiedProfiles: finalProfiles.filter((p) => p.verified).length,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Store default profile in custom attribute if not set
|
|
95
|
+
if (finalProfiles.length > 0 && !this.getCustomAttribute(1)) {
|
|
96
|
+
const defaultProfile = finalProfiles.find((p) => p.isActive) || finalProfiles[0];
|
|
97
|
+
await this.setCustomAttribute(1, defaultProfile.id);
|
|
98
|
+
LogStatus(`Set default profile to: ${defaultProfile.displayName} (${defaultProfile.id})`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Update output parameters
|
|
102
|
+
const outputParams = [...Params];
|
|
103
|
+
const profilesParam = outputParams.find((p) => p.Name === 'Profiles');
|
|
104
|
+
if (profilesParam) profilesParam.Value = finalProfiles;
|
|
105
|
+
const summaryParam = outputParams.find((p) => p.Name === 'Summary');
|
|
106
|
+
if (summaryParam) summaryParam.Value = summary;
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
Success: true,
|
|
110
|
+
ResultCode: 'SUCCESS',
|
|
111
|
+
Message: `Retrieved ${finalProfiles.length} social profiles`,
|
|
112
|
+
Params: outputParams,
|
|
113
|
+
};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
Success: false,
|
|
119
|
+
ResultCode: 'ERROR',
|
|
120
|
+
Message: `Failed to get social profiles: ${errorMessage}`,
|
|
121
|
+
Params,
|
|
122
|
+
};
|
|
162
123
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Group profiles by type
|
|
177
|
-
*/
|
|
178
|
-
private groupByType(profiles: any[]): Record<string, number> {
|
|
179
|
-
return profiles.reduce((groups, profile) => {
|
|
180
|
-
const type = profile.type || 'Unknown';
|
|
181
|
-
groups[type] = (groups[type] || 0) + 1;
|
|
182
|
-
return groups;
|
|
183
|
-
}, {} as Record<string, number>);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Define the parameters this action expects
|
|
188
|
-
*/
|
|
189
|
-
public get Params(): ActionParam[] {
|
|
190
|
-
return [
|
|
191
|
-
...this.oauthParams,
|
|
192
|
-
{
|
|
193
|
-
Name: 'IncludeInactive',
|
|
194
|
-
Type: 'Input',
|
|
195
|
-
Value: null
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
Name: 'SocialNetwork',
|
|
199
|
-
Type: 'Input',
|
|
200
|
-
Value: null
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
Name: 'Profiles',
|
|
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 all social profiles connected to the HootSuite account with optional filtering';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get additional details for a profile
|
|
128
|
+
*/
|
|
129
|
+
private async getProfileDetails(profileId: string): Promise<any> {
|
|
130
|
+
try {
|
|
131
|
+
const response = await this.axiosInstance.get(`/socialProfiles/${profileId}`);
|
|
132
|
+
return response.data;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
// Details endpoint might not be available for all profiles
|
|
135
|
+
return null;
|
|
220
136
|
}
|
|
221
|
-
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Map social network ID to readable name
|
|
141
|
+
*/
|
|
142
|
+
private mapSocialNetworkId(networkId: string): string {
|
|
143
|
+
const networkMap: Record<string, string> = {
|
|
144
|
+
TWITTER: 'Twitter',
|
|
145
|
+
FACEBOOK: 'Facebook',
|
|
146
|
+
FACEBOOK_PAGE: 'Facebook Page',
|
|
147
|
+
INSTAGRAM: 'Instagram',
|
|
148
|
+
INSTAGRAM_BUSINESS: 'Instagram Business',
|
|
149
|
+
LINKEDIN: 'LinkedIn',
|
|
150
|
+
LINKEDIN_COMPANY: 'LinkedIn Company',
|
|
151
|
+
PINTEREST: 'Pinterest',
|
|
152
|
+
YOUTUBE: 'YouTube',
|
|
153
|
+
TIKTOK: 'TikTok',
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return networkMap[networkId.toUpperCase()] || networkId;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Group profiles by network
|
|
161
|
+
*/
|
|
162
|
+
private groupByNetwork(profiles: any[]): Record<string, number> {
|
|
163
|
+
return profiles.reduce(
|
|
164
|
+
(groups, profile) => {
|
|
165
|
+
const network = profile.socialNetwork;
|
|
166
|
+
groups[network] = (groups[network] || 0) + 1;
|
|
167
|
+
return groups;
|
|
168
|
+
},
|
|
169
|
+
{} as Record<string, number>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Group profiles by type
|
|
175
|
+
*/
|
|
176
|
+
private groupByType(profiles: any[]): Record<string, number> {
|
|
177
|
+
return profiles.reduce(
|
|
178
|
+
(groups, profile) => {
|
|
179
|
+
const type = profile.type || 'Unknown';
|
|
180
|
+
groups[type] = (groups[type] || 0) + 1;
|
|
181
|
+
return groups;
|
|
182
|
+
},
|
|
183
|
+
{} as Record<string, number>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Define the parameters this action expects
|
|
189
|
+
*/
|
|
190
|
+
public get Params(): ActionParam[] {
|
|
191
|
+
return [
|
|
192
|
+
...this.oauthParams,
|
|
193
|
+
{
|
|
194
|
+
Name: 'IncludeInactive',
|
|
195
|
+
Type: 'Input',
|
|
196
|
+
Value: null,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
Name: 'SocialNetwork',
|
|
200
|
+
Type: 'Input',
|
|
201
|
+
Value: null,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
Name: 'Profiles',
|
|
205
|
+
Type: 'Output',
|
|
206
|
+
Value: null,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
Name: 'Summary',
|
|
210
|
+
Type: 'Output',
|
|
211
|
+
Value: null,
|
|
212
|
+
},
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Get action description
|
|
218
|
+
*/
|
|
219
|
+
public get Description(): string {
|
|
220
|
+
return 'Retrieves all social profiles connected to the HootSuite account with optional filtering';
|
|
221
|
+
}
|
|
222
|
+
}
|