linkedin_react
React to a LinkedIn post with a like, celebrate, support, love, insightful, or funny reaction. Provide the post URL or URN for immediate action.
Instructions
React to a LinkedIn post via Unipile. Accepts a LinkedIn post URL (e.g. https://linkedin.com/feed/update/urn:li:activity:12345) or a raw URN (urn:li:activity:12345). This action is immediate — there is no dry_run. Reaction type defaults to 'like' if not specified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| post_url | Yes | LinkedIn post URL (linkedin.com/feed/update/...) or raw URN (urn:li:activity:...) | |
| reaction_type | No | Reaction type. One of: like, celebrate, support, love, insightful, funny. Defaults to "like". | like |
Implementation Reference
- src/tools/react.js:25-66 (handler)Main handler for the linkedin_react tool. Validates input (post_url, reaction_type), parses the URN, resolves the LinkedIn account, and calls the Unipile API to post the reaction.
export async function handleReact(args) { const { post_url, reaction_type = "like" } = args; if ( !post_url || typeof post_url !== "string" || post_url.trim().length === 0 ) { return { error: "post_url is required" }; } if (!VALID_REACTIONS.includes(reaction_type)) { return { error: `Invalid reaction_type: "${reaction_type}". Must be one of: ${VALID_REACTIONS.join(", ")}`, }; } const urn = parsePostUrn(post_url); if (!urn) { return { error: `Could not parse post URN from: "${post_url}". Provide a LinkedIn post URL or raw URN.`, }; } const accountResult = await resolveAccountId(); if (!accountResult.success) { return { error: `Could not resolve LinkedIn account: ${accountResult.error}`, }; } const result = await reactToPost(accountResult.data, urn, reaction_type); if (!result.success) { return { error: result.error, details: result.details }; } return { status: "reacted", post_urn: urn, reaction_type, }; } - src/server.js:106-123 (schema)Input schema for the linkedin_react tool: requires post_url string, accepts optional reaction_type enum (default 'like').
inputSchema: { type: "object", properties: { post_url: { type: "string", description: "LinkedIn post URL (linkedin.com/feed/update/...) or raw URN (urn:li:activity:...)", }, reaction_type: { type: "string", enum: ["like", "celebrate", "support", "love", "insightful", "funny"], description: 'Reaction type. One of: like, celebrate, support, love, insightful, funny. Defaults to "like".', default: "like", }, }, required: ["post_url"], }, - src/server.js:98-124 (registration)Tool definition registration — adds linkedin_react to the TOOLS array that gets listed via ListToolsRequestSchema.
{ name: "linkedin_react", description: "React to a LinkedIn post via Unipile. " + "Accepts a LinkedIn post URL (e.g. https://linkedin.com/feed/update/urn:li:activity:12345) " + "or a raw URN (urn:li:activity:12345). " + "This action is immediate — there is no dry_run. " + "Reaction type defaults to 'like' if not specified.", inputSchema: { type: "object", properties: { post_url: { type: "string", description: "LinkedIn post URL (linkedin.com/feed/update/...) or raw URN (urn:li:activity:...)", }, reaction_type: { type: "string", enum: ["like", "celebrate", "support", "love", "insightful", "funny"], description: 'Reaction type. One of: like, celebrate, support, love, insightful, funny. Defaults to "like".', default: "like", }, }, required: ["post_url"], }, }, - src/server.js:153-155 (registration)Dispatch routing — maps the 'linkedin_react' tool name to the handleReact function.
case "linkedin_react": result = await handleReact(args || {}); break; - src/unipile-client.js:256-270 (helper)Unipile API client helper that makes the HTTP POST to /posts/reaction with account_id, post_id (URN), and reaction_type.
export async function reactToPost(accountId, postUrn, reactionType = "like") { try { const response = await axios.post( `${BASE_URL}/posts/reaction`, { account_id: accountId, post_id: postUrn, reaction_type: reactionType }, { headers: authHeaders({ "Content-Type": "application/json" }), timeout: 15000, }, ); return { success: true, data: response.data }; } catch (err) { return apiError("reactToPost", err); }