This workflow corresponds to n8n.io template #4415 — we link there as the canonical source.
This workflow follows the Form → Form Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "02b20189-94ce-4608-9c8d-a29a9d97db32",
"name": "On form submission",
"type": "n8n-nodes-base.formTrigger",
"position": [
-340,
-140
],
"parameters": {
"options": {
"buttonLabel": "Submit",
"appendAttribution": false
},
"formTitle": "Post to X",
"formFields": {
"values": [
{
"fieldType": "textarea",
"fieldLabel": "Post Content",
"requiredField": true
},
{
"fieldType": "file",
"fieldLabel": "Media",
"multipleFiles": false,
"acceptFileTypes": ".jpg, .png, .mp4, .mov, .jpeg, .gif, .heif, .webp, .tiff "
}
]
}
},
"typeVersion": 2.2
},
{
"id": "750c5cb0-16fd-463f-ad6f-8558fbf51360",
"name": "Extract Media Details",
"type": "n8n-nodes-base.code",
"position": [
-120,
-140
],
"parameters": {
"jsCode": "const post_content = $input.first().json[\"Post Content\"];\nconst file = $input.first()?.json[\"Media\"]?.[0];\nconst binaryData = $input.first()?.binary?.[\"Media\"];\n\nlet mime_type = null;\nlet media_type = null;\n\nif (file && binaryData) {\n mime_type = file.mimetype || \"\";\n\n if (mime_type.startsWith(\"image/\")) {\n media_type = \"IMAGE\";\n } else if (mime_type.startsWith(\"video/\")) {\n media_type = \"VIDEO\";\n } else if (mime_type.startsWith(\"audio/\")) {\n media_type = \"AUDIO\";\n }\n}\n\nconst result = {\n content: post_content,\n mime_type,\n media_type,\n};\n\nconst output = {\n json: result,\n};\n\nif (binaryData) {\n // @ts-ignore\n output.binary = {\n media: binaryData,\n };\n}\n\nreturn [output];\n"
},
"typeVersion": 2
},
{
"id": "2be2cb40-2170-4388-b447-8e282f6ab85c",
"name": "Upload Media (X)",
"type": "n8n-nodes-base.httpRequest",
"position": [
320,
-240
],
"parameters": {
"url": "https://upload.twitter.com/1.1/media/upload.json?media_category=TWEET_IMAGE",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"sendBody": true,
"contentType": "multipart-form-data",
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "media",
"parameterType": "formBinaryData",
"inputDataFieldName": "media"
}
]
},
"nodeCredentialType": "twitterOAuth1Api"
},
"credentials": {
"twitterOAuth1Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "4c947ff2-3753-41a0-8ea7-ffa38bc159f2",
"name": "X",
"type": "n8n-nodes-base.twitter",
"position": [
540,
-240
],
"parameters": {
"text": "={{ $('Extract Media Details').first().json.content }}",
"additionalFields": {
"attachments": "={{ $json.media_id_string }}"
}
},
"credentials": {
"twitterOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "d4706df1-dce1-4005-8e82-e4cca57265f7",
"name": "If Image Exists",
"type": "n8n-nodes-base.if",
"position": [
100,
-140
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "43da4ad0-1edb-407c-afc8-5a2ba5ea5388",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.mime_type }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4f53c3ab-8ec5-437f-8a94-93584590be9a",
"name": "X1",
"type": "n8n-nodes-base.twitter",
"position": [
540,
-40
],
"parameters": {
"text": "={{ $json.content }}",
"additionalFields": {}
},
"credentials": {
"twitterOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "4ca9c2b4-840a-4aa6-9b01-0e8f34eb1165",
"name": "End Form ",
"type": "n8n-nodes-base.form",
"position": [
760,
-140
],
"parameters": {
"options": {},
"operation": "completion",
"completionTitle": "Thank you so much for sharing your experience on X! \ud83d\udda4 ",
"completionMessage": "We truly appreciate your support and are so glad we could make a positive impact. Your words mean the world to us!"
},
"typeVersion": 1
},
{
"id": "4b443e27-94fe-4c37-a851-9080ef799721",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
-280
],
"parameters": {
"width": 300,
"height": 120,
"content": "## Customize Confirmation Message \nDisplays thank-you message post-submission."
},
"typeVersion": 1
}
],
"connections": {
"X": {
"main": [
[
{
"node": "End Form ",
"type": "main",
"index": 0
}
]
]
},
"X1": {
"main": [
[
{
"node": "End Form ",
"type": "main",
"index": 0
}
]
]
},
"If Image Exists": {
"main": [
[
{
"node": "Upload Media (X)",
"type": "main",
"index": 0
}
],
[
{
"node": "X1",
"type": "main",
"index": 0
}
]
]
},
"Upload Media (X)": {
"main": [
[
{
"node": "X",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "Extract Media Details",
"type": "main",
"index": 0
}
]
]
},
"Extract Media Details": {
"main": [
[
{
"node": "If Image Exists",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
twitterOAuth1ApitwitterOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
A user-friendly n8n workflow that enables users to submit tweets through a simple web form — with optional image, video, or GIF uploads — and posts them to a connected X/Twitter account. Designed for ease of use, this workflow handles both media and text-only posts, providing…
Source: https://n8n.io/workflows/4415/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
✨🤖Automated AI Powered Social Media Content Factory for X + Facebook + Instagram + LinkedIn. Uses outputParserStructured, lmChatGoogleGemini, lmChatOpenAi, httpRequest. Event-driven trigger; 57 nodes
Social Media Managers and Digital Marketers seeking to streamline content production across 7+ platforms (X/Twitter, Instagram, LinkedIn, Facebook, TikTok, Threads, YouTube Shorts) using AI-powered au
This AI-driven n8n workflow automates social media content creation and publishing across LinkedIn, Instagram, Facebook, and Twitter (X). It generates engaging, platform-optimized posts using Google G
Disclaimer: this workflow only works on self-hosted instances due to the file system usage.
This Workflow streamlines the process of publishing posts (image or video) to multiple social media platforms using a unified form and a third-party API service called Upload-Post.