Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(linkedin): ui improvement (#16081)

Talal Jaber260b52093812
diff --git a/bun.lock b/bun.lock
index 2c2413b6fbe..758a0c0ff5c 100644
--- a/bun.lock
+++ b/bun.lock
@@ -5206,7 +5206,7 @@
},
"packages/pieces/community/linkedin": {
"name": "@activepieces/piece-linkedin",
- "version": "0.4.0",
+ "version": "0.5.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -5218,6 +5218,7 @@
"devDependencies": {
"@types/jsonwebtoken": "9.0.10",
"tslib": "2.6.2",
+ "vitest": "3.2.6",
},
},
"packages/pieces/community/linkup": {
diff --git a/packages/pieces/community/linkedin/package.json b/packages/pieces/community/linkedin/package.json
index 53c8b962555..03f8f05c295 100644
--- a/packages/pieces/community/linkedin/package.json
+++ b/packages/pieces/community/linkedin/package.json
@@ -1,12 +1,13 @@
{
"name": "@activepieces/piece-linkedin",
- "version": "0.4.0",
+ "version": "0.5.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
"bundle": "node ../../../../dist/packages/cli/src/index.js pieces bundle",
- "lint": "eslint 'src/**/*.ts'"
+ "lint": "eslint 'src/**/*.ts'",
+ "test": "vitest run"
},
"dependencies": {
"@activepieces/pieces-common": "workspace:*",
@@ -18,6 +19,7 @@
},
"devDependencies": {
"@types/jsonwebtoken": "9.0.10",
- "tslib": "2.6.2"
+ "tslib": "2.6.2",
+ "vitest": "3.2.6"
}
}
diff --git a/packages/pieces/community/linkedin/src/i18n/de.json b/packages/pieces/community/linkedin/src/i18n/de.json
index a9e297b7dd7..87d88d308b1 100644
--- a/packages/pieces/community/linkedin/src/i18n/de.json
+++ b/packages/pieces/community/linkedin/src/i18n/de.json
@@ -33,5 +33,18 @@
"None": "Keine",
"JSON": "JSON",
"Form Data": "Formulardaten",
- "Raw": "Rohe"
+ "Raw": "Rohe",
+ "Post to LinkedIn profiles and Company Pages": "Auf LinkedIn-Profilen und Unternehmensseiten posten",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "Melde dich mit dem LinkedIn-Konto an, das die Beiträge veröffentlichen soll. Um auf einer Unternehmensseite zu posten, muss dieses Konto einer ihrer Admins sein.",
+ "Post on your personal LinkedIn profile": "Auf deinem persönlichen LinkedIn-Profil posten",
+ "Post on a LinkedIn Company Page you manage": "Auf einer von dir verwalteten LinkedIn-Unternehmensseite posten",
+ "Link URL": "Link-URL",
+ "Link Title": "Link-Titel",
+ "Link Description": "Link-Beschreibung",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "Bis zu 3.000 Zeichen reiner Text; ein @ markiert niemanden.",
+ "Who can see the post.": "Wer den Beitrag sehen kann.",
+ "With a Link URL, the image becomes the link's thumbnail.": "Mit einer Link-URL wird das Bild zum Vorschaubild des Links.",
+ "Title and description show only when a Link URL is set.": "Titel und Beschreibung erscheinen nur, wenn eine Link-URL angegeben ist.",
+ "Only pages where your account can post are listed.": "Nur Seiten, auf denen dein Konto posten darf, werden angezeigt.",
+ "Posts to a Company Page are always public.": "Beiträge auf einer Unternehmensseite sind immer öffentlich."
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/es.json b/packages/pieces/community/linkedin/src/i18n/es.json
index 13320d96267..e2ed6213e33 100644
--- a/packages/pieces/community/linkedin/src/i18n/es.json
+++ b/packages/pieces/community/linkedin/src/i18n/es.json
@@ -33,5 +33,18 @@
"None": "Ninguna",
"JSON": "JSON",
"Form Data": "Datos de Formulario",
- "Raw": "Rápido"
+ "Raw": "Rápido",
+ "Post to LinkedIn profiles and Company Pages": "Publica en perfiles de LinkedIn y páginas de empresa",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "Inicia sesión con la cuenta de LinkedIn que publicará las publicaciones. Para publicar en una página de empresa, esa cuenta debe ser uno de sus administradores.",
+ "Post on your personal LinkedIn profile": "Publica en tu perfil personal de LinkedIn",
+ "Post on a LinkedIn Company Page you manage": "Publica en una página de empresa de LinkedIn que administras",
+ "Link URL": "URL del enlace",
+ "Link Title": "Título del enlace",
+ "Link Description": "Descripción del enlace",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "Hasta 3000 caracteres de texto sin formato; una @ no etiqueta a nadie.",
+ "Who can see the post.": "Quién puede ver la publicación.",
+ "With a Link URL, the image becomes the link's thumbnail.": "Con una URL de enlace, la imagen pasa a ser la miniatura del enlace.",
+ "Title and description show only when a Link URL is set.": "El título y la descripción solo se muestran si hay una URL de enlace.",
+ "Only pages where your account can post are listed.": "Solo se muestran las páginas en las que tu cuenta puede publicar.",
+ "Posts to a Company Page are always public.": "Las publicaciones en una página de empresa siempre son públicas."
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/fr.json b/packages/pieces/community/linkedin/src/i18n/fr.json
index 5f7fab452de..dab9f6b1e30 100644
--- a/packages/pieces/community/linkedin/src/i18n/fr.json
+++ b/packages/pieces/community/linkedin/src/i18n/fr.json
@@ -33,5 +33,18 @@
"None": "Aucun",
"JSON": "JSON",
"Form Data": "Données du formulaire",
- "Raw": "Brut"
+ "Raw": "Brut",
+ "Post to LinkedIn profiles and Company Pages": "Publiez sur des profils LinkedIn et des pages entreprise",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "Connectez-vous avec le compte LinkedIn qui doit publier les posts. Pour publier sur une page entreprise, ce compte doit en être l’un des administrateurs.",
+ "Post on your personal LinkedIn profile": "Publier sur votre profil LinkedIn personnel",
+ "Post on a LinkedIn Company Page you manage": "Publier sur une page entreprise LinkedIn que vous gérez",
+ "Link URL": "URL du lien",
+ "Link Title": "Titre du lien",
+ "Link Description": "Description du lien",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "Jusqu’à 3 000 caractères de texte brut ; un @ ne mentionne personne.",
+ "Who can see the post.": "Qui peut voir le post.",
+ "With a Link URL, the image becomes the link's thumbnail.": "Avec une URL de lien, l’image devient la miniature du lien.",
+ "Title and description show only when a Link URL is set.": "Le titre et la description ne s’affichent que si une URL de lien est renseignée.",
+ "Only pages where your account can post are listed.": "Seules les pages sur lesquelles votre compte peut publier sont listées.",
+ "Posts to a Company Page are always public.": "Les posts sur une page entreprise sont toujours publics."
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/ja.json b/packages/pieces/community/linkedin/src/i18n/ja.json
index ee534a90725..d70199fdcbb 100644
--- a/packages/pieces/community/linkedin/src/i18n/ja.json
+++ b/packages/pieces/community/linkedin/src/i18n/ja.json
@@ -33,5 +33,18 @@
"None": "なし",
"JSON": "JSON",
"Form Data": "フォームデータ",
- "Raw": "Raw"
+ "Raw": "Raw",
+ "Post to LinkedIn profiles and Company Pages": "LinkedIn のプロフィールと企業ページに投稿します",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "投稿を公開する LinkedIn アカウントでサインインしてください。企業ページに投稿するには、そのアカウントがページの管理者である必要があります。",
+ "Post on your personal LinkedIn profile": "自分の LinkedIn プロフィールに投稿します",
+ "Post on a LinkedIn Company Page you manage": "管理している LinkedIn 企業ページに投稿します",
+ "Link URL": "リンク URL",
+ "Link Title": "リンクのタイトル",
+ "Link Description": "リンクの説明",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "最大 3,000 文字のプレーンテキスト。@ を付けても誰もタグ付けされません。",
+ "Who can see the post.": "投稿を閲覧できるユーザー。",
+ "With a Link URL, the image becomes the link's thumbnail.": "リンク URL を指定すると、画像はリンクのサムネイルになります。",
+ "Title and description show only when a Link URL is set.": "タイトルと説明は、リンク URL を指定した場合にのみ表示されます。",
+ "Only pages where your account can post are listed.": "アカウントが投稿できるページのみが表示されます。",
+ "Posts to a Company Page are always public.": "企業ページへの投稿は常に公開されます。"
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/nl.json b/packages/pieces/community/linkedin/src/i18n/nl.json
index 1439ee4a7fa..3897691d48c 100644
--- a/packages/pieces/community/linkedin/src/i18n/nl.json
+++ b/packages/pieces/community/linkedin/src/i18n/nl.json
@@ -33,5 +33,18 @@
"None": "geen",
"JSON": "JSON",
"Form Data": "Formulieren gegevens",
- "Raw": "Onbewerkte"
+ "Raw": "Onbewerkte",
+ "Post to LinkedIn profiles and Company Pages": "Plaats berichten op LinkedIn-profielen en bedrijfspagina’s",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "Meld je aan met het LinkedIn-account dat de berichten moet publiceren. Om op een bedrijfspagina te posten, moet dat account een van de beheerders zijn.",
+ "Post on your personal LinkedIn profile": "Plaats een bericht op je persoonlijke LinkedIn-profiel",
+ "Post on a LinkedIn Company Page you manage": "Plaats een bericht op een LinkedIn-bedrijfspagina die je beheert",
+ "Link URL": "Link-URL",
+ "Link Title": "Linktitel",
+ "Link Description": "Linkbeschrijving",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "Maximaal 3000 tekens platte tekst; een @ tagt niemand.",
+ "Who can see the post.": "Wie het bericht kan zien.",
+ "With a Link URL, the image becomes the link's thumbnail.": "Met een link-URL wordt de afbeelding de miniatuur van de link.",
+ "Title and description show only when a Link URL is set.": "Titel en beschrijving worden alleen getoond als er een link-URL is ingevuld.",
+ "Only pages where your account can post are listed.": "Alleen pagina’s waarop je account mag posten worden getoond.",
+ "Posts to a Company Page are always public.": "Berichten op een bedrijfspagina zijn altijd openbaar."
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/pt.json b/packages/pieces/community/linkedin/src/i18n/pt.json
index bdc2a0a7192..7f7ac5abe76 100644
--- a/packages/pieces/community/linkedin/src/i18n/pt.json
+++ b/packages/pieces/community/linkedin/src/i18n/pt.json
@@ -33,5 +33,18 @@
"None": "Nenhuma",
"JSON": "JSON",
"Form Data": "Dados de Formulário",
- "Raw": "RAW"
+ "Raw": "RAW",
+ "Post to LinkedIn profiles and Company Pages": "Publique em perfis do LinkedIn e páginas de empresa",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "Entre com a conta do LinkedIn que deve publicar as postagens. Para publicar em uma página de empresa, essa conta precisa ser uma das administradoras dela.",
+ "Post on your personal LinkedIn profile": "Publique no seu perfil pessoal do LinkedIn",
+ "Post on a LinkedIn Company Page you manage": "Publique em uma página de empresa do LinkedIn que você gerencia",
+ "Link URL": "URL do link",
+ "Link Title": "Título do link",
+ "Link Description": "Descrição do link",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "Até 3.000 caracteres de texto simples; um @ não marca ninguém.",
+ "Who can see the post.": "Quem pode ver a postagem.",
+ "With a Link URL, the image becomes the link's thumbnail.": "Com uma URL de link, a imagem vira a miniatura do link.",
+ "Title and description show only when a Link URL is set.": "O título e a descrição só aparecem quando há uma URL de link.",
+ "Only pages where your account can post are listed.": "Só aparecem as páginas em que sua conta pode publicar.",
+ "Posts to a Company Page are always public.": "Postagens em uma página de empresa são sempre públicas."
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/ru.json b/packages/pieces/community/linkedin/src/i18n/ru.json
index 12b7881bad9..e1e5923677f 100644
--- a/packages/pieces/community/linkedin/src/i18n/ru.json
+++ b/packages/pieces/community/linkedin/src/i18n/ru.json
@@ -26,5 +26,18 @@
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
- "HEAD": "HEAD"
+ "HEAD": "HEAD",
+ "Post to LinkedIn profiles and Company Pages": "Публикуйте в профилях LinkedIn и на страницах компаний",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "Войдите в аккаунт LinkedIn, от имени которого будут публиковаться записи. Чтобы публиковать на странице компании, этот аккаунт должен быть одним из её администраторов.",
+ "Post on your personal LinkedIn profile": "Опубликовать в своём личном профиле LinkedIn",
+ "Post on a LinkedIn Company Page you manage": "Опубликовать на странице компании LinkedIn, которой вы управляете",
+ "Link URL": "URL ссылки",
+ "Link Title": "Заголовок ссылки",
+ "Link Description": "Описание ссылки",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "До 3000 символов обычного текста; @ никого не отмечает.",
+ "Who can see the post.": "Кто может видеть запись.",
+ "With a Link URL, the image becomes the link's thumbnail.": "Если указан URL ссылки, изображение становится её миниатюрой.",
+ "Title and description show only when a Link URL is set.": "Заголовок и описание показываются, только если указан URL ссылки.",
+ "Only pages where your account can post are listed.": "Показаны только страницы, на которых ваш аккаунт может публиковать.",
+ "Posts to a Company Page are always public.": "Записи на странице компании всегда публичные."
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/translation.json b/packages/pieces/community/linkedin/src/i18n/translation.json
index 89e6e9674b5..8cd703fdb54 100644
--- a/packages/pieces/community/linkedin/src/i18n/translation.json
+++ b/packages/pieces/community/linkedin/src/i18n/translation.json
@@ -1,37 +1,85 @@
{
- "Connect and network with professionals": "Connect and network with professionals",
+ "Post to LinkedIn profiles and Company Pages": "Post to LinkedIn profiles and Company Pages",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.",
"Create Share Update": "Create Share Update",
"Create Company Update": "Create Company Update",
+ "Get Current Member Profile": "Get Current Member Profile",
+ "List Managed Organizations": "List Managed Organizations",
+ "Create Member Post": "Create Member Post",
+ "Update Post Commentary": "Update Post Commentary",
+ "Delete Post": "Delete Post",
+ "Create Image Upload URL": "Create Image Upload URL",
"Custom API Call": "Custom API Call",
- "Create a share update on LinkedIn": "Create a share update on LinkedIn",
- "Create a new company update for Company Page": "Create a new company update for Company Page",
+ "Post on your personal LinkedIn profile": "Post on your personal LinkedIn profile",
+ "Post on a LinkedIn Company Page you manage": "Post on a LinkedIn Company Page you manage",
+ "Get the profile of the LinkedIn member who owns the connection": "Get the profile of the LinkedIn member who owns the connection",
+ "List the LinkedIn organization pages the connected member administers": "List the LinkedIn organization pages the connected member administers",
+ "Publish a post on the connected LinkedIn member's personal profile": "Publish a post on the connected LinkedIn member's personal profile",
+ "Edit the commentary, call-to-action label or landing page of an existing LinkedIn post": "Edit the commentary, call-to-action label or landing page of an existing LinkedIn post",
+ "Permanently delete a LinkedIn post by its URN": "Permanently delete a LinkedIn post by its URN",
+ "Reserve a LinkedIn image URN and a URL to upload the bytes to": "Reserve a LinkedIn image URN and a URL to upload the bytes to",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Text": "Text",
"Visibility": "Visibility",
"Image": "Image",
- "Content - URL": "Content - URL",
- "Content - Title": "Content - Title",
- "Content - Description": "Content - Description",
+ "Markdown": "Markdown",
+ "Link URL": "Link URL",
+ "Link Title": "Link Title",
+ "Link Description": "Link Description",
"Company Page": "Company Page",
+ "Image URN": "Image URN",
+ "Post URN": "Post URN",
+ "Commentary": "Commentary",
+ "Call To Action Label": "Call To Action Label",
+ "Landing Page URL": "Landing Page URL",
+ "Owner URN": "Owner URN",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body Type": "Body Type",
"Body": "Body",
- "Response is Binary ?": "Response is Binary ?",
- "No Error on Failure": "No Error on Failure",
- "Timeout (in seconds)": "Timeout (in seconds)",
+ "Response is Binary": "Response is Binary",
+ "Return Error as Output": "Return Error as Output",
+ "Timeout": "Timeout",
"Follow redirects": "Follow redirects",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "Up to 3,000 characters of plain text; an @ does not tag anyone.",
+ "Who can see the post.": "Who can see the post.",
+ "With a Link URL, the image becomes the link's thumbnail.": "With a Link URL, the image becomes the link's thumbnail.",
+ "Title and description show only when a Link URL is set.": "Title and description show only when a Link URL is set.",
+ "Only pages where your account can post are listed.": "Only pages where your account can post are listed.",
+ "Posts to a Company Page are always public.": "Posts to a Company Page are always public.",
+ "Body of the post.": "Body of the post.",
+ "Optional URL to attach as an article preview.": "Optional URL to attach as an article preview.",
+ "URN of an image already uploaded to LinkedIn, for example urn:li:image:D4E10AQ.... Obtain it from Create Image Upload URL and PUT the bytes to that upload URL before posting.": "URN of an image already uploaded to LinkedIn, for example urn:li:image:D4E10AQ.... Obtain it from Create Image Upload URL and PUT the bytes to that upload URL before posting.",
+ "URN of the post to edit, for example urn:li:share:7212345678901234567.": "URN of the post to edit, for example urn:li:share:7212345678901234567.",
+ "New body text. Leave empty to keep the current text.": "New body text. Leave empty to keep the current text.",
+ "New call-to-action button label. Leave empty to keep the current one.": "New call-to-action button label. Leave empty to keep the current one.",
+ "New destination for the call-to-action button. Leave empty to keep the current one.": "New destination for the call-to-action button. Leave empty to keep the current one.",
+ "URN of the post to delete, for example urn:li:share:7212345678901234567.": "URN of the post to delete, for example urn:li:share:7212345678901234567.",
+ "Who will own the image. Defaults to the connected member.": "Who will own the image. Defaults to the connected member.",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
+ "Appended to the URL as ?key=value.": "Appended to the URL as ?key=value.",
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
+ "On a failed request, output the error instead of failing the step.": "On a failed request, output the error instead of failing the step.",
+ "Seconds to wait for a response. Empty: up to the flow limit (10 min).": "Seconds to wait for a response. Empty: up to the flow limit (10 min).",
+ "Follow 3xx redirects instead of returning them as the response.": "Follow 3xx redirects instead of returning them as the response.",
+ "Public": "Public",
+ "Connections Only": "Connections Only",
+ "Apply": "Apply",
+ "Download": "Download",
+ "View Quote": "View Quote",
+ "Learn More": "Learn More",
+ "Sign Up": "Sign Up",
+ "Subscribe": "Subscribe",
+ "Register": "Register",
+ "Join": "Join",
+ "Attend": "Attend",
+ "Request Demo": "Request Demo",
+ "See More": "See More",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
- "HEAD": "HEAD",
- "None": "None",
- "JSON": "JSON",
- "Form Data": "Form Data",
- "Raw": "Raw"
+ "HEAD": "HEAD"
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/i18n/zh.json b/packages/pieces/community/linkedin/src/i18n/zh.json
index ba7da1580f1..03701400550 100644
--- a/packages/pieces/community/linkedin/src/i18n/zh.json
+++ b/packages/pieces/community/linkedin/src/i18n/zh.json
@@ -33,5 +33,18 @@
"None": "无",
"JSON": "JSON",
"Form Data": "表单数据",
- "Raw": "原始文件"
+ "Raw": "原始文件",
+ "Post to LinkedIn profiles and Company Pages": "在 LinkedIn 个人资料和公司主页上发帖",
+ "Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.": "请使用要发布帖子的 LinkedIn 账号登录。要在公司主页上发帖,该账号必须是该主页的管理员之一。",
+ "Post on your personal LinkedIn profile": "在你的 LinkedIn 个人资料上发帖",
+ "Post on a LinkedIn Company Page you manage": "在你管理的 LinkedIn 公司主页上发帖",
+ "Link URL": "链接网址",
+ "Link Title": "链接标题",
+ "Link Description": "链接描述",
+ "Up to 3,000 characters of plain text; an @ does not tag anyone.": "最多 3,000 个字符的纯文本;@ 不会标记任何人。",
+ "Who can see the post.": "谁可以看到这条帖子。",
+ "With a Link URL, the image becomes the link's thumbnail.": "填写链接网址后,图片会成为链接的缩略图。",
+ "Title and description show only when a Link URL is set.": "只有填写了链接网址时,才会显示标题和描述。",
+ "Only pages where your account can post are listed.": "仅列出你的账号可以发帖的主页。",
+ "Posts to a Company Page are always public.": "发布到公司主页的帖子始终是公开的。"
}
\ No newline at end of file
diff --git a/packages/pieces/community/linkedin/src/index.ts b/packages/pieces/community/linkedin/src/index.ts
index 6ed72a5088d..73ae960d60e 100644
--- a/packages/pieces/community/linkedin/src/index.ts
+++ b/packages/pieces/community/linkedin/src/index.ts
@@ -17,6 +17,8 @@ import { deletePost } from './lib/actions/delete-post';
import { createImageUploadUrl } from './lib/actions/create-image-upload-url';
export const linkedinAuth = PieceAuth.OAuth2({
+ description:
+ 'Sign in with the LinkedIn account that should publish the posts. To post on a Company Page, that account must be one of its admins.',
authUrl: 'https://www.linkedin.com/oauth/v2/authorization',
tokenUrl: 'https://www.linkedin.com/oauth/v2/accessToken',
required: true,
@@ -32,7 +34,7 @@ export const linkedinAuth = PieceAuth.OAuth2({
export const linkedin = createPiece({
displayName: 'LinkedIn',
- description: 'Connect and network with professionals',
+ description: 'Post to LinkedIn profiles and Company Pages',
minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/linkedin.png',
diff --git a/packages/pieces/community/linkedin/src/lib/actions/create-company-update.ts b/packages/pieces/community/linkedin/src/lib/actions/create-company-update.ts
index 3ffbfc6fb20..6a24331895a 100644
--- a/packages/pieces/community/linkedin/src/lib/actions/create-company-update.ts
+++ b/packages/pieces/community/linkedin/src/lib/actions/create-company-update.ts
@@ -1,5 +1,9 @@
-import { createAction } from '@activepieces/pieces-framework';
-import { linkedinCommon, publishOrganizationPost } from '../common';
+import { createAction, tryCatch } from '@activepieces/pieces-framework';
+import {
+ buildLinkedinError,
+ linkedinCommon,
+ publishOrganizationPost,
+} from '../common';
import { linkedinAuth } from '../..';
import { createCompanyUpdateActionOutputSchema } from '../output-schemas';
@@ -8,17 +12,42 @@ export const createCompanyUpdate = createAction({
name: 'create_company_update',
classification: 'WRITE',
displayName: 'Create Company Update',
- description: 'Create a new company update for Company Page',
+ description: 'Post on a LinkedIn Company Page you manage',
audience: 'human',
aiMetadata: {
description:
'Publishes a new post to a LinkedIn organization (company) page, with optional image and link preview; posts are always public. Use this to share content on behalf of a company rather than a personal profile, and requires the target organization id plus admin access to that page. Not idempotent: each call creates a separate post, so repeating it with the same text produces a duplicate.',
idempotent: false,
},
+ propertyGroups: [
+ {
+ key: 'post_as',
+ display: 'section',
+ label: 'Post As',
+ icon: 'users',
+ props: ['company', 'company_visibility_info'],
+ },
+ {
+ key: 'post',
+ display: 'section',
+ label: 'Post',
+ icon: 'text',
+ props: ['text', 'imageUrl'],
+ },
+ {
+ key: 'link_preview',
+ display: 'section',
+ label: 'Link Preview',
+ icon: 'paperclip',
+ props: ['link_preview_info', 'link', 'linkTitle', 'linkDescription'],
+ },
+ ],
props: {
company: linkedinCommon.company,
- imageUrl: linkedinCommon.imageUrl,
+ company_visibility_info: linkedinCommon.companyVisibilityInfo,
text: linkedinCommon.text,
+ imageUrl: linkedinCommon.postImage,
+ link_preview_info: linkedinCommon.linkPreviewInfo,
link: linkedinCommon.link,
linkTitle: linkedinCommon.linkTitle,
linkDescription: linkedinCommon.linkDescription,
@@ -29,14 +58,20 @@ export const createCompanyUpdate = createAction({
const { company, text, link, linkTitle, linkDescription, imageUrl } =
context.propsValue;
- return await publishOrganizationPost({
- accessToken: context.auth.access_token,
- organizationId: String(company),
- text,
- imageFile: imageUrl,
- link,
- linkTitle,
- linkDescription,
- });
+ const { data, error } = await tryCatch(() =>
+ publishOrganizationPost({
+ accessToken: context.auth.access_token,
+ organizationId: String(company),
+ text,
+ imageFile: imageUrl,
+ link,
+ linkTitle,
+ linkDescription,
+ })
+ );
+ if (error) {
+ throw buildLinkedinError({ error, resource: 'the Company Page' });
+ }
+ return data;
},
});
diff --git a/packages/pieces/community/linkedin/src/lib/actions/create-share-update.ts b/packages/pieces/community/linkedin/src/lib/actions/create-share-update.ts
index a95e81140e6..d30644a38c3 100644
--- a/packages/pieces/community/linkedin/src/lib/actions/create-share-update.ts
+++ b/packages/pieces/community/linkedin/src/lib/actions/create-share-update.ts
@@ -8,17 +8,34 @@ export const createShareUpdate = createAction({
name: 'create_share_update',
classification: 'WRITE',
displayName: 'Create Share Update',
- description: 'Create a share update on LinkedIn',
+ description: 'Post on your personal LinkedIn profile',
audience: 'human',
aiMetadata: {
description:
"Publishes a new post to the authenticated user's personal LinkedIn profile, with optional image, link preview, and visibility setting. Use this to share content as an individual member (not a company page — use Create Company Update for that). Not idempotent: each call creates a separate post, so calling it again with the same text produces a duplicate.",
idempotent: false,
},
+ propertyGroups: [
+ {
+ key: 'post',
+ display: 'section',
+ label: 'Post',
+ icon: 'text',
+ props: ['text', 'visibility', 'imageUrl'],
+ },
+ {
+ key: 'link_preview',
+ display: 'section',
+ label: 'Link Preview',
+ icon: 'paperclip',
+ props: ['link_preview_info', 'link', 'linkTitle', 'linkDescription'],
+ },
+ ],
props: {
text: linkedinCommon.text,
visibility: linkedinCommon.visibility,
- imageUrl: linkedinCommon.imageUrl,
+ imageUrl: linkedinCommon.postImage,
+ link_preview_info: linkedinCommon.linkPreviewInfo,
link: linkedinCommon.link,
linkTitle: linkedinCommon.linkTitle,
linkDescription: linkedinCommon.linkDescription,
diff --git a/packages/pieces/community/linkedin/src/lib/common/get-companies.test.ts b/packages/pieces/community/linkedin/src/lib/common/get-companies.test.ts
new file mode 100644
index 00000000000..f9672e4665a
--- /dev/null
+++ b/packages/pieces/community/linkedin/src/lib/common/get-companies.test.ts
@@ -0,0 +1,103 @@
+import { httpClient } from '@activepieces/pieces-common';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { linkedinCommon } from '.';
+
+vi.mock('../..', () => ({ linkedinAuth: undefined }));
+
+describe('linkedinCommon.getCompanies', () => {
+ afterEach(() => {
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+ });
+
+ it('pages through approved roles, keeps posting roles, dedupes and looks names up in chunks of 50', async () => {
+ const firstPage = Array.from({ length: 100 }, (_, index) =>
+ aclElement({ organizationId: index + 1, role: 'ADMINISTRATOR' })
+ );
+ const secondPage = [
+ aclElement({ organizationId: 1, role: 'CONTENT_ADMINISTRATOR' }),
+ aclElement({ organizationId: 101, role: 'ANALYST' }),
+ aclElement({ organizationId: 102, role: 'DIRECT_SPONSORED_CONTENT_POSTER' }),
+ ];
+ const sendRequest = vi
+ .spyOn(httpClient, 'sendRequest')
+ .mockResolvedValueOnce(aclResponse(firstPage))
+ .mockResolvedValueOnce(aclResponse(secondPage));
+ const fetchMock = vi.fn(lookupResponse);
+ vi.stubGlobal('fetch', fetchMock);
+
+ const companies = await linkedinCommon.getCompanies('token');
+
+ expect(sendRequest).toHaveBeenCalledTimes(2);
+ expect(sendRequest.mock.calls.map(([request]) => request.queryParams)).toEqual([
+ { q: 'roleAssignee', state: 'APPROVED', start: '0', count: '100' },
+ { q: 'roleAssignee', state: 'APPROVED', start: '100', count: '100' },
+ ]);
+ expect(fetchMock).toHaveBeenCalledTimes(3);
+ expect(companies).toHaveLength(101);
+ expect(companies.map((company) => company.id)).not.toContain(101);
+ expect(companies).toContainEqual({ id: 102, localizedName: 'Page 102' });
+ });
+
+ it('returns no pages without a name lookup when the account has no posting role', async () => {
+ vi.spyOn(httpClient, 'sendRequest').mockResolvedValueOnce(
+ aclResponse([aclElement({ organizationId: 7, role: 'ANALYST' })])
+ );
+ const fetchMock = vi.fn(lookupResponse);
+ vi.stubGlobal('fetch', fetchMock);
+
+ const companies = await linkedinCommon.getCompanies('token');
+
+ expect(companies).toEqual([]);
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('rejects when LinkedIn fails to list the roles', async () => {
+ vi.spyOn(httpClient, 'sendRequest').mockRejectedValueOnce(
+ new Error('request failed')
+ );
+
+ await expect(linkedinCommon.getCompanies('token')).rejects.toThrow(
+ 'request failed'
+ );
+ });
+
+ it('rejects when the name lookup fails', async () => {
+ vi.spyOn(httpClient, 'sendRequest').mockResolvedValueOnce(
+ aclResponse([aclElement({ organizationId: 7, role: 'ADMINISTRATOR' })])
+ );
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async () => new Response('denied', { status: 403 }))
+ );
+
+ await expect(linkedinCommon.getCompanies('token')).rejects.toThrow();
+ });
+});
+
+function aclElement({
+ organizationId,
+ role,
+}: {
+ organizationId: number;
+ role: string;
+}) {
+ return {
+ organizationalTarget: `urn:li:organization:${organizationId}`,
+ role,
+ state: 'APPROVED',
+ };
+}
+
+function aclResponse(elements: ReturnType<typeof aclElement>[]) {
+ return { status: 200, headers: {}, body: { elements } };
+}
+
+async function lookupResponse(url: string | URL | Request): Promise<Response> {
+ const match = /ids=List\(([^)]*)\)/.exec(String(url));
+ const ids = match === null ? [] : match[1].split(',');
+ const results = Object.fromEntries(
+ ids.map((id) => [id, { id: Number(id), localizedName: `Page ${id}` }])
+ );
+ return new Response(JSON.stringify({ results }), { status: 200 });
+}
diff --git a/packages/pieces/community/linkedin/src/lib/common/index.ts b/packages/pieces/community/linkedin/src/lib/common/index.ts
index 3d281c39552..568965d013b 100644
--- a/packages/pieces/community/linkedin/src/lib/common/index.ts
+++ b/packages/pieces/community/linkedin/src/lib/common/index.ts
@@ -1,4 +1,11 @@
-import { ApFile, Property } from '@activepieces/pieces-framework';
+import {
+ ApFile,
+ MarkdownVariant,
+ Property,
+ chunk,
+ tryCatch,
+ unique,
+} from '@activepieces/pieces-framework';
import {
HttpMethod,
httpClient,
@@ -27,27 +34,49 @@ export const linkedinCommon = {
},
text: Property.LongText({
displayName: 'Text',
+ description:
+ 'Up to 3,000 characters of plain text; an @ does not tag anyone.',
required: true,
}),
imageUrl: Property.File({
displayName: 'Image',
required: false,
}),
+ postImage: Property.File({
+ displayName: 'Image',
+ description: "With a Link URL, the image becomes the link's thumbnail.",
+ placeholder: 'https://example.com/photo.jpg',
+ required: false,
+ }),
link: Property.ShortText({
- displayName: 'Content - URL',
+ displayName: 'Link URL',
+ placeholder: 'https://example.com/article',
required: false,
}),
linkTitle: Property.ShortText({
- displayName: 'Content - Title',
+ displayName: 'Link Title',
+ placeholder: 'Article headline',
required: false,
+ width: 'half',
}),
linkDescription: Property.ShortText({
- displayName: 'Content - Description',
+ displayName: 'Link Description',
+ placeholder: 'One-line summary',
required: false,
+ width: 'half',
+ }),
+ linkPreviewInfo: Property.MarkDown({
+ value: 'Title and description show only when a Link URL is set.',
+ variant: MarkdownVariant.INFO,
+ }),
+ companyVisibilityInfo: Property.MarkDown({
+ value: 'Posts to a Company Page are always public.',
+ variant: MarkdownVariant.INFO,
}),
visibility: Property.Dropdown({
auth: linkedinAuth,
displayName: 'Visibility',
+ description: 'Who can see the post.',
refreshers: [],
required: true,
options: async () => {
@@ -69,73 +98,94 @@ export const linkedinCommon = {
company: Property.Dropdown({
auth: linkedinAuth,
displayName: 'Company Page',
+ description: 'Only pages where your account can post are listed.',
required: true,
refreshers: [],
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
- placeholder: 'Connect your account',
options: [],
};
}
- const authProp = auth as { access_token: string };
-
- const companies: any = await linkedinCommon.getCompanies(
- authProp.access_token
+ const { data: companies, error } = await tryCatch(
+ (): Promise<LinkedinCompany[]> =>
+ linkedinCommon.getCompanies(auth.access_token)
);
- const options = [];
- for (const company in companies) {
- options.push({
- label: companies[company].localizedName,
- value: companies[company].id,
- });
+ if (error !== null) {
+ return {
+ disabled: true,
+ options: [],
+ };
}
-
return {
- options: options,
+ disabled: false,
+ options: companies.map((company) => ({
+ label: company.localizedName,
+ value: company.id,
+ })),
};
},
}),
- getCompanies: async (accessToken: string) => {
- const companies = (
- await httpClient.sendRequest({
- url: `${linkedinCommon.baseUrl}/v2/organizationalEntityAcls`,
- method: HttpMethod.GET,
- authentication: {
- type: AuthenticationType.BEARER_TOKEN,
- token: accessToken,
- },
- queryParams: {
- q: 'roleAssignee',
- },
- })
- ).body;
-
- const companyIds = companies.elements.map(
- (company: { organizationalTarget: string }) => {
- return company.organizationalTarget.substr(
- company.organizationalTarget.lastIndexOf(':') + 1
- );
+ getCompanies: async (accessToken: string): Promise<LinkedinCompany[]> => {
+ const pageSize = 100;
+ const maxPages = 10;
+ const organizationTargets: string[] = [];
+ for (let page = 0; page < maxPages; page++) {
+ const response =
+ await httpClient.sendRequest<OrganizationalEntityAclsResponse>({
+ url: `${linkedinCommon.baseUrl}/v2/organizationalEntityAcls`,
+ method: HttpMethod.GET,
+ authentication: {
+ type: AuthenticationType.BEARER_TOKEN,
+ token: accessToken,
+ },
+ queryParams: {
+ q: 'roleAssignee',
+ state: 'APPROVED',
+ start: String(page * pageSize),
+ count: String(pageSize),
+ },
+ });
+ const elements = response.body.elements ?? [];
+ organizationTargets.push(
+ ...elements
+ .filter((element) =>
+ ORGANIZATION_POSTING_ROLES.includes(element.role)
+ )
+ .map((element) => element.organizationalTarget)
+ );
+ if (elements.length < pageSize) {
+ break;
}
- );
+ }
- const response = await fetch(`${linkedinCommon.baseUrl}/rest/organizations?ids=List(${companyIds.join(',')})`, {
- method: 'GET',
- headers: {
- ...linkedinCommon.linkedinHeaders,
- 'Authorization': `Bearer ${accessToken}`
- }
- });
-
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
+ const organizationIds = unique(
+ organizationTargets.map((target) => organizationIdOf(target))
+ );
+ if (organizationIds.length === 0) {
+ return [];
}
-
- const companySearch = await response.json();
- return companySearch.results;
+ const lookups = await Promise.all(
+ chunk(organizationIds, 50).map((ids) =>
+ linkedinRawGet<OrganizationsLookupResponse>({
+ accessToken,
+ url: `${linkedinCommon.baseUrl}/rest/organizations?ids=List(${ids.join(
+ ','
+ )})`,
+ resource: 'your Company Pages',
+ })
+ )
+ );
+
+ return lookups.flatMap((lookup) =>
+ Object.values(lookup.results ?? {}).map((organization) => ({
+ id: organization.id,
+ localizedName: organization.localizedName,
+ }))
+ );
},
generatePostRequestBody: (data: {
@@ -225,6 +275,12 @@ export const linkedinCommon = {
},
};
+const ORGANIZATION_POSTING_ROLES = [
+ 'ADMINISTRATOR',
+ 'CONTENT_ADMINISTRATOR',
+ 'DIRECT_SPONSORED_CONTENT_POSTER',
+];
+
const readErrorStatus = (error: unknown): number | null => {
if (typeof error !== 'object' || error === null) {
return null;
@@ -518,4 +574,17 @@ export interface PostCreationResult {
post_urn: string | null;
}
+export interface LinkedinCompany {
+ id: number;
+ localizedName: string;
+}
+
+interface OrganizationalEntityAclsResponse {
+ elements?: { organizationalTarget: string; role: string }[];
+}
+
+interface OrganizationsLookupResponse {
+ results?: Record<string, LinkedinCompany>;
+}
+
export const MAX_ERROR_BODY_CHARS = 200;
diff --git a/packages/pieces/community/linkedin/vitest.config.ts b/packages/pieces/community/linkedin/vitest.config.ts
new file mode 100644
index 00000000000..d87fc4a6954
--- /dev/null
+++ b/packages/pieces/community/linkedin/vitest.config.ts
@@ -0,0 +1,8 @@
+import { defineConfig } from 'vitest/config'
+
+export default defineConfig({
+ test: {
+ globals: true,
+ environment: 'node',
+ },
+})