d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
122 lines
3.5 KiB
TypeScript
122 lines
3.5 KiB
TypeScript
import type {
|
|
EnrichSearchPostReactionsByUrlParams,
|
|
EnrichSearchPostReactionsResponse,
|
|
} from '@/tools/enrich/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const searchPostReactionsByUrlTool: ToolConfig<
|
|
EnrichSearchPostReactionsByUrlParams,
|
|
EnrichSearchPostReactionsResponse
|
|
> = {
|
|
id: 'enrich_search_post_reactions_by_url',
|
|
name: 'Enrich Search Post Reactions by URL',
|
|
description: 'Get reactions on a LinkedIn post by its URL, filtered by reaction type.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Enrich API key',
|
|
},
|
|
postUrl: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'LinkedIn post URL (e.g., https://www.linkedin.com/posts/...)',
|
|
},
|
|
reactionType: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'Reaction type filter: all, like, love, celebrate, insightful, or funny (default: all)',
|
|
},
|
|
page: {
|
|
type: 'number',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Page number (starts at 1)',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const url = new URL('https://api.enrich.so/v1/api/search-reaction-by-url')
|
|
url.searchParams.append('post_url', params.postUrl.trim())
|
|
url.searchParams.append('reaction_type', params.reactionType)
|
|
url.searchParams.append('page', String(params.page))
|
|
return url.toString()
|
|
},
|
|
method: 'GET',
|
|
headers: (params) => ({
|
|
Authorization: `Bearer ${params.apiKey}`,
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
const resultData = data.data ?? {}
|
|
|
|
const reactions =
|
|
resultData.data?.map((reaction: any) => ({
|
|
reactionType: reaction.reaction_type ?? '',
|
|
reactor: {
|
|
name: reaction.reactor?.name ?? null,
|
|
subTitle: reaction.reactor?.sub_title ?? null,
|
|
profileId: reaction.reactor?.profile_id ?? null,
|
|
profilePicture: reaction.reactor?.profile_picture ?? null,
|
|
linkedInUrl: reaction.reactor?.li_url ?? null,
|
|
},
|
|
})) ?? []
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
page: resultData.page ?? 1,
|
|
totalPage: resultData.total_page ?? 1,
|
|
count: resultData.num ?? reactions.length,
|
|
reactions,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
page: {
|
|
type: 'number',
|
|
description: 'Current page number',
|
|
},
|
|
totalPage: {
|
|
type: 'number',
|
|
description: 'Total number of pages',
|
|
},
|
|
count: {
|
|
type: 'number',
|
|
description: 'Number of reactions returned',
|
|
},
|
|
reactions: {
|
|
type: 'array',
|
|
description: 'Reactions',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
reactionType: { type: 'string', description: 'Type of reaction' },
|
|
reactor: {
|
|
type: 'object',
|
|
description: 'Person who reacted',
|
|
properties: {
|
|
name: { type: 'string', description: 'Name' },
|
|
subTitle: { type: 'string', description: 'Job title' },
|
|
profileId: { type: 'string', description: 'Profile ID' },
|
|
profilePicture: { type: 'string', description: 'Profile picture URL' },
|
|
linkedInUrl: { type: 'string', description: 'LinkedIn URL' },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|