π± Schedule X posts, threads, images and polls with webhooks
β‘ 0 views Β· π± Social Media & Email Marketing
π‘ Pro Tip β Twitterβs API is paid now, which makes simple data pulls expensive. ScraperNode is a community node that scrapes Twitter profiles and posts without needing API access.
Description
Quick overview
This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credential connection test, returning a consistent JSON success/error response to the caller.
How it works
- Receives a POST webhook request containing a request type and payload from the scheduling calendar.
- Routes the request by
body.typeto create a single X post, publish an X thread, delete an X post, run an X credential test, or return an unknown-type error. - For single posts, validates the payload (including blocking invalid polls or mixed poll-plus-media), then posts either a text-only tweet, a poll tweet, or a tweet with uploaded media.
- For media posts, uploads base64-encoded images/videos to X using INIT/APPEND/FINALIZE, polls X until processing completes when required, and then publishes the tweet with the returned
media_ids. - For threads, posts the first tweet, then posts each subsequent tweet as a reply to the previous tweet ID to keep the chain intact, and returns the list of tweet IDs and URLs.
- For delete requests and connection tests, calls Xβs delete-tweet endpoint or
GET /2/users/meand returns a structured success or error payload. - Responds to the webhook with a standardized JSON result including
success, IDs/URLs when available, or an error code and message.
Setup
- Create an X Developer app with OAuth 2.0 user-context access and required permissions for posting and media uploads.
- In n8n, add an OAuth2 API credential for X with scopes
tweet.read tweet.write users.read offline.access media.writeand select it on all X HTTP Request steps. - Activate the workflow, copy the Webhook Trigger Production URL, and configure your content calendar (for example, the included
index.html) to send POST requests to that URL with the expectedbody.typevalues.
Requirements
- x.com api app oauth2 credentials (pay as you go)
Additional info
This workflow is tested and works with the include index.html calendar frontend ui.
π Nodes Used
HTTP Request, Webhook
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File