Templates / Share new WordPress posts on LinkedIn, X and Facebook via webhook

Share new WordPress posts on LinkedIn, X and Facebook via webhook

Ready for 3.0

by Mateusz Skorupa · 5 views · created 2026-09-18 · Social Media

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (8)

LinkedInX (Formerly Twitter)Facebook Graph API

What it does

Quick overview Every time a post goes live on your WordPress site, this workflow shares it on LinkedIn, X and a Facebook Page. WordPress calls the workflow once per post, so there is no schedule to tune and no table of already-posted IDs to keep. How it works 1. New Post Webhook receives {"postid": 123} from WordPress. Header Auth keeps the endpoint private. 2. Settings holds your site URL. 3. Get Post reads /wp-json/wp/v2/posts/123?embed=wp:featuredmedia on your site. Published posts are public, so no WordPress credentials are needed. 4. Post Fields is a short Code node that turns the REST response into title, summary, url and imageurl: it strips the HTML from the excerpt, decodes entities and takes the featured image if there is one. 5. Get Featured Image downloads the post's featured image and Has Featured Image checks that there was one. 6. Publish on LinkedIn shares the image with the title, the summary and the permalink in the text. A post without a featured image goes to Publish Link on LinkedIn instead, which shares it as a link card. Publish on X posts the title and the link, Publish on Facebook posts the title, the summary and the link to your Page, and both show the image from your page's Open Graph tags, which any SEO plugin adds. On a site without those tags the X and Facebook posts appear as plain text. Each publish node continues if another one fails, so a LinkedIn outage does not stop the X and Facebook posts. Setup 1. Open Settings and enter your site URL. 2. Open New Post Webhook, add a Header Auth credential (for example X-Webhook-Token) and copy the production URL. 3. Create an app in the X developer console, enable User authentication settings (Read and write, Web App) and connect the OAuth 2.0 Client ID and Secret as an X OAuth2 credential on Publish on X. X has had no free tier since February 2026: load credits under Billing first, or the node answers 402 Payment required. A post with a link costs $0.20, so a weekly article is about $10 a year. 4. Create a LinkedIn app with the wmembersocial scope (LinkedIn Posts API) and connect it on Publish on LinkedIn and Publish Link on LinkedIn. The app needs two products: Share on LinkedIn and Sign In with LinkedIn using OpenID Connect. In the n8n credential, turn off Legacy and Organization Support before you connect, or LinkedIn rejects the scopes they add. Then pick your profile under Person on both LinkedIn nodes. To post as a company page, switch both nodes to Organization, keep Organization Support on and get the Community Management API approved for your app. 5. Get a Page access token from your Meta app (access tokens), connect it on Publish on Facebook and replace YOURPAGEID with your Page ID. It must be the Page token, not your user token: with a user token the node fails with a plain "Forbidden". If me/accounts comes back empty for a Page owned by a business portfolio, read the token from the Page itself with GET /{page-id}?fields=accesstoken. 6. In WordPress, send {"postid": 123} to the webhook URL when a post is first published. The free Webhook Actions plugin does it without code: new webhook on publishpost, map args.1.ID to postid, attach the header credential, and add the condition args.2 not equals publish so editing a live post does not share it again. Or import the ready-made build with exactly this setup. A short PHP snippet that does the same is under Additional info. 7. Activate the workflow and publish a test post. Requirements - A public WordPress site (the REST API is read anonymously) - X OAuth2, LinkedIn OAuth2 and Facebook Graph API credentials in n8n - X API credits (pay-per-use, see step 3) Customization - Add a model node (OpenAI, Gemini) between Post Fields and the publish nodes to write a caption per network from title and summary. - Add Mastodon, Bluesky or Slack as another branch after Post Fields; the four fields are already there. - To always share a link card on LinkedIn instead of the image, connect Post Fields straight to Pu

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.