8
n8n 中文网amn8n.com

在 Bluesky 上创建主题

高级

这是一个Marketing领域的自动化工作流,包含 20 个节点。主要使用 Set, Code, Wait, HttpRequest, SplitInBatches 等节点。 在Bluesky上创建主题

前置要求
  • 可能需要目标 API 的认证凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "7ZIG5xxEACMBgj4Z",
  "meta": {
    "instanceId": "1b1e85a338c6ce950207b3b471d43405c7b292e6b980ee5b66c1a9e5af2a50f8"
  },
  "name": "在 Bluesky 上创建主题",
  "tags": [
    {
      "id": "f3JGorUk16BX0hZI",
      "name": "Bluesky",
      "createdAt": "2025-01-19T09:37:40.989Z",
      "updatedAt": "2025-01-19T09:37:40.989Z"
    },
    {
      "id": "hTHZamkzaTBmF3yo",
      "name": "Template",
      "createdAt": "2025-01-16T04:45:44.377Z",
      "updatedAt": "2025-01-16T04:45:44.377Z"
    }
  ],
  "nodes": [
    {
      "id": "5fea442d-80e7-4e9c-9214-12fa8bc98a71",
      "name": "创建 Bluesky 会话",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2160,
        540
      ],
      "parameters": {
        "url": "https://bsky.social/xrpc/com.atproto.server.createSession",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "identifier",
              "value": "={{ $json.BlueskyHandle }}"
            },
            {
              "name": "password",
              "value": "={{ $json.BlueskyAppPassword }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8339e67d-87f8-48a5-a9c9-48d90d9baf49",
      "name": "创建回复",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1200,
        540
      ],
      "parameters": {
        "url": "https://bsky.social/xrpc/com.atproto.repo.createRecord",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $('Create Reply Text').item.json.toJsonString() }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Create Bluesky Session').item.json.accessJwt}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "16fa4a6c-ab93-4ea1-9a9b-2f9e9804e25a",
      "name": "每天上午 9 点运行",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2640,
        540
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7c06e67d-a524-457b-a6ce-955aab353352",
      "name": "设置 Bluesky 凭据",
      "type": "n8n-nodes-base.set",
      "position": [
        -2380,
        540
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ec07f538-0164-40c5-a199-45e2a8a4604a",
              "name": "BlueskyHandle",
              "type": "string",
              "value": "[enter your bluesky handle here]"
            },
            {
              "id": "463e906c-c49b-41e0-9176-04bd2c175d0b",
              "name": "BlueskyAppPassword",
              "type": "string",
              "value": "[enter your app password here]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "156da8f4-5cc7-4a58-9a6c-75b1bd6df4cd",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2440,
        340
      ],
      "parameters": {
        "color": 3,
        "width": 440,
        "height": 360,
        "content": "## Bluesky 认证"
      },
      "typeVersion": 1
    },
    {
      "id": "2bd742a8-3955-4452-95c8-9c9a7b8071e2",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1960,
        340
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 360,
        "content": "## 初始帖子 [A]"
      },
      "typeVersion": 1
    },
    {
      "id": "e6e258e8-e4a7-4e33-bd7c-40dd4eb8842f",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1480,
        340
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 360,
        "content": "## 第一个回复帖子 [B]"
      },
      "typeVersion": 1
    },
    {
      "id": "8e3808d3-ec7d-4f46-89b7-9b27350801de",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2440,
        740
      ],
      "parameters": {
        "width": 440,
        "height": 380,
        "content": "## 同级帖子 [C]"
      },
      "typeVersion": 1
    },
    {
      "id": "0b9d8329-2dde-4b3b-bd9e-42d5aa367225",
      "name": "创建回复文本",
      "type": "n8n-nodes-base.code",
      "position": [
        -1420,
        540
      ],
      "parameters": {
        "jsCode": "// Create the reply text\nconst replyText = \"[reply post - hidden]\";\n\n// Calculate timestamp 1 second from now\nconst futureDate = new Date(Date.now() + 1000);\n\n// Create the reply post object\nconst replyPostData = {\n    repo: $('Set Bluesky Credentials').first().json.BlueskyHandle,\n    collection: \"app.bsky.feed.post\",\n    record: {\n        \"$type\": \"app.bsky.feed.post\",\n        text: replyText,\n        reply: {\n            root: {\n                cid: $('Create Initial Post').first().json.cid,\n                uri: $('Create Initial Post').first().json.uri\n            },\n            parent: {\n                cid: $('Create Initial Post').first().json.cid,\n                uri: $('Create Initial Post').first().json.uri\n            }\n        },\n        createdAt: futureDate.toISOString()\n    }\n};\n\nreturn replyPostData;"
      },
      "typeVersion": 2
    },
    {
      "id": "abfbef84-1b94-4ec4-ae96-345d0ea888ce",
      "name": "创建同级文本",
      "type": "n8n-nodes-base.code",
      "position": [
        -2380,
        780
      ],
      "parameters": {
        "jsCode": "// Create the sibling text\nconst siblingText = \"[first sibling - hidden]\";\n\n// Calculate timestamp 2 seconds from now\nconst futureDate = new Date(Date.now() + 2000);\n\n// Create the sibling post object\nconst siblingPostData = {\n    repo: $('Set Bluesky Credentials').first().json.BlueskyHandle,\n    collection: \"app.bsky.feed.post\",\n    record: {\n        \"$type\": \"app.bsky.feed.post\",\n        text: siblingText,\n        reply: {\n            root: {\n                cid: $('Create Initial Post').first().json.cid,\n                uri: $('Create Initial Post').first().json.uri\n            },\n            parent: {\n                cid: $('Create Reply').first().json.cid,\n                uri: $('Create Reply').first().json.uri\n            }\n        },\n        createdAt: futureDate.toISOString()\n    }\n};\n\nreturn siblingPostData;"
      },
      "typeVersion": 2
    },
    {
      "id": "f554f5bc-bd81-4b09-887b-6c4167e8f5f1",
      "name": "创建同级",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2160,
        780
      ],
      "parameters": {
        "url": "https://bsky.social/xrpc/com.atproto.repo.createRecord",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $('Create Sibling Text').item.json.toJsonString() }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Create Bluesky Session').item.json.accessJwt}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7a7025fe-4b35-44db-8974-2bc81c59eead",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2700,
        340
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 360,
        "content": "## 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "097767bc-fbb2-4e71-af68-b87d354b796e",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1960,
        740
      ],
      "parameters": {
        "color": 6,
        "width": 940,
        "height": 380,
        "content": "## 使用 Loop 节点的同级帖子 [D]"
      },
      "typeVersion": 1
    },
    {
      "id": "5f8e88ef-0f56-4d81-921f-17dbfea41eec",
      "name": "循环帖子",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1720,
        780
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "449a0269-61cb-477c-b315-943daada65ba",
      "name": "创建初始帖子",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1680,
        540
      ],
      "parameters": {
        "url": "https://bsky.social/xrpc/com.atproto.repo.createRecord",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $('Create Post Text').item.json.toJsonString() }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Create Bluesky Session').item.json.accessJwt}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e29aa109-2b11-44c7-9a85-b5199ef4923c",
      "name": "创建帖子",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1360,
        780
      ],
      "parameters": {
        "url": "https://bsky.social/xrpc/com.atproto.repo.createRecord",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $('Create Sibling Text (Loop)').item.json.toJsonString() }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Create Bluesky Session').item.json.accessJwt}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "51c05a08-797b-448b-b291-753be14d7c78",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1200,
        780
      ],
      "webhookId": "0414c5a9-938c-427d-98a2-1295eb02380d",
      "parameters": {
        "amount": 2
      },
      "typeVersion": 1.1
    },
    {
      "id": "b9f1bd23-e8f2-472b-ab61-05e85ffece12",
      "name": "创建帖子文本",
      "type": "n8n-nodes-base.code",
      "position": [
        -1900,
        540
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Create the initial post text\nconst postText = \"[initial post - visible]\";\n\n// Create the parent post object\nconst postData = {\n    repo: $('Set Bluesky Credentials').first().json.BlueskyHandle,\n    collection: \"app.bsky.feed.post\",\n    record: {\n        $type: \"app.bsky.feed.post\",\n        text: postText,\n        createdAt: $now\n    }\n};\n\nreturn postData;"
      },
      "typeVersion": 2
    },
    {
      "id": "6c1e26df-564e-4b49-8aff-bc6e5bedcbb8",
      "name": "创建同级数组",
      "type": "n8n-nodes-base.code",
      "position": [
        -1900,
        780
      ],
      "parameters": {
        "jsCode": "const items = [\n    { id: 2, name: '[sibling two - hidden]' },\n    { id: 3, name: '[sibling three - hidden]' },\n    { id: 4, name: '[sibling four - hidden]' },\n    { id: 5, name: '[sibling five - hidden]' },\n    { id: 6, name: '[sibling six - hidden]' },\n    { id: 7, name: '[sibling seven - hidden]' },\n    { id: 8, name: '[sibling eight - hidden]' },\n    { id: 9, name: '[sibling nine - visible]' },\n    { id: 10, name: '[sibling ten - visible]' }\n];\n\nreturn items;"
      },
      "typeVersion": 2
    },
    {
      "id": "5a91aff4-1b9d-4c69-beed-fa906c2a133b",
      "name": "创建同级文本(循环)",
      "type": "n8n-nodes-base.code",
      "position": [
        -1540,
        780
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Create the sibling text\nconst siblingText = `[${$json.name}]`;\n\n// For the first iteration, use the parent IDs from Create Sibling node\n// For subsequent iterations, use the Create Post node\nconst isFirstIteration = $runIndex === 0;\nconst cid = isFirstIteration \n    ? $('Create Sibling').first().json.cid \n    : $('Create Post').first().json.cid;\nconst uri = isFirstIteration \n    ? $('Create Sibling').first().json.uri \n    : $('Create Post').first().json.uri;\n\n// Calculate timestamp 2 seconds from now\nconst futureDate = new Date(Date.now() + 2000);\n\n// Create the sibling post object\nconst siblingPostData = {\n    repo: $('Set Bluesky Credentials').first().json.BlueskyHandle,\n    collection: \"app.bsky.feed.post\",\n    record: {\n        \"$type\": \"app.bsky.feed.post\",\n        text: siblingText,\n        reply: {\n            root: {\n                cid: $('Create Initial Post').first().json.cid,\n                uri: $('Create Initial Post').first().json.uri\n            },\n            parent: {\n                cid: cid,\n                uri: uri\n            }\n        },\n        createdAt: futureDate.toISOString()\n    }\n};\n\nreturn siblingPostData;"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d0c40145-fbf4-46b5-9df0-5b5c9c896d9c",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Posts": {
      "main": [
        [],
        [
          {
            "node": "Create Sibling Text (Loop)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Post": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Reply": {
      "main": [
        [
          {
            "node": "Create Sibling Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sibling": {
      "main": [
        [
          {
            "node": "Create Sibling Array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Post Text": {
      "main": [
        [
          {
            "node": "Create Initial Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Reply Text": {
      "main": [
        [
          {
            "node": "Create Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Daily at 9 AM": {
      "main": [
        [
          {
            "node": "Set Bluesky Credentials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Initial Post": {
      "main": [
        [
          {
            "node": "Create Reply Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sibling Text": {
      "main": [
        [
          {
            "node": "Create Sibling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sibling Array": {
      "main": [
        [
          {
            "node": "Loop Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Bluesky Session": {
      "main": [
        [
          {
            "node": "Create Post Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Bluesky Credentials": {
      "main": [
        [
          {
            "node": "Create Bluesky Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sibling Text (Loop)": {
      "main": [
        [
          {
            "node": "Create Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 营销

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量20
分类1
节点类型7
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Gareth B. Davies

Gareth B. Davies

@garethbdavies

API/AI/Automation Coach with 30 years experience helping teams build sustainable, efficient processes and systems. Join my Automate 30 for 30 live cohort and course to reclaim your time.

外部链接
在 n8n.io 查看

分享此工作流