Detalle del Skill

linkedin

Useful company-page publishing integration, but requires organization-specific credentials.

CoincidenciaPosibleRevisado para linkedin
Fuenteteamday-ai/agentsFuente externa
Instalaciones reportadas1Solo señal de popularidad

Revisar antes de usar

La revisión automática comprueba relevancia, no seguridad ni respaldo. Lee las instrucciones de la fuente antes de usar este Skill.

Vista previa guardada

SKILL.md

Este extracto es una copia guardada durante la revisión. La fuente externa contiene la versión completa y actual.

---
name: linkedin
description: Post updates to a LinkedIn company page. Use for sharing blog posts, product updates, AI-generated content, and company announcements. Supports text posts, article shares with link previews, and image posts.
version: 1.0.0
allowed-tools: Bash, Read
env:
  - LINKEDIN_ACCESS_TOKEN
  - LINKEDIN_ORG_ID
metadata:
  requires: credential-activation
  credentials:
    - LINKEDIN_ACCESS_TOKEN
    - LINKEDIN_ORG_ID
---

# LinkedIn Skill

Post content to a LinkedIn organization page using the LinkedIn REST API.

## Prerequisites

Credentials must be configured as Space environment variables.

| Variable | Required | Description | Example |
|----------|----------|-------------|---------|
| `LINKEDIN_ACCESS_TOKEN` | Yes | OAuth 2.0 Bearer token (expires every 2 months) | `AQV...` |
| `LINKEDIN_ORG_ID` | Yes | LinkedIn organization numeric ID | `104061442` |

### Verify Setup

```bash
echo "LINKEDIN_ACCESS_TOKEN: ${LINKEDIN_ACCESS_TOKEN:+configured (${#LINKEDIN_ACCESS_TOKEN} chars)}"
echo "LINKEDIN_ORG_ID: ${LINKEDIN_ORG_ID:-not set}"
```

If not configured, use the `credential-activation` skill to guide the user through setup.

## API Basics

All requests use these common headers:

```bash
-H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
-H "Linkedin-Version: 202601" \
-H "X-Restli-Protocol-Version: 2.0.0" \
-H "Content-Type: application/json"
```

The author field for organization posts is always: `urn:li:organization:$LINKEDIN_ORG_ID`

## Verify Credentials

Check that the token is valid before posting:

```bash
RESPONSE=$(curl -s -w "\n%{http_code}" \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  -H "Linkedin-Version: 202601" \
  -H "X-Restli-Protocol-Version: 2.0.0" \
  "https://api.linkedin.com/rest/organizationsLookup?ids=List($LINKEDIN_ORG_ID)&fields=localizedName")

HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')

if [ "$HTTP_CODE" -eq 200 ]; then
  echo "Token valid. Organization: $(echo "$BODY" | grep -o '"localizedName":"[^"]*"' | head -1)"
else
  echo "Token invalid or expired (HTTP $HTTP_CODE). Re-run OAuth flow to get a new token."
  echo "Error: $BODY"
fi
```

## Text Post

Create a simple text-only post on the company page:

```bash
POST_TEXT="Your post content here. Supports multi-line text, emojis, and hashtags like #AI #YourBrand"

RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
  "https://api.linkedin.com/rest/posts" \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  -H "Linkedin-Version: 202601" \
  -H "X-Restli-Protocol-Version: 2.0.0" \
  -H "Content-Type: application/json" \
  -d "{
    \"author\": \"urn:li:organization:$LINKEDIN_ORG_ID\",
    \"commentary\": \"$POST_TEXT\",
    \"visibility\": \"PUBLIC\",
    \"distribution\": {
      \"feedDistribution\": \"MAIN_FEED\",
      \"targetEntities\": [],
      \"thirdPartyDistributionChannels\": []
    },
    \"lifecycleState\": \"PUBLISHED\",
    \"isReshareDisabledByAuthor\": false
  }")

HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')

if [ "$HTTP_CODE" -eq 201 ]; then
  POST_ID=$(echo "$BODY" | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4)
  echo "Post published successfully. ID: $POST_ID"
else
  echo "Failed to create post (HTTP $HTTP_CODE): $BODY"
fi
```

## Article Share (URL with Link Preview)

Share a URL with commentary — LinkedIn auto-generates a link preview card:

```bash
ARTICLE_URL="https://your-domain.com/blog/your-article"
ARTICLE_TITLE="Your Article Title"
ARTICLE_DESCRIPTION="Brief description of the article"
COMMENTARY="Check out our latest blog post on AI agents for business automation. #AI #Productivity"

RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
  "https://api.linkedin.com/rest/posts" \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  -H "Linkedin-Version: 202601" \
  -H "X-Restli-Protocol-Version: 2.0.0" \
  -H "Content-Type: application/json" \
  -d "{
    \"author\": \"urn:li:organization:$LINKEDIN_ORG_ID\",
    \"co
Leer la fuente completa en GitHub (abre una página externa)
Contexto

Trabajo relacionado