基于表单的X/Twitter发布器
中级
这是一个Marketing领域的自动化工作流,包含 8 个节点。主要使用 If, Code, Form, Twitter, FormTrigger 等节点。 基于表单的X/Twitter发布器
前置要求
- •Twitter API 凭证
- •可能需要目标 API 的认证凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "7d8066d2f56a07000fe7d753d3eeabf0ecdf68413466f30d10afe0906f058427",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "02b20189-94ce-4608-9c8d-a29a9d97db32",
"name": "表单提交时",
"type": "n8n-nodes-base.formTrigger",
"position": [
-340,
-140
],
"webhookId": "8d789827-135b-47a3-86ee-79492636d079",
"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": {
"id": "II0YlgWMqJBDlQ8f",
"name": "X OAuth - Akhil"
}
},
"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": {
"id": "1llweRRwiqe7gFwJ",
"name": "X OAuth2 - Akhil"
}
},
"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": {
"id": "1llweRRwiqe7gFwJ",
"name": "X OAuth2 - Akhil"
}
},
"typeVersion": 2
},
{
"id": "4ca9c2b4-840a-4aa6-9b01-0e8f34eb1165",
"name": "End Form ",
"type": "n8n-nodes-base.form",
"position": [
760,
-140
],
"webhookId": "21143d55-557b-43e2-94f7-6d617af3e5dc",
"parameters": {
"options": {},
"operation": "completion",
"completionTitle": "Thank you so much for sharing your experience on X! 🖤 ",
"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": "便签",
"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
}
],
"pinData": {},
"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
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 营销
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
✨🤖 自动化AI驱动的社交媒体内容工厂,适用于X + Facebook + Instagram + LinkedIn
✨🤖 使用AI自动化多平台社交媒体内容创建
If
Set
Code
+17
57 节点Joseph LePage
人工智能
会议反馈收集与Excel OneDrive记录及Outlook通知
通过表单收集会议反馈,记录到Excel OneDrive,并发送Outlook通知
If
Set
Code
+7
13 节点Akhil Varma Gadiraju
营销
社交媒体教程
基于AI的社交媒体内容生成与发布
Set
Code
Form
+11
26 节点Amjid Ali
人工智能
使用关键词在 X 和其他社交媒体平台发布最新新闻
使用关键词和 Bright Data 通过 AI 内容生成自动发布最新新闻到 X
If
Code
Wait
+8
16 节点Dvir Sharon
设计
CSV到HubSpot上传器(动态字段映射与Google Sheets集成)
具有动态字段映射和Google Sheets集成的CSV到HubSpot上传器
If
Set
Code
+10
36 节点PollupAI
人工智能
实时Notion Todoist双向同步模板
使用Redis的Notion Todoist实时双向同步
If
Set
Code
+26
246 节点Mario
销售
工作流信息
难度等级
中级
节点数量8
分类1
节点类型7
作者
Akhil Varma Gadiraju
@akhilv7I'm a full stack developer passionate about building intelligent, scalable solutions that automate workflows and enhance productivity. I love working at the intersection of AI, APIs, and automation—using tools like n8n to streamline processes, integrate data, and unlock smarter decision-making. Whether it's crafting custom backend services or designing intuitive frontends, I’m always exploring ways to build more with less manual effort.
外部链接
在 n8n.io 查看 →
分享此工作流