@memberjunction/actions-bizapps-social 2.112.0 → 2.113.1
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 { LinkedInBaseAction, LinkedInShare } from '../linkedin-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 { SocialPost, SearchParams } from '../../../base/base-social.action';
|
|
6
6
|
import { BaseAction } from '@memberjunction/actions';
|
|
7
7
|
|
|
@@ -10,307 +10,315 @@ import { BaseAction } from '@memberjunction/actions';
|
|
|
10
10
|
*/
|
|
11
11
|
@RegisterClass(BaseAction, 'LinkedInSearchPostsAction')
|
|
12
12
|
export class LinkedInSearchPostsAction extends LinkedInBaseAction {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// Extract parameters
|
|
27
|
-
const query = this.getParamValue(Params, 'Query');
|
|
28
|
-
const hashtags = this.getParamValue(Params, 'Hashtags');
|
|
29
|
-
const startDate = this.getParamValue(Params, 'StartDate');
|
|
30
|
-
const endDate = this.getParamValue(Params, 'EndDate');
|
|
31
|
-
const authorType = this.getParamValue(Params, 'AuthorType') || 'all'; // 'personal', 'organization', 'all'
|
|
32
|
-
const organizationId = this.getParamValue(Params, 'OrganizationID');
|
|
33
|
-
const limit = this.getParamValue(Params, 'Limit') || 100;
|
|
34
|
-
const offset = this.getParamValue(Params, 'Offset') || 0;
|
|
35
|
-
const includeAnalytics = this.getParamValue(Params, 'IncludeAnalytics') === true;
|
|
36
|
-
|
|
37
|
-
// Build search parameters
|
|
38
|
-
const searchParams: SearchParams = {
|
|
39
|
-
query: query,
|
|
40
|
-
hashtags: hashtags,
|
|
41
|
-
startDate: startDate ? new Date(startDate) : undefined,
|
|
42
|
-
endDate: endDate ? new Date(endDate) : undefined,
|
|
43
|
-
limit: limit,
|
|
44
|
-
offset: offset,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Perform the search
|
|
48
|
-
const posts = await this.searchPostsImplementation(searchParams, authorType, organizationId, includeAnalytics);
|
|
49
|
-
|
|
50
|
-
LogStatus(`Found ${posts.length} posts matching search criteria`);
|
|
51
|
-
|
|
52
|
-
// Update output parameters
|
|
53
|
-
const outputParams = [...Params];
|
|
54
|
-
const postsParam = outputParams.find((p) => p.Name === 'Posts');
|
|
55
|
-
if (postsParam) postsParam.Value = posts;
|
|
56
|
-
const totalCountParam = outputParams.find((p) => p.Name === 'TotalCount');
|
|
57
|
-
if (totalCountParam) totalCountParam.Value = posts.length;
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
Success: true,
|
|
61
|
-
ResultCode: 'SUCCESS',
|
|
62
|
-
Message: `Successfully found ${posts.length} posts`,
|
|
63
|
-
Params: outputParams,
|
|
64
|
-
};
|
|
65
|
-
} catch (error) {
|
|
66
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
13
|
+
/**
|
|
14
|
+
* Search for posts on LinkedIn with various filters
|
|
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
|
+
}
|
|
67
25
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
26
|
+
// Extract parameters
|
|
27
|
+
const query = this.getParamValue(Params, 'Query');
|
|
28
|
+
const hashtags = this.getParamValue(Params, 'Hashtags');
|
|
29
|
+
const startDate = this.getParamValue(Params, 'StartDate');
|
|
30
|
+
const endDate = this.getParamValue(Params, 'EndDate');
|
|
31
|
+
const authorType = this.getParamValue(Params, 'AuthorType') || 'all'; // 'personal', 'organization', 'all'
|
|
32
|
+
const organizationId = this.getParamValue(Params, 'OrganizationID');
|
|
33
|
+
const limit = this.getParamValue(Params, 'Limit') || 100;
|
|
34
|
+
const offset = this.getParamValue(Params, 'Offset') || 0;
|
|
35
|
+
const includeAnalytics = this.getParamValue(Params, 'IncludeAnalytics') === true;
|
|
36
|
+
|
|
37
|
+
// Build search parameters
|
|
38
|
+
const searchParams: SearchParams = {
|
|
39
|
+
query: query,
|
|
40
|
+
hashtags: hashtags,
|
|
41
|
+
startDate: startDate ? new Date(startDate) : undefined,
|
|
42
|
+
endDate: endDate ? new Date(endDate) : undefined,
|
|
43
|
+
limit: limit,
|
|
44
|
+
offset: offset
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Perform the search
|
|
48
|
+
const posts = await this.searchPostsImplementation(
|
|
49
|
+
searchParams,
|
|
50
|
+
authorType,
|
|
51
|
+
organizationId,
|
|
52
|
+
includeAnalytics
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
LogStatus(`Found ${posts.length} posts matching search criteria`);
|
|
56
|
+
|
|
57
|
+
// Update output parameters
|
|
58
|
+
const outputParams = [...Params];
|
|
59
|
+
const postsParam = outputParams.find(p => p.Name === 'Posts');
|
|
60
|
+
if (postsParam) postsParam.Value = posts;
|
|
61
|
+
const totalCountParam = outputParams.find(p => p.Name === 'TotalCount');
|
|
62
|
+
if (totalCountParam) totalCountParam.Value = posts.length;
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
Success: true,
|
|
66
|
+
ResultCode: 'SUCCESS',
|
|
67
|
+
Message: `Successfully found ${posts.length} posts`,
|
|
68
|
+
Params: outputParams
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} catch (error) {
|
|
72
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
Success: false,
|
|
76
|
+
ResultCode: 'ERROR',
|
|
77
|
+
Message: `Failed to search posts: ${errorMessage}`,
|
|
78
|
+
Params
|
|
79
|
+
};
|
|
80
|
+
}
|
|
74
81
|
}
|
|
75
|
-
}
|
|
76
82
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Implementation of post search
|
|
85
|
+
*/
|
|
86
|
+
private async searchPostsImplementation(
|
|
87
|
+
params: SearchParams,
|
|
88
|
+
authorType: string,
|
|
89
|
+
organizationId?: string,
|
|
90
|
+
includeAnalytics: boolean = false
|
|
91
|
+
): Promise<SocialPost[]> {
|
|
92
|
+
const allPosts: SocialPost[] = [];
|
|
93
|
+
const authorsToSearch: string[] = [];
|
|
94
|
+
|
|
95
|
+
// Determine which authors to search
|
|
96
|
+
if (authorType === 'personal' || authorType === 'all') {
|
|
97
|
+
const userUrn = await this.getCurrentUserUrn();
|
|
98
|
+
authorsToSearch.push(userUrn);
|
|
99
|
+
}
|
|
88
100
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
if (authorType === 'organization' || authorType === 'all') {
|
|
102
|
+
if (organizationId) {
|
|
103
|
+
authorsToSearch.push(`urn:li:organization:${organizationId}`);
|
|
104
|
+
} else {
|
|
105
|
+
// Get all admin organizations
|
|
106
|
+
const orgs = await this.getAdminOrganizations();
|
|
107
|
+
authorsToSearch.push(...orgs.map(org => org.urn));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
94
110
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
// Search posts for each author
|
|
112
|
+
for (const authorUrn of authorsToSearch) {
|
|
113
|
+
LogStatus(`Searching posts for author: ${authorUrn}`);
|
|
114
|
+
|
|
115
|
+
// Get all posts for the author (LinkedIn doesn't support direct content search)
|
|
116
|
+
const shares = await this.getAllSharesForAuthor(authorUrn, params.limit || 100);
|
|
117
|
+
|
|
118
|
+
// Filter posts based on search criteria
|
|
119
|
+
for (const share of shares) {
|
|
120
|
+
if (this.matchesSearchCriteria(share, params)) {
|
|
121
|
+
const post = this.normalizePost(share);
|
|
122
|
+
|
|
123
|
+
// Optionally fetch analytics
|
|
124
|
+
if (includeAnalytics && authorUrn.includes('organization')) {
|
|
125
|
+
try {
|
|
126
|
+
const analytics = await this.getPostAnalyticsForSearch(share.id, authorUrn);
|
|
127
|
+
if (analytics) {
|
|
128
|
+
post.analytics = this.normalizeAnalytics(analytics);
|
|
129
|
+
}
|
|
130
|
+
} catch (error) {
|
|
131
|
+
LogError(`Failed to get analytics for post ${share.id}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
allPosts.push(post);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
104
139
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
LogStatus(`Searching posts for author: ${authorUrn}`);
|
|
140
|
+
// Sort by date (newest first)
|
|
141
|
+
allPosts.sort((a, b) => b.publishedAt.getTime() - a.publishedAt.getTime());
|
|
108
142
|
|
|
109
|
-
|
|
110
|
-
|
|
143
|
+
// Apply offset and limit
|
|
144
|
+
const startIndex = params.offset || 0;
|
|
145
|
+
const endIndex = startIndex + (params.limit || 100);
|
|
146
|
+
|
|
147
|
+
return allPosts.slice(startIndex, endIndex);
|
|
148
|
+
}
|
|
111
149
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Get all shares for an author with pagination
|
|
152
|
+
*/
|
|
153
|
+
private async getAllSharesForAuthor(authorUrn: string, maxResults: number): Promise<LinkedInShare[]> {
|
|
154
|
+
const allShares: LinkedInShare[] = [];
|
|
155
|
+
let start = 0;
|
|
156
|
+
const count = 50; // LinkedIn's typical page size
|
|
116
157
|
|
|
117
|
-
|
|
118
|
-
if (includeAnalytics && authorUrn.includes('organization')) {
|
|
158
|
+
while (allShares.length < maxResults) {
|
|
119
159
|
try {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
160
|
+
const shares = await this.getShares(authorUrn, count, start);
|
|
161
|
+
|
|
162
|
+
if (shares.length === 0) {
|
|
163
|
+
break; // No more results
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
allShares.push(...shares);
|
|
167
|
+
start += count;
|
|
168
|
+
|
|
169
|
+
// Check if we've hit the API limit
|
|
170
|
+
if (shares.length < count) {
|
|
171
|
+
break; // Last page
|
|
172
|
+
}
|
|
124
173
|
} catch (error) {
|
|
125
|
-
|
|
174
|
+
LogError(`Error fetching shares at offset ${start}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
175
|
+
break;
|
|
126
176
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
allPosts.push(post);
|
|
130
177
|
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Sort by date (newest first)
|
|
135
|
-
allPosts.sort((a, b) => b.publishedAt.getTime() - a.publishedAt.getTime());
|
|
136
178
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const endIndex = startIndex + (params.limit || 100);
|
|
140
|
-
|
|
141
|
-
return allPosts.slice(startIndex, endIndex);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Get all shares for an author with pagination
|
|
146
|
-
*/
|
|
147
|
-
private async getAllSharesForAuthor(authorUrn: string, maxResults: number): Promise<LinkedInShare[]> {
|
|
148
|
-
const allShares: LinkedInShare[] = [];
|
|
149
|
-
let start = 0;
|
|
150
|
-
const count = 50; // LinkedIn's typical page size
|
|
179
|
+
return allShares.slice(0, maxResults);
|
|
180
|
+
}
|
|
151
181
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Check if a share matches the search criteria
|
|
184
|
+
*/
|
|
185
|
+
private matchesSearchCriteria(share: LinkedInShare, params: SearchParams): boolean {
|
|
186
|
+
const content = share.specificContent?.['com.linkedin.ugc.ShareContent']?.shareCommentary?.text || '';
|
|
187
|
+
const publishedDate = new Date(share.firstPublishedAt || share.created.time);
|
|
155
188
|
|
|
156
|
-
|
|
157
|
-
|
|
189
|
+
// Check date range
|
|
190
|
+
if (params.startDate && publishedDate < params.startDate) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
if (params.endDate && publishedDate > params.endDate) {
|
|
194
|
+
return false;
|
|
158
195
|
}
|
|
159
196
|
|
|
160
|
-
|
|
161
|
-
|
|
197
|
+
// Check query (case-insensitive)
|
|
198
|
+
if (params.query) {
|
|
199
|
+
const query = params.query.toLowerCase();
|
|
200
|
+
if (!content.toLowerCase().includes(query)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
162
204
|
|
|
163
|
-
// Check
|
|
164
|
-
if (
|
|
165
|
-
|
|
205
|
+
// Check hashtags
|
|
206
|
+
if (params.hashtags && params.hashtags.length > 0) {
|
|
207
|
+
const contentLower = content.toLowerCase();
|
|
208
|
+
const hasAllHashtags = params.hashtags.every(hashtag => {
|
|
209
|
+
const normalizedHashtag = hashtag.toLowerCase().startsWith('#')
|
|
210
|
+
? hashtag.toLowerCase()
|
|
211
|
+
: `#${hashtag.toLowerCase()}`;
|
|
212
|
+
return contentLower.includes(normalizedHashtag);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
if (!hasAllHashtags) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
166
218
|
}
|
|
167
|
-
} catch (error) {
|
|
168
|
-
LogError(`Error fetching shares at offset ${start}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
219
|
|
|
173
|
-
|
|
174
|
-
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
175
222
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Get analytics for a post during search
|
|
225
|
+
*/
|
|
226
|
+
private async getPostAnalyticsForSearch(shareId: string, organizationUrn: string): Promise<any> {
|
|
227
|
+
try {
|
|
228
|
+
const response = await this.axiosInstance.get('/organizationalEntityShareStatistics', {
|
|
229
|
+
params: {
|
|
230
|
+
q: 'organizationalEntity',
|
|
231
|
+
organizationalEntity: organizationUrn,
|
|
232
|
+
shares: `List(${shareId})`
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
if (response.data.elements && response.data.elements.length > 0) {
|
|
237
|
+
return response.data.elements[0];
|
|
238
|
+
}
|
|
182
239
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return false;
|
|
240
|
+
return null;
|
|
241
|
+
} catch (error) {
|
|
242
|
+
// Silently fail for individual analytics requests during search
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
189
245
|
}
|
|
190
246
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return
|
|
196
|
-
}
|
|
247
|
+
/**
|
|
248
|
+
* Override base searchPosts method
|
|
249
|
+
*/
|
|
250
|
+
protected async searchPosts(params: SearchParams): Promise<SocialPost[]> {
|
|
251
|
+
return this.searchPostsImplementation(params, 'all');
|
|
197
252
|
}
|
|
198
253
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Define the parameters this action expects
|
|
256
|
+
*/
|
|
257
|
+
public get Params(): ActionParam[] {
|
|
258
|
+
return [
|
|
259
|
+
...this.commonSocialParams,
|
|
260
|
+
{
|
|
261
|
+
Name: 'Query',
|
|
262
|
+
Type: 'Input',
|
|
263
|
+
Value: null
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
Name: 'Hashtags',
|
|
267
|
+
Type: 'Input',
|
|
268
|
+
Value: null // Array of hashtags
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
Name: 'StartDate',
|
|
272
|
+
Type: 'Input',
|
|
273
|
+
Value: null
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
Name: 'EndDate',
|
|
277
|
+
Type: 'Input',
|
|
278
|
+
Value: null
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
Name: 'AuthorType',
|
|
282
|
+
Type: 'Input',
|
|
283
|
+
Value: 'all' // 'personal', 'organization', 'all'
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
Name: 'OrganizationID',
|
|
287
|
+
Type: 'Input',
|
|
288
|
+
Value: null
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
Name: 'Limit',
|
|
292
|
+
Type: 'Input',
|
|
293
|
+
Value: 100
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
Name: 'Offset',
|
|
297
|
+
Type: 'Input',
|
|
298
|
+
Value: 0
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
Name: 'IncludeAnalytics',
|
|
302
|
+
Type: 'Input',
|
|
303
|
+
Value: false
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
Name: 'Posts',
|
|
307
|
+
Type: 'Output',
|
|
308
|
+
Value: null
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
Name: 'TotalCount',
|
|
312
|
+
Type: 'Output',
|
|
313
|
+
Value: null
|
|
314
|
+
}
|
|
315
|
+
];
|
|
210
316
|
}
|
|
211
317
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
*/
|
|
218
|
-
private async getPostAnalyticsForSearch(shareId: string, organizationUrn: string): Promise<any> {
|
|
219
|
-
try {
|
|
220
|
-
const response = await this.axiosInstance.get('/organizationalEntityShareStatistics', {
|
|
221
|
-
params: {
|
|
222
|
-
q: 'organizationalEntity',
|
|
223
|
-
organizationalEntity: organizationUrn,
|
|
224
|
-
shares: `List(${shareId})`,
|
|
225
|
-
},
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
if (response.data.elements && response.data.elements.length > 0) {
|
|
229
|
-
return response.data.elements[0];
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return null;
|
|
233
|
-
} catch (error) {
|
|
234
|
-
// Silently fail for individual analytics requests during search
|
|
235
|
-
return null;
|
|
318
|
+
/**
|
|
319
|
+
* Get action description
|
|
320
|
+
*/
|
|
321
|
+
public get Description(): string {
|
|
322
|
+
return 'Searches for historical LinkedIn posts with support for content search, hashtags, date ranges, and author filtering. Retrieves posts from personal profiles and organization pages.';
|
|
236
323
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Override base searchPosts method
|
|
241
|
-
*/
|
|
242
|
-
protected async searchPosts(params: SearchParams): Promise<SocialPost[]> {
|
|
243
|
-
return this.searchPostsImplementation(params, 'all');
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Define the parameters this action expects
|
|
248
|
-
*/
|
|
249
|
-
public get Params(): ActionParam[] {
|
|
250
|
-
return [
|
|
251
|
-
...this.commonSocialParams,
|
|
252
|
-
{
|
|
253
|
-
Name: 'Query',
|
|
254
|
-
Type: 'Input',
|
|
255
|
-
Value: null,
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
Name: 'Hashtags',
|
|
259
|
-
Type: 'Input',
|
|
260
|
-
Value: null, // Array of hashtags
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
Name: 'StartDate',
|
|
264
|
-
Type: 'Input',
|
|
265
|
-
Value: null,
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
Name: 'EndDate',
|
|
269
|
-
Type: 'Input',
|
|
270
|
-
Value: null,
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
Name: 'AuthorType',
|
|
274
|
-
Type: 'Input',
|
|
275
|
-
Value: 'all', // 'personal', 'organization', 'all'
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
Name: 'OrganizationID',
|
|
279
|
-
Type: 'Input',
|
|
280
|
-
Value: null,
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
Name: 'Limit',
|
|
284
|
-
Type: 'Input',
|
|
285
|
-
Value: 100,
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
Name: 'Offset',
|
|
289
|
-
Type: 'Input',
|
|
290
|
-
Value: 0,
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
Name: 'IncludeAnalytics',
|
|
294
|
-
Type: 'Input',
|
|
295
|
-
Value: false,
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
Name: 'Posts',
|
|
299
|
-
Type: 'Output',
|
|
300
|
-
Value: null,
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
Name: 'TotalCount',
|
|
304
|
-
Type: 'Output',
|
|
305
|
-
Value: null,
|
|
306
|
-
},
|
|
307
|
-
];
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Get action description
|
|
312
|
-
*/
|
|
313
|
-
public get Description(): string {
|
|
314
|
-
return 'Searches for historical LinkedIn posts with support for content search, hashtags, date ranges, and author filtering. Retrieves posts from personal profiles and organization pages.';
|
|
315
|
-
}
|
|
316
|
-
}
|
|
324
|
+
}
|