Inbox 和 Automation
通过 API 读取和回复 Instagram DM,并设置自动回复。
Inbox
Inbox 保存您账号的 Instagram DM 对话。
GET /inbox/conversations:最新消息在前。status为open(默认)、needs_you(AI agent 已将对话转交给团队)、done或all;q用于搜索。GET /inbox/conversations/{id}/messages:最早的在前;读取后对话会被标记为已读。POST /inbox/conversations/{id}/messages:发送text(最多 1,000 个字符)和/或媒体库中的一个media_id(最大 8 MB 的照片或最大 25 MB 的视频)。PATCH /inbox/conversations/{id}:status为open或done;needs_you: false会把对话交还给 AI agent。POST /inbox/conversations/resolve可对多个对话执行相同操作。- 另外还有:重试失败的 DM、用爱心回应、显示输入中、下载附件、快捷回复,以及让 agent 起草回复。
Instagram 只允许商家在对方最后一条消息后的 24 小时内回复。被 Instagram 拒绝的消息会保存为失败状态,以便您重试。
Automation
Automation 会在一个账号上回复它开启之后收到的内容。使用 POST /automations 创建:
{
"account_id": "6b1e…",
"name": "Price list by DM",
"kind": "comment_to_dm",
"trigger": { "posts": "all", "match": "contains", "keywords": ["price", "harga"] },
"actions": {
"dmText": "Here is our price list.",
"buttons": [{ "title": "Price list", "url": "https://example.com/prices" }],
"trackClicks": true,
"replyVariants": ["Sent you a DM!"]
},
"delay": "natural",
"once_per_person": true,
"enabled": true
}kind | 作用 | 平台 |
|---|---|---|
comment_to_dm | 向发表评论的人发送 DM。 | |
dm_keyword | 回复包含关键词的 DM。 | |
default_reply | 回复其他 Automation 未回复的 DM,每人每个 frequency 最多一次。 | |
story_reply | 回复对您 Stories 的回复。 | |
story_mention | 回复在其 Stories 中提及您的人。 | |
ice_breaker | 有人打开聊天时显示的问题,每个问题都有对应的答案(1–4 个)。 | |
comment_reply | 公开回复评论(Threads、Facebook 等至少需要 3 个 replyVariants)。 | Instagram、Facebook Page、Threads、YouTube、TikTok、Telegram |
comment_hide | 隐藏包含所列词语的评论。 | Instagram、Facebook Page、Threads、YouTube、TikTok、Telegram |
comment_like | 点赞评论。 | Facebook Page、TikTok |
TikTok 的 Automation 需要该账号已连接 TikTok Business。
trigger:posts(all、表示下一个 post 的 next,或平台 post id 列表)、match(any、contains、exact)、keywords(最多 200 个)、includeReplies、frequency(hour、day、week)。actions:dmText(最多 1,000 个字符,带按钮时为 640 个)、replyVariants(最多 5 个)、agentId(改由 AI agent 回复)、buttons(最多 3 个链接)、trackClicks、requireFollow(对方关注后才发送 DM)、heart、markAutomated、iceBreakers。delay 为 fast、natural(默认)或 relaxed。除非您发送 enabled: true,否则 Automation 创建后处于关闭状态。
GET /automations 返回每个 Automation 及其计数(已发送、已跳过、失败、点击、关注、点击率),GET /automations/{id}/runs 返回最近的运行记录及其结果和原因。automation.run webhook 会在每次运行结束时进行报告。