LinkedIn 凭据#
您可以使用这些凭据来验证以下节点:
先决条件#
- 创建一个 LinkedIn 账户。
- 创建一个 LinkedIn Company Page。
支持的认证方法#
- Community Management OAuth2:如果您是新的 LinkedIn 用户或正在创建新的 LinkedIn 应用程序,请使用此方法。
- OAuth2:对于较旧的 LinkedIn 应用程序和用户账户,请使用此方法。
相关资源#
参考 LinkedIn 的 Community Management API 文档了解有关该服务的更多信息。
此凭据适用于 API 版本 202404。
使用 Community Management OAuth2#
如果您是新的 LinkedIn 用户或正在创建新的 LinkedIn 应用程序,请使用此方法。
要配置此凭据,您需要一个 LinkedIn 账户、一个 LinkedIn Company Page 公司页面,以及:
- 一个Client ID 客户端 ID:在您创建新的开发者应用程序后生成。
- 一个Client Secret 客户端密钥:在您创建新的开发者应用程序后生成。
要创建新的开发者应用程序并设置凭据:
- Log into LinkedIn and select this link to create a new developer app.
- Enter an App name for your app, like
n8n integration. - For the LinkedIn Page, enter a LinkedIn Company Page or use the Create a new LinkedIn Page link to create one on-the-fly. Refer to Associate an App with a LinkedIn Page for more information.
- Add an App logo.
- Check the box to agree to the Legal agreement.
- Select Create app.
- This should open the Products tab. Select the products/APIs you want to enable for your app. For the LinkedIn node to work, you must include and configure:
- Share on LinkedIn
- Sign In with LinkedIn using OpenID Connect
- Advertising API (if using it as an organization account rather than an individual)
- Once you've requested access to the products you need, open the Auth tab.
- Copy the Client ID and enter it in your n8n credential.
- Select the icon to Copy the Primary Client Secret. Enter this in your n8n credential as the Client Secret.
从组织账户发布
要以组织身份发布,您需要让您的应用程序通过 LinkedIn 的 Community Management App Review 社区管理应用程序审查 流程。
参考获取 LinkedIn API 的访问权限了解有关作用域和权限的更多信息。
Using Lead Sync API#
LinkedIn's Lead Sync API allows you to sync lead form responses from LinkedIn ads and organic forms (company pages, events, products) to your n8n workflows using webhooks. This requires more setup and LinkedIn approval.
Prerequisites#
- A LinkedIn developer app (created using steps above)
- Your company LinkedIn account linked to your developer app
- Access to the Lead Sync API product (requires separate application)
- A publicly accessible HTTPS webhook URL (your n8n workflow webhook URL)
Setup process#
- Create a LinkedIn developer app following the steps in the Community Management OAuth2 or OAuth2 sections above.
- Link your company account: Submit a request to LinkedIn to link your company LinkedIn account to your developer app. This is done through the LinkedIn Developer Portal.
- Request Lead Sync API access: - In your LinkedIn developer app, navigate to the Products tab. - Request access to the Lead Sync API product.
- Configure permissions: Ensure your app has the
r_marketing_leadgen_automationpermission, which allows you to: - Access authenticated member's ad forms and organic forms - Access form responses (leads) - Manage lead notifications (webhooks) - Set up webhook in n8n: - Create a workflow with a Webhook trigger node in n8n. - Copy the webhook URL from n8n (must be HTTPS). - The webhook URL must be publicly accessible and accept POST requests without additional authorization requirements.
- Handle the challenge request:
- When you register your webhook with LinkedIn, LinkedIn will send a GET request with a
challengeCodequery parameter. - Your n8n workflow must respond within 3 seconds with a JSON payload containing:challengeCode: The code LinkedIn sentchallengeResponse: HMAC-SHA256 hash of the challenge code using your app's Client Secret as the key- Example response format:
1 2 3 4
{ "challengeCode": "890e4665-4dfe-4ab1-b689-ed553bceeed0", "challengeResponse": "27b1d19678542072a7f1d0ce845d0c78cec22567f413697e25648f44fa3d1514" }
- Create lead notification subscription:
- Use the
leadNotificationsAPI to create a webhook subscription. - You can create subscriptions at different levels:- Owner level: Receive notifications for all forms under an organization or sponsored account
- Form level: Receive notifications only for specific forms
- Associated entity level: Receive notifications for forms attached to specific entities (ads, events, etc.)
- Example API call:
1 2 3 4 5 6
POST https://api.linkedin.com/rest/leadNotifications { "webhook": "https://your-n8n-instance.com/webhook/linkedin-leads", "owner": {"organization": "urn:li:organization:123456"}, "leadType": "SPONSORED" }
- Fetch lead form responses:
- Once webhook notifications are set up, you'll receive notifications when new leads are submitted.
- Use the
leadFormResponsesAPI to fetch the actual lead data:1GET https://api.linkedin.com/rest/leadFormResponses?owner=(organization:urn%3Ali%3Aorganization%3A123456)&leadType=(leadType:SPONSORED)&q=owner
Lead types#
LinkedIn supports different types of leads that can be synced:
- SPONSORED: Leads collected from sponsored ads
- COMPANY: Leads collected from company pages
- EVENT: Leads collected from event pages
- ORGANIZATION_PRODUCT: Leads collected from organization product pages
Webhook validation#
LinkedIn periodically re-validates webhook endpoints every 2 hours. If validation fails 3 times in a row, the endpoint will be blocked and events will no longer be sent. Ensure your webhook:
- Responds to challenge requests within 3 seconds
- Returns a 2xx HTTP status code for all notifications
- Uses HTTPS (HTTP URLs aren't supported)
- Is publicly accessible without authentication requirements
Security#
To verify that notifications are from LinkedIn:
- Check the
X-LI-Signatureheader in the POST request - This header contains the HMAC-SHA256 hash of the JSON-encoded POST body, computed using your app's Client Secret
- Compute the same hash on your side and verify it matches
- Discard any events where the signatures don't match
Refer to LinkedIn's Lead Sync API documentation and Webhook Validation guide for more information.
Using OAuth2#
仅对较旧的 LinkedIn 应用程序和用户账户使用此方法。
n8n 云服务用户注意事项
云服务用户无需提供连接详细信息。选择连接我的账户通过浏览器进行连接。
所有用户必须选择:
- Organization Support 组织支持:如果开启,凭据请求使用
w_organization_social作用域以组织身份发布的权限。- 要使用此选项,您必须让您的应用程序通过 LinkedIn 的 Community Management App Review 流程。
- Legacy 传统模式:如果开启,凭据使用传统作用域
r_liteprofile和r_emailaddress,而不是较新的profile和email作用域。
如果您正在自托管 n8n,您需要通过创建新的开发者应用程序从头配置 OAuth2:
- 登录 LinkedIn 并选择此链接来创建新开发者应用程序。
- 为您的应用程序输入 App name,如
n8n integration。 - 对于 LinkedIn Page,输入 LinkedIn Company Page 或使用 Create a new LinkedIn Page 链接来即时创建一个。参考将应用程序与 LinkedIn 页面关联了解更多信息。
- 添加 App logo。
- 勾选复选框同意 Legal agreement。
- 选择 Create app。
- 这应该会打开 Products 选项卡。选择您想为应用程序启用的产品/API。要使 LinkedIn 节点正常工作,您必须包括:
- Share on LinkedIn
- Sign In with LinkedIn using OpenID Connect
- 一旦您请求访问所需的产品,打开 Auth 选项卡。
- 复制 Client ID 并将其输入到您的 n8n 凭据中。
- 选择图标来 Copy Primary Client Secret。将其作为 Client Secret 输入到您的 n8n 凭据中。
从组织账户发布
要以组织身份发布,您需要让您的应用程序通过 LinkedIn 的 Community Management App Review 流程。
参考获取 LinkedIn API 的访问权限了解有关作用域和权限的更多信息。