接入前要明确的三件事
把手机自动化接进飞书、工单、教务或测试平台之前,先别急着写代码。有三个问题没想清楚,后面大概率要返工:任务由谁触发、结果怎么回传、出错谁来兜底。
一、任务触发方式
常见触发源有三类:人工在 IM 里发指令(例如 飞书远程控制安卓自动化)、业务系统按事件自动派发(新建工单、订单状态变更)、定时任务。接入前要确认触发方能否拿到唯一任务 ID,否则并发时无法对账。
二、结果回传与对账
自动化执行完成后,把结果写回业务系统:成功或失败状态、截图或录屏、耗时、设备编号。建议约定统一的回调结构,让业务系统不必关心手机端的实现细节。
三、异常处理与兜底
设备离线、界面改版、识别失败都会让任务中断。可参考 脚本失效与屏幕识别技能包 的做法,把重试、超时和人工接管写进流程,避免脏数据流进业务侧。
API 接口与技能包:两条落地路径有何区别
两条路径并不互斥,常见的节奏是先用技能包把流程跑通,再用 API 把能力接进自有系统。
- API 接口:由业务系统直接调用,适合已有后端、需要事件驱动与统一鉴权的团队;开发量更大,但对账和监控更清晰。
- 技能包:把常用操作封装成可复用模块,适合流程尚未定型、想快速验证的场景;改动成本低,适合先做小范围试点。
- 选择思路:先看触发源是人工还是系统,再看结果是否需要写回数据库,最后评估长期维护成本。
接入步骤:从沙箱到灰度上线
第一步,梳理一条真实业务链路,只选一到两个高频动作做最小闭环,不要一上来就覆盖全部场景。
第二步,在测试环境验证触发、执行、回传三段是否都通,并重点测试失败分支。遇到元素找不到、识别不准等问题,可先看 自动化脚本失败排查 的常见原因,再决定是改脚本还是改流程。
第三步,灰度给一个团队使用,记录耗时、成功率与人工介入次数,用数据判断是否值得扩大范围。
第四步,确认稳定后再接入更多系统,并把经验沉淀成技能包或接口文档,减少后续重复沟通。
上线验收清单
- 每个任务都有唯一 ID,触发方与执行方能对上账。
- 回调结构统一、支持幂等,重复通知不会写入两条记录。
- 失败有重试上限、超时告警与人工接管入口。
- 关键结果可追溯,截图或日志能定位到具体设备与时间。
- 权限与账号隔离清晰,测试与生产环境分开。
小步试点的建议:先用技能包把一条流程跑通,再决定要不要投入 API 开发;无论选择哪条路径,把异常处理写进验收清单,才算真正接入成功。
Three Things to Settle Before Integration
Before wiring phone automation into Feishu, a ticketing system, a school platform or a test platform, do not start with code. Three questions decide whether the project holds up: who triggers the task, how results come back, and who owns the failure.
1. How Tasks Are Triggered
There are usually three sources: a person sending a command in a chat tool (for example remote control of Android automation via Feishu), an event from a business system, or a scheduled job. Make sure the caller passes a unique task ID, otherwise concurrent runs cannot be reconciled.
2. How Results Come Back
Write the outcome back to the business system: success or failure, screenshot or recording, duration, and device ID. Agree on one callback shape so the business side never has to know how the phone side is implemented.
3. How Failures Are Handled
Offline devices, redesigned screens and recognition errors will all break a run. A practical pattern such as the script failure and screen recognition skill pack puts retries, timeouts and manual takeover into the flow, so bad data never reaches the business system.
API vs Skill Packs: What's the Difference
The two paths are not exclusive. A common sequence is to prove the flow with a skill pack first, then connect the capability to your own system through an API.
- API: called directly by your business system. Fits teams with an existing backend that need event-driven runs and unified authentication. More work up front, but cleaner reconciliation and monitoring.
- Skill packs: wrap common actions into reusable modules. Fits flows that are still changing or teams that want to validate quickly, with low change cost.
- How to choose: check whether the trigger is human or automated, whether results must be written to a database, and what the long-term maintenance load looks like.
Integration Steps: From Sandbox to Gradual Rollout
Step one: pick one real business flow and cover only one or two high-frequency actions as a minimal loop, instead of every scenario at once.
Step two: in a test environment, verify that trigger, execution and callback all work, and focus on the failure branches. If elements are missing or recognition is unstable, review common causes in automation script failure troubleshooting before changing the flow itself.
Step three: roll it out to one team first, and track duration, success rate and the number of manual interventions to judge whether wider use is worth it.
Step four: once it is stable, connect more systems and turn the lessons into skill packs or interface docs to cut repeated back-and-forth.
Acceptance Checklist
- Every task has a unique ID so the caller and the runner can reconcile.
- Callbacks share one shape and support idempotency, so repeat notifications do not create duplicate records.
- Failures have a retry limit, a timeout alert and a manual takeover entry point.
- Key results are traceable, with screenshots or logs mapping to a specific device and time.
- Permissions and accounts are separated, and test and production environments stay apart.
Start small: prove one flow with a skill pack before investing in API development. Whichever path you choose, treating failure handling as part of acceptance is what makes the integration actually reliable.