pubnub-illuminate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePubNub Illuminate
PubNub Illuminate
You are the Illuminate specialist. Your role is to help developers create real-time analytics and automation using PubNub's Business Objects, Metrics, Decisions, Queries, and Dashboards — without writing backend code.
你是Illuminate专家,你的职责是帮助开发者无需编写后端代码,即可使用PubNub的Business Objects、Metrics、Decisions、Queries和Dashboards创建实时分析与自动化系统。
When to Use This Skill
何时使用该技能
Invoke this skill when:
- Tracking KPIs in real time (message counts, top users, session durations)
- Setting threshold alerts (publish a message / call a webhook / update App Context when a metric crosses a value)
- Detecting anomalies (cross-posting spam, chat flooding, abnormal volume)
- Visualizing live activity with charts
- Auto-moderating users (auto-mute on spam detection)
- Using the MCP tool
manage_illuminate
在以下场景调用该技能:
- 实时跟踪关键绩效指标(KPI),如消息计数、顶级用户、会话时长
- 设置阈值告警(当指标超过某个值时发布消息/调用Webhook/更新App Context)
- 检测异常行为(跨平台垃圾信息、聊天刷屏、异常流量)
- 用图表可视化实时活动
- 自动审核用户(检测到垃圾信息时自动禁言)
- 使用MCP工具
manage_illuminate
Core Workflow
核心工作流
Resources are built in dependency order. Skipping or reordering breaks things:
- Service Integration auth: create an API key with Illuminate Read & Write permission. See references/service-integration-auth.md.
- Business Object: define schema (which fields to extract from incoming messages). See references/business-objects.md.
- Metric (optional): aggregate a Business Object field over a time window. See references/metrics.md.
- Query (alternative to Metric): flexible pipeline for filter / join / dedupe. See references/queries-adhoc-vs-saved.md.
- Decision: evaluate conditions and fire actions. The 4-step PUT workflow is mandatory. See references/decisions-4-step-workflow.md.
- Dashboard: visualize Metrics with optional Decision overlays. See references/dashboards.md.
资源需按依赖顺序创建,跳过或打乱顺序会导致功能故障:
- 服务集成授权:创建具备Illuminate读写权限的API密钥。详见references/service-integration-auth.md。
- Business Object:定义数据模型(从传入消息中提取哪些字段)。详见references/business-objects.md。
- Metric(可选):在时间窗口内对Business Object字段进行聚合。详见references/metrics.md。
- Query(Metric的替代方案):用于过滤/关联/去重的灵活流水线。详见references/queries-adhoc-vs-saved.md。
- Decision:评估条件并触发动作。必须遵循四步PUT工作流。详见references/decisions-4-step-workflow.md。
- Dashboard:可视化Metric,可叠加Decision内容。详见references/dashboards.md。
Reference Guide
参考指南
- references/service-integration-auth.md — API key creation, required headers, environment isolation
- references/business-objects.md — schema, field types, JSONPath prefix, activation sequence, cascade-delete behavior
- references/metrics.md — aggregation functions, evaluation windows, dimensions vs measures, filter scoping
- references/decisions-4-step-workflow.md — the most error-prone API — required fields, the POST + PUT + PUT 4-step sequence, sourceType rules per source, action types, account limits
- references/queries-adhoc-vs-saved.md — pipeline model, ad-hoc vs saved format differences, using Queries as Decision sources
- references/dashboards.md — chart types, sizes, date ranges, full-replacement PUT behavior
- references/service-integration-auth.md — API密钥创建、必填请求头、环境隔离
- references/business-objects.md — 数据模型、字段类型、JSONPath前缀、激活序列、级联删除规则
- references/metrics.md — 聚合函数、评估窗口、维度与度量、过滤范围
- references/decisions-4-step-workflow.md — 最易出错的API — 必填字段、POST+PUT+PUT四步序列、不同数据源的sourceType规则、动作类型、账户限制
- references/queries-adhoc-vs-saved.md — 流水线模型、临时查询与已保存查询的格式差异、将Query作为Decision数据源
- references/dashboards.md — 图表类型、尺寸、日期范围、全量替换式PUT行为
Key Implementation Requirements
关键实现要求
API Endpoint and Headers
API端点与请求头
All Illuminate calls go to the PubNub Admin API. Every request requires both headers:
http
POST /v2/illuminate/business-objects HTTP/1.1
Host: admin-api.pubnub.com
Authorization: <ILLUMINATE_API_KEY>
PubNub-Version: 2026-02-09
Content-Type: application/jsonGet the API key from Service Integrations (see references/service-integration-auth.md). Store it in env var or your secrets manager — see pubnub-keyset-management/references/key-rotation-and-hygiene.md for storage rules.
ILLUMINATE_API_KEY所有Illuminate调用都指向PubNub Admin API,每个请求必须包含以下两个请求头:
http
POST /v2/illuminate/business-objects HTTP/1.1
Host: admin-api.pubnub.com
Authorization: <ILLUMINATE_API_KEY>
PubNub-Version: 2026-02-09
Content-Type: application/json从服务集成中获取API密钥(详见references/service-integration-auth.md)。将其存储在环境变量或密钥管理器中 — 存储规则详见pubnub-keyset-management/references/key-rotation-and-hygiene.md。
ILLUMINATE_API_KEYMessage Wrapping
消息封装
Illuminate evaluates JSONPath against a normalized document. The Illuminate Admin UI (Business Object field source) exposes a fixed Category → Subcategory map; that is the exhaustive top-level split the product gives you. Deeper keys (e.g. under or ) are your normal JSONPath continuation.
bodycustommessage| Subcategory | JSONPath prefix | Notes |
|---|---|---|
| body | | Your published payload; append |
| meta | | Message metadata object; extend with nested keys as needed. |
| userId | | Publisher UUID (scalar path). |
| channel | | Channel name on the message (scalar path). |
channel| Subcategory | JSONPath prefix |
|---|---|
| name | |
| type | |
| status | |
| custom | |
user| Subcategory | JSONPath prefix |
|---|---|
| externalId | |
| type | |
| status | |
| custom | |
membership| Subcategory | JSONPath prefix |
|---|---|
| status | |
| custom | |
After the subcategory: add the remaining path for nested or custom properties (e.g. , , ). If a path does not match the live shape, use a raw row snapshot ( with no transforms) to confirm.
$.message.body.data.score$.channel.custom.lastSentMessageUnixTime$.membership.custom.lastReadUnixTimequeries/executeIlluminate针对标准化文档评估JSONPath。Illuminate管理UI(Business Object字段来源)提供固定的分类→子分类映射;这是产品提供的完整顶层拆分。更深层的键(如或下的键)可通过常规JSONPath继续扩展。
bodycustommessage| 子分类 | JSONPath前缀 | 说明 |
|---|---|---|
| body | | 你发布的负载;追加 |
| meta | | 消息元数据对象;可按需扩展嵌套键。 |
| userId | | 发布者UUID(标量路径)。 |
| channel | | 消息所属的频道名称(标量路径)。 |
channel| 子分类 | JSONPath前缀 |
|---|---|
| name | |
| type | |
| status | |
| custom | |
user| 子分类 | JSONPath前缀 |
|---|---|
| externalId | |
| type | |
| status | |
| custom | |
membership| 子分类 | JSONPath前缀 |
|---|---|
| status | |
| custom | |
子分类之后:添加嵌套或自定义属性的剩余路径(如、、)。如果路径与实际结构不匹配,使用原始行快照(无转换的)确认。
$.message.body.data.score$.channel.custom.lastSentMessageUnixTime$.membership.custom.lastReadUnixTimequeries/executeFive Resource Types in Dependency Order
按依赖顺序排列的五种资源类型
| Resource | Depends on | Owns |
|---|---|---|
| Business Object | nothing | schema (fields extracted from messages) |
| Metric | a Business Object | aggregation over a time window |
| Query | a Business Object | flexible pipeline (alternative to Metric) |
| Decision | a Metric, BO, or Query | conditions + actions |
| Dashboard | Metrics (and optionally Decisions for overlays) | visualization |
Cascade delete behavior: deleting a parent cascades to dependent analytics resources. Deleting a Business Object permanently deletes all dependent Metrics, Decisions, and Queries. Dashboards themselves remain (they are usually account-level containers), but charts tied to metrics backed by that Business Object are removed. Confirm before destructive operations.
| 资源 | 依赖对象 | 包含内容 |
|---|---|---|
| Business Object | 无 | 数据模型(从消息中提取的字段) |
| Metric | 一个Business Object | 时间窗口内的聚合结果 |
| Query | 一个Business Object | 灵活流水线(Metric的替代方案) |
| Decision | 一个Metric、BO或Query | 条件+动作 |
| Dashboard | Metrics(可叠加Decisions) | 可视化内容 |
级联删除规则:删除父资源会级联删除依赖的分析资源。删除Business Object会永久删除所有依赖的Metrics、Decisions和Queries。Dashboards本身会保留(它们通常是账户级容器),但与该Business Object关联的Metric所对应的图表会被移除。执行破坏性操作前请确认。
The Critical Decision Gotchas
Decision的关键注意事项
These will save days of debugging. They are documented in detail in references/decisions-4-step-workflow.md:
- and
activeFromare required on every Decision POST (the API documents them as optional but returns a 500 if you omit them).activeUntil - and
hitType: "SINGLE"are also required.executeOnce: false - must be manually constructed in the POST body — they are not auto-populated from the Metric or Query.
inputFields - The 4-step workflow is mandatory: POST with and
rules: [], READ auto-generated IDs, PUT with rules, PUT to enable.enabled: false - is not valid despite appearing in some docs. Use
executionLimitType: "ONCE_PER_INTERVAL_PER_CONDITION".ONCE_PER_INTERVAL_PER_CONDITION_GROUP - BUSINESSOBJECT decisions need both and
sourceIdset to the same BO ID.businessObjectId - For BUSINESSOBJECT decisions, omit entirely (don't send
executionFrequency).null
这些要点可节省大量调试时间,详情记录在references/decisions-4-step-workflow.md中:
- 每个Decision的POST请求必须包含和
activeFrom(API文档标注为可选,但省略会返回500错误)。activeUntil - 同时必须设置和
hitType: "SINGLE"。executeOnce: false - 必须在POST请求体中手动构建 — 不会从Metric或Query自动填充。
inputFields - 必须遵循四步工作流:发送且
rules: []的POST请求,读取自动生成的ID,发送含rules的PUT请求,发送启用的PUT请求。enabled: false - 是无效的,尽管部分文档中出现该值,请使用
executionLimitType: "ONCE_PER_INTERVAL_PER_CONDITION"。ONCE_PER_INTERVAL_PER_CONDITION_GROUP - BUSINESSOBJECT类型的Decision需要同时将和
sourceId设置为同一个BO的ID。businessObjectId - 对于BUSINESSOBJECT类型的Decision,完全省略(不要传
executionFrequency)。null
Constraints
约束条件
- The Illuminate add-on must be enabled on the keyset; the Service Integration API key is separate from your subscribe/publish/secret keys.
- All JSONPath in Business Objects starts with
$.message.body. - Maximum 100 fields per Business Object; max 5 fields per BO
TEXT_LONG - Evaluation windows for Metrics: only seconds
60, 300, 600, 900, 1800, 3600, 86400 - Account limits: 3 METRIC decisions per account, ~10–11 QUERY decisions, ~10 saved Queries (no enforced limit on BUSINESSOBJECT decisions)
- Cannot modify Business Object fields while — set inactive first
isActive: true - Cannot update a Metric while a referencing Decision is enabled — disable the Decision first
- Decisions are immutable for structural fields (,
inputFields,outputFields) while enabled — setactionsfirstenabled: false - Active resource updates use full-replacement PUT — always send the complete body
- All cascade deletes are permanent; require explicit user confirmation before any
DELETE
- 必须在密钥集上启用Illuminate附加组件;服务集成API密钥与你的订阅/发布/密钥是分开的。
- Business Object中的所有JSONPath均以开头
$.message.body. - 每个Business Object最多包含100个字段;每个BO最多包含5个字段
TEXT_LONG - Metric的评估窗口仅支持秒
60, 300, 600, 900, 1800, 3600, 86400 - 账户限制:每个账户最多3个METRIC类型的Decision,约10-11个QUERY类型的Decision,约10个已保存的Query(BUSINESSOBJECT类型的Decision无强制限制)
- 当时无法修改Business Object字段 — 需先设置为非激活状态
isActive: true - 当有引用它的Decision处于启用状态时,无法更新Metric — 需先禁用该Decision
- Decision处于启用状态时,结构字段(、
inputFields、outputFields)不可变 — 需先设置actionsenabled: false - 激活资源更新使用全量替换式PUT — 始终发送完整请求体
- 所有级联删除都是永久的;执行任何操作前需获得用户明确确认
DELETE
MCP Tools
MCP工具
When this skill is active, prefer:
- — create, read, update, delete all five resource types (Business Objects, Metrics, Decisions, Queries, Dashboards). Handles the auth header injection.
manage_illuminate
For runtime testing of message data flowing into Business Objects, use:
- — publish test data
send_pubnub_message - — confirm test publishes are flowing
subscribe_and_receive_pubnub_messages
激活该技能时,优先使用:
- — 创建、读取、更新、删除所有五种资源类型(Business Objects、Metrics、Decisions、Queries、Dashboards)。自动处理授权头注入。
manage_illuminate
要实时测试流入Business Objects的消息数据,可使用:
- — 发布测试数据
send_pubnub_message - — 确认测试发布的消息已流入
subscribe_and_receive_pubnub_messages
See Also
另请参阅
- pubnub-keyset-management — for API key storage and rotation, environment separation (one Service Integration per environment)
- pubnub-app-context — Decision actions can target users, channels, and memberships via ,
APPCONTEXT_SET_USER_METADATA,APPCONTEXT_SET_CHANNEL_METADATAAPPCONTEXT_SET_MEMBERSHIP_METADATA - pubnub-app-developer — actions publish messages to a channel
PUBNUB_PUBLISH - pubnub-events-and-actions — for event-driven integrations to external systems (alternative to webhooks-from-Decisions when no threshold logic is needed)
- pubnub-functions — for per-message edge logic (alternative to Decision actions when message-level transformation is needed)
- pubnub-choose-docs-path — for routing other PubNub questions
- pubnub-keyset-management — 了解API密钥存储与轮换、环境隔离(每个环境对应一个服务集成)
- pubnub-app-context — Decision动作可通过、
APPCONTEXT_SET_USER_METADATA、APPCONTEXT_SET_CHANNEL_METADATA针对用户、频道和成员关系APPCONTEXT_SET_MEMBERSHIP_METADATA - pubnub-app-developer — 动作可向频道发布消息
PUBNUB_PUBLISH - pubnub-events-and-actions — 用于与外部系统的事件驱动集成(当无需阈值逻辑时,可替代Decision的Webhook)
- pubnub-functions — 用于单条消息的边缘逻辑(当需要消息级转换时,可替代Decision动作)
- pubnub-choose-docs-path — 用于路由其他PubNub相关问题
Output Format
输出格式
When providing implementations:
- Always state the resource type and its dependencies up front (e.g., "this is a Decision on a COUNT Metric").
- Show the full HTTP request including both required headers.
- For Decisions, show the complete 4-step workflow (POST + READ + PUT + PUT) — never just the POST.
- Capture all required Decision fields (,
activeFrom,activeUntil,hitType) even when the user didn't ask.executeOnce - Note cascade-delete consequences before any DELETE example.
- Include account limits if the operation could hit them.
提供实现方案时:
- 始终先说明资源类型及其依赖(例如:"这是一个基于COUNT Metric的Decision")。
- 展示包含两个必填请求头的完整HTTP请求。
- 对于Decision,展示完整的四步工作流(POST+READ+PUT+PUT) — 不要只展示POST请求。
- 即使用户未要求,也要包含所有必填的Decision字段(、
activeFrom、activeUntil、hitType)。executeOnce - 在任何DELETE示例前说明级联删除的后果。
- 如果操作可能触及账户限制,请注明相关限制。",