managing-subscriptions
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManaging subscriptions
管理订阅
This skill guides you through managing PostHog subscriptions.
Subscriptions deliver scheduled snapshots of insights or dashboards via email, Slack, or webhook.
本技能将引导您管理PostHog订阅。
订阅会按计划通过邮件、Slack或Webhook发送洞察或仪表板的快照。
When to use this skill
使用场景
Use this skill when the user:
- Wants to "track", "follow", "subscribe to", or "get updates" about an insight or dashboard
- Asks for "daily updates", "weekly reports", or "send me this every morning"
- Wants to know what subscriptions they have
- Asks to stop, pause, or unsubscribe from something
- Wants to change who receives an update or how often
当用户有以下需求时,使用本技能:
- 想要“追踪”“关注”“订阅”或“获取”某一洞察或仪表板的更新
- 要求“每日更新”“每周报告”或“每天早上给我发送这个”
- 想了解自己有哪些订阅
- 请求停止、暂停或取消订阅
- 想要更改接收更新的人员或频率
Subscriptions vs alerts
订阅与告警的区别
Subscriptions and alerts serve different purposes:
- Subscriptions deliver a snapshot on a fixed schedule (daily, weekly, etc.) regardless of the data
- Alerts fire only when a condition is met (threshold crossed, anomaly detected)
If the user says "notify me when this drops below 100", use alerts.
If the user says "send me this every morning", use subscriptions.
订阅和告警的用途不同:
- 订阅:无论数据如何,都会按固定时间表(每日、每周等)发送快照
- 告警:仅在满足特定条件时触发(如阈值突破、检测到异常)
如果用户说“当数值低于100时通知我”,请使用告警功能。
如果用户说“每天早上给我发送这个”,请使用订阅功能。
Workflow
工作流程
Listing existing subscriptions
查看现有订阅
Before creating a new subscription, check if one already exists.
Use with optional filters:
subscriptions-list- Filter by insight: pass the query parameter with the insight ID
insight - Filter by dashboard: pass the query parameter with the dashboard ID
dashboard - Filter by channel: pass as
target_type,email, orslackwebhook
创建新订阅前,请先检查是否已存在相关订阅。
使用接口,并可添加可选筛选条件:
subscriptions-list- 按洞察筛选:传入查询参数,值为洞察ID
insight - 按仪表板筛选:传入查询参数,值为仪表板ID
dashboard - 按渠道筛选:传入参数,值为
target_type、email或slackwebhook
Creating a subscription
创建订阅
Step 1: Ask the user how they want to receive it
步骤1:询问用户接收方式
Always ask the user whether they want email or Slack delivery before creating a subscription.
Do not assume a channel — ask explicitly:
Would you like to receive this via email or Slack?
If the user says Slack, you must verify the integration is available (see step 2).
If the user doesn't have a preference, suggest email as the simplest option.
创建订阅前,务必询问用户希望通过邮件还是Slack接收。
不要默认渠道——明确询问:
您希望通过邮件还是Slack接收订阅内容?
如果用户选择Slack,必须验证集成是否可用(见步骤2)。
如果用户没有偏好,建议选择邮件作为最简单的选项。
Step 2: Verify channel availability
步骤2:验证渠道可用性
Email requires no setup — it works out of the box. You just need the user's email address.
Get it from the user context or from .
org-members-listSlack requires a connected Slack integration. Before creating a Slack subscription:
- Call and look for an integration where
integrations-listiskind"slack" - If a Slack integration exists, note its — you'll need it as
idintegration_id - If no Slack integration exists, tell the user:
Slack isn't connected to this project yet. You can set it up in Project settings > Integrations. In the meantime, would you like to receive this via email instead?
Slack setup requires an OAuth flow in the browser — it cannot be done via MCP.
Webhook requires the user to provide a URL. Verify it looks like a valid URL before submitting.
邮件无需设置——开箱即用。您只需获取用户的邮箱地址。
可从用户上下文或接口获取。
org-members-listSlack需要已连接的Slack集成。创建Slack订阅前:
- 调用接口,查找
integrations-list为kind的集成"slack" - 如果存在Slack集成,记录其——创建时需将其作为
id参数传入integration_id - 如果没有Slack集成,请告知用户:
当前项目尚未连接Slack。您可以在项目设置 > 集成中完成设置。 在此期间,是否改为通过邮件接收订阅内容?
Slack设置需要在浏览器中完成OAuth流程——无法通过MCP操作。
Webhook需要用户提供URL。提交前请验证其格式是否为有效URL。
Step 3: Identify the target
步骤3:确定目标对象
Get the insight ID or dashboard ID. If the user provides a URL like ,
fetch the insight first with to get the numeric ID.
/project/2/insights/pKxzopBGinsight-get获取洞察ID或仪表板ID。如果用户提供类似的URL,
先调用接口获取该洞察的数字ID。
/project/2/insights/pKxzopBGinsight-getStep 4: Determine delivery settings from the user's request
步骤4:根据用户请求确定发送设置
| User says | Parameters |
|---|---|
| "every day" / "daily" / "every morning" | |
| "every week" / "weekly" | |
| "every Monday" | |
| "every month" / "monthly" | |
| "twice a week" | |
| 用户表述 | 参数设置 |
|---|---|
| "每天" / "每日" / "每天早上" | |
| "每周" / "每周一次" | |
| "每周一" | |
| "每月" / "每月一次" | |
| "每周两次" | |
Step 5: Create with subscriptions-create
subscriptions-create步骤5:调用subscriptions-create
接口创建订阅
subscriptions-createFor an insight subscription via email:
json
{
"insight": 12345,
"target_type": "email",
"target_value": "user@example.com",
"frequency": "daily",
"start_date": "2025-01-01T09:00:00Z"
}For a dashboard subscription (requires selecting which insights to include, max 6):
json
{
"dashboard": 67,
"dashboard_export_insights": [101, 102, 103],
"target_type": "email",
"target_value": "user@example.com",
"frequency": "weekly",
"byweekday": ["monday"],
"start_date": "2025-01-01T09:00:00Z"
}For Slack delivery, include the from step 2:
integration_idjson
{
"insight": 12345,
"target_type": "slack",
"target_value": "#general",
"integration_id": 789,
"frequency": "daily",
"start_date": "2025-01-01T09:00:00Z"
}通过邮件发送的洞察订阅示例:
json
{
"insight": 12345,
"target_type": "email",
"target_value": "user@example.com",
"frequency": "daily",
"start_date": "2025-01-01T09:00:00Z"
}仪表板订阅示例(需选择要包含的洞察,最多6个):
json
{
"dashboard": 67,
"dashboard_export_insights": [101, 102, 103],
"target_type": "email",
"target_value": "user@example.com",
"frequency": "weekly",
"byweekday": ["monday"],
"start_date": "2025-01-01T09:00:00Z"
}Slack发送的订阅示例,需包含步骤2中的:
integration_idjson
{
"insight": 12345,
"target_type": "slack",
"target_value": "#general",
"integration_id": 789,
"frequency": "daily",
"start_date": "2025-01-01T09:00:00Z"
}Updating a subscription
更新订阅
Use with the subscription ID. Common updates:
subscriptions-partial-update- Change frequency:
{"frequency": "weekly", "byweekday": ["monday"]} - Add recipients: Update with the full comma-separated list
target_value - Change channel: Update and
target_typetogethertarget_value
使用接口,传入订阅ID。常见更新操作:
subscriptions-partial-update- 更改频率:
{"frequency": "weekly", "byweekday": ["monday"]} - 添加收件人:更新为完整的逗号分隔列表
target_value - 更改渠道:同时更新和
target_typetarget_value
Deactivating a subscription
停用订阅
Subscriptions are soft-deleted. Use :
subscriptions-partial-updatejson
{
"id": 456,
"deleted": true
}订阅采用软删除方式。使用接口:
subscriptions-partial-updatejson
{
"id": 456,
"deleted": true
}Defaults
默认设置
When the user doesn't specify details:
- Frequency:
"daily" - Channel: email to the current user
- Start date: now (ISO 8601)
- Title: auto-generated from the insight/dashboard name if not specified
当用户未指定细节时:
- 频率:
"daily" - 渠道:发送到当前用户的邮箱
- 开始日期:当前时间(ISO 8601格式)
- 标题:如果未指定,则自动从洞察/仪表板名称生成
Error handling
错误处理
- Duplicate check: If a subscription already exists for the same insight/dashboard and channel, inform the user and offer to update it rather than creating a duplicate
- Slack not connected: If a Slack subscription is requested but no Slack integration exists, explain that Slack must be connected in Project settings > Integrations first, then offer email as an alternative. Do not attempt to create the subscription — it will fail with a validation error
- Slack integration wrong team: The Slack integration must belong to the same PostHog team. If returns Slack integrations but creation still fails, the integration may be misconfigured
integrations-list - Dashboard insights: Dashboard subscriptions require at least 1 and at most 6 insights selected via . If the user doesn't specify which insights, fetch the dashboard with
dashboard_export_insightsand select the first 6 insights from its tilesdashboard-get
- 重复检查:如果同一洞察/仪表板和渠道已存在订阅,请告知用户并提供更新选项,而非创建重复订阅
- Slack未连接:如果用户请求Slack订阅但未连接Slack集成,请说明需先在项目设置 > 集成中连接Slack,然后提供邮件作为替代方案。请勿尝试创建订阅——否则会触发验证错误
- Slack集成团队错误:Slack集成必须属于当前PostHog团队。如果返回Slack集成但创建仍失败,可能是集成配置有误
integrations-list - 仪表板洞察数量:仪表板订阅需通过选择至少1个、最多6个洞察。如果用户未指定选择哪些洞察,请调用
dashboard_export_insights接口获取仪表板信息,并从其组件中选择前6个洞察dashboard-get