在本指南中,我们将介绍如何借助 Codex 桌面应用程序(来自 ChatGPT 开发团队)、MCP 服务器(Model Context Protocol)和 Undetectable 反检测浏览器,设置完全自动化的 Instagram 发帖。神经网络会自行打开所需的个人资料,进入社交平台,上传图片,编写文本,并点击“发布”按钮。
分步指南:从零开始设置自动化
这个自动化方案甚至可以在 Undetectable 浏览器的免费版本中使用!最重要的是需要拥有 OpenAI 订阅。
步骤 1. 准备基础环境和内容
首先,我们需要准备好我们的技术栈:
1.下载 Undetectable 反检测浏览器(即使是免费版本也可以使用自动化)。
重要提示: AI 是一个出色的执行者,但需要提前为它准备好文件。在电脑上创建一个文件夹,将用于发帖的成品图片和带有文本的文档放进去。在 prompt 中,我们需要指定这些文件的准确路径。
如何获取文件路径?
- 在 Windows 上: 按住 Shift 键并右键点击文件。在出现的菜单中选择“复制为路径”(Copy as path)。 注意:将路径粘贴到 prompt 中时,最好去掉路径两端的引号。
- 在 macOS 上: 右键点击文件,然后按住 Option(Alt)键。“复制”选项会变为“拷贝 [文件名] 的路径”(Copy [File] as Pathname)。点击它即可。
步骤 2. 启动 Codex
从官方网站下载桌面应用程序 Codex 并登录(提醒一下,需要有效的 OpenAI 订阅)。
步骤 3. 连接 MCP 服务器
现在我们需要让神经网络与浏览器连接起来,以便它可以控制浏览器。为此,请在 Codex 中打开一个新聊天,并要求 AI 连接 MCP 服务器。
只需向神经网络发送以下 prompt,并附上代码片段:
“连接这个 MCP 服务器:”
{ "mcpServers": { "undetectable-local-api-ts": { "command": "npx", "args": ["-y", "undetectable-local-api-mcp-ts"], "env": { "UNDETECTABLE_BASE_URL": "http://127.0.0.1:25325", "UNDETECTABLE_TIMEOUT": "60" } } }}AI 会理解并自行完成所有操作。当它报告已成功添加后,请重启 Codex,并打开 Undetectable 浏览器,这样更改才会生效,自动化也能正常工作。
关于如何将 MCP 服务器连接到其他模型的更多信息,可以查看 GitHub 或 NPM.
Instagram 发帖自动化
当技术部分准备就绪后,最有趣的部分就开始了 —— 为 AI 编写算法(prompt)。为了展示神经网络的逻辑是如何工作的,我们将这个过程分成了两个阶段。
阶段 1:测试运行
在第一次测试中,我们在 Codex 中创建了一个新聊天,并要求它在反检测浏览器中打开提前配置好的个人资料,进入 Instagram 并发布一篇帖子。我们像给真人解释任务一样编写了算法:“找到带加号的按钮”、“点击 Next”等等。
我们的第一个 prompt 如下:
Undetectable browser 1.Start the profile named "INSTA" using the start_profile tool
2.Wait 3 seconds for the browser to fully load
3.Navigate to https://www.instagram.com
4.Wait 3 seconds for the page to load
5.Look for the "+" (Create) icon and click it
6.A menu will appear — click "Post" from the menu options
7.Wait for the upload dialog to appear
8.Click the button "Select from computer"
9.A system file picker window will open
10.In the file picker, type or paste the full path:
(文件路径)
Then press Enter to confirm
11.Wait for the image to upload and appear in preview
12.Click the "Next" button (top right of the dialog) — this moves to crop/filter step
13.Click "Next" again — this moves to the caption step
14.Click on the caption text field
15.Type exactly the following text: (帖子文本)
16.Click the "Share" button (top right)
17.Wait for the confirmation that the post was published
18.Take a screenshot to confirm success
Important: If the Instagram UI has been updated and buttons or menu items have different names or positions, adapt accordingly and proceed with the closest matching option to complete the task.
结果: 成功了!帖子发布成功。但整个过程花费了很多时间。AI 做了许多多余的动作,尝试通过视觉寻找所需按钮,并一步一步模仿人类的点击路径。我们需要更快的方式。
阶段 2:AI 自我优化
在任务成功但执行较慢之后,我们要求神经网络分析自己的操作,并为自己编写一个新的优化 prompt。任务很简单 —— 考虑测试运行中的所有错误,让自动化尽可能快速且稳定。
随后,我们在新的 Codex 聊天中使用了生成的 prompt。最终,自动化过程顺利完成,没有卡顿。
Start the Undetectable profile named Social UDT
Wait 3 seconds after profile start.
Connect to the profile’s returned websocket_link.
Open Instagram directly at:
https://www.instagram.com/create/select/
Wait 3 seconds for the create upload page.
If the Select from computer button is visible, click it and set this file in the chooser:
(图片文件路径)
If a file input is already present, set the same file directly on input[type="file"].
Wait up to 45 seconds for Instagram to finish upload/navigation.
Do not wait for Next buttons. The observed successful flow goes directly to:
https://www.instagram.com/create/details/
On the details page, fill the visible textarea:
textarea[aria-label="Write a caption…"]
with exactly:
(帖子文本)
Find the enabled button whose exact visible text is Share.
Trigger the Share button directly with a full pointer/mouse/click event sequence on that button.
Wait up to 90 seconds for Instagram to leave /create/details/ and return to Instagram home or another non-create page.
Open:
https://www.instagram.com/undetectablebrowser/
Wait 5 seconds.
Take a screenshot confirming the newest grid item appears at the top-left of the profile grid.
总结
MCP、Codex 和 Undetectable 的组合,彻底改变了 SMM 和联盟营销中的游戏规则。你不只是自动化点击操作 —— 你是在把个人资料管理逻辑交给 AI。
今天就试着设置你的第一个自动发帖吧!