Manage PubNub Illuminate
manage_illuminateManage PubNub Illuminate resources: create, update, delete Business Objects, Metrics, Queries, Decisions, and Dashboards, plus activate, deactivate, and test with fake data.
Instructions
Manages PubNub Illuminate resources with operations: list, get, create, update, delete, activate, deactivate, get-fields, execute-adhoc, publish-fake-data, verify-query, check-action-log, raw-snapshot, aggregate, field-health, and custom-query.
Supports full CRUD for: Business Objects, Metrics, Queries, Decisions, and Dashboards.
**Operations:**
- list: GET all resources of a given type
- get: GET one resource by id
- create: POST a new resource (Decisions use automatic 2-step POST→PUT workflow)
- update: PUT/replace a resource
- delete: DELETE a resource (Business Object delete cascades to all associated resources)
- activate / deactivate: toggle isActive (Business Object) or enabled (Decision)
- get-fields: fetch Query output field definitions (required before building a Query Decision)
- execute-adhoc: run a one-off Query pipeline without saving it
- publish-fake-data: generate type-aware fake PubNub messages and publish them to test Decisions. Fetches BO field schema and produces realistic values per field type. Payloads are NESTED to match each field's JSONPath (e.g. `$.message.body.application.user_id` produces `{ application: { user_id: ... } }`, not the flat key `"application.user_id"`), so JSONPath resolution works against nested BO schemas. Pass secret_key when the keyset has Access Manager enabled — initializing with the secret key grants root permissions and bypasses 403 errors. Alternatively pass auth_key with a token from grantToken(). Failures are reported per-message; partial publishes return success with a 'failures' array. NOTE: Illuminate ingests with a 20–30 second delay — wait before querying after publish.
- verify-query: execute a saved Query by id and return results (confirms data is flowing)
- check-action-log: fetch recent Decision action log entries to verify a Decision fired
- raw-snapshot: return the most recent rows from a Business Object via ad-hoc query
- aggregate: group and count BO data by user/channel or custom group_by fields
- field-health: check which BO fields are populated vs empty (reveals JSONPath mismatches)
- custom-query: run a fully custom ad-hoc pipeline
**ID Dependency Chain — always capture before proceeding:**
Business Object → id, fields[*].id
Metric → id, measureId, dimensionIds
Query → id, then call get-fields for output field IDs
Decision → id, inputFields[*].id, outputFields[*].id, actions[*].id
Dashboard → id, charts[*].id
**Critical Decision rules:**
hitType ('SINGLE'|'MATCH_ALL') and executeOnce (boolean) are required — omitting causes HTTP 500.
Handler auto-injects safe defaults (hitType=SINGLE, executeOnce=false, activeFrom=now, activeUntil=now+2yr).
The 2-step create workflow resolves field/action names → UUIDs in: action templates
(both output variable names AND input field names — input names are sentinel-substituted
pre-POST and restored post-POST), inputValues.inputFieldId, outputValues.outputFieldId,
outputValues.value (dollar-brace), actionValues.actionId, and
actionValues.executionLimitInputFieldIds. Use names everywhere.
If the PUT step fails the handler deletes the orphaned scaffold automatically.
**CRITICAL — QUERY decision input field naming:**
For sourceType=QUERY decisions, each inputField.name MUST exactly match the source
query's output field alias (case-sensitive, including underscores). Illuminate binds
query result rows to decision inputs by NAME — not by sourceId. If names don't match,
the decision will be created and activated successfully but will silently NEVER fire
even with valid data. Always run get-fields on the source query first and copy the
'field' values verbatim into your decision's inputFields[].name.
**Business Object limits (handler pre-flights and rejects on violation):**
- name: 1-100 characters
- fields[].name: 1-50 characters
- max 100 fields per BO
- **max 5 TEXT_LONG fields per BO** (use TEXT, which holds 256 chars, for shorter strings)
- keep `description` concise — overly long descriptions are rejected with HTTP 400 by the API
**Decision action default:**
When the user doesn't specify what action to fire, default to actionType='PUBNUB_PUBLISH'
with a message body that includes the relevant input/output values via dollar-brace
template references. PUBNUB_PUBLISH requires no external infrastructure and is trivially
verifiable via check-action-log or by subscribing to the target channel. Only use WEBHOOK
when the user has provided a specific URL.
NEVER delete without explicit user confirmation.
TOOL SELECTION GUIDE — Illuminate Claude Behavior:
1. Intent-first: Always start from the user's desired outcome. Ask what they want
to achieve before suggesting Business Objects, Metrics, or Decisions.
2. Preview-first: Before creating any resources, describe automation in 1-2 sentences
and show a conditions → actions decision table. Ask for confirmation before building.
3. Predefined templates: For spam (flooding/cross-posting) and ranking (Top N/Bottom N),
use the Query Builder predefined templates. Never recreate these from scratch.
4. Built-in BO fields: For chat/moderation/ranking, User/Channel/Message/Message Type
are auto-created. Never ask users to define them.
5. Start simple: Minimal decision for the core goal; add complexity only when requested.
6. PubNub extension: For delayed checks, scheduling, or orchestration beyond Illuminate,
suggest PubNub Functions or pub/sub as the first extension path.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource | No | The Illuminate resource type to operate on. business-object: the data schema that maps JSONPath fields from PubNub messages. metric: aggregations (COUNT, SUM, AVG, MIN, MAX) over a Business Object field. query: flexible data pipeline (sources → transforms → output). decision: automation rule that evaluates conditions and fires actions. dashboard: visualisation of metrics with optional decision trigger overlay. | |
| operation | Yes | Operation to perform. list: GET all resources of this type. get: GET one resource by id. create: POST a new resource. Decision create runs a 2-step POST→PUT workflow automatically. update: PUT/replace a resource (decisions and dashboards are FULL replacements). delete: DELETE a resource by id (Business Object deletes cascade to all associated resources). activate: set isActive=true (business-object) or enabled=true (decision). deactivate: set isActive=false (business-object) or enabled=false (decision). get-fields: (query only) fetch output field definitions required to build QUERY decision inputFields. execute-adhoc: (query only) run a one-off pipeline without saving it. publish-fake-data: generate type-aware fake PubNub messages and publish them to test Decisions. Fetches BO field schema and produces realistic values per field type. Generated payloads are properly NESTED to match each field's JSONPath — e.g. a field with jsonPath '$.message.body.application.user_id' produces { application: { user_id: ... } }, not the flat key 'application.user_id'. This guarantees JSONPath resolution works against nested BO schemas. NOTE: Illuminate ingests with a 20–30 second delay — wait before querying after publish. verify-query: execute a saved Query by id and return results (confirms data is flowing). check-action-log: fetch recent Decision action log entries to verify a Decision fired. raw-snapshot: return the most recent rows from a Business Object via ad-hoc query. aggregate: group and count BO data by user/channel or custom group_by fields. field-health: check which BO fields are populated vs empty — reveals JSONPath mismatches. custom-query: run a fully custom ad-hoc pipeline supplied in the pipeline argument. | |
| id | No | Resource UUID. Required for: get, update, delete, activate, deactivate, get-fields, execute-adhoc. | |
| data | No | Request body for create, update, and execute-adhoc. BUSINESS OBJECT: create with isActive=false. Include 'subkeys' array with at least one subscribe key (sub-c-...). jsonPath fields must start with '$.message.body.'. Supported jsonFieldType: TEXT, TEXT_LONG, NUMERIC, TIMESTAMP, BOOLEAN. BO LIMITS (handler pre-flights and rejects on violation): name 1-100 chars, fields[].name 1-50 chars, max 100 fields per BO, MAX 5 TEXT_LONG fields per BO. Use TEXT (256 chars) for fields under 256 characters; reserve TEXT_LONG (1000 chars) for the longest free-text fields only. Keep `description` concise — overly long descriptions are rejected with HTTP 400 by the Illuminate API. Deactivate before editing measures/dimensions. METRIC: COUNT → set function='COUNT', omit measureId entirely. SUM/AVG/MIN/MAX → set function and measureId to a NUMERIC field ID. QUERY execute-adhoc: { version: '2.0', pipeline: { sources: [...], output: {...} } }. CRITICAL: version must be the string '2.0' — omitting causes 400. DECISION — the 2-step create workflow auto-resolves names → UUIDs in: (1) action template strings (e.g. body, channel) using dollar-brace syntax — you may reference output `variable` names (handled natively by the API) AND input field names (handler substitutes a sentinel pre-POST and swaps to ${UUID} post-POST), (2) rules[].inputValues[].inputFieldId, (3) rules[].outputValues[].outputFieldId, (4) rules[].outputValues[].value (dollar-brace syntax, references input or output field names), (5) rules[].actionValues[].actionId, and (6) rules[].actionValues[].executionLimitInputFieldIds (array of input-field names). Use inputField/outputField/action names everywhere — raw UUIDs are passed through unchanged. If the rule-install PUT fails, the handler automatically deletes the orphaned scaffold. Required fields (missing hitType or executeOnce causes HTTP 500): hitType: 'SINGLE' or 'MATCH_ALL'. executeOnce: true or false. activeFrom: ISO datetime e.g. '2026-01-01T00:00:00Z'. activeUntil: ISO datetime (handler defaults to now + 2 years if absent). Handler auto-injects these defaults if absent. BUSINESSOBJECT decision: set sourceId = businessObjectId at top level; inputFields.sourceType = 'FIELD'. METRIC COUNT: inputFields.sourceType = 'BUSINESSOBJECT' (count) or 'DIMENSION' (grouped). METRIC SUM/AVG/MIN/MAX: inputFields.sourceType = 'MEASURE' (value) or 'DIMENSION' (grouped). QUERY decision: inputFields.sourceType = 'QUERYFIELD'; get sourceIds from get-fields first. CRITICAL: each inputField.name MUST exactly match the source query's output field alias (case-sensitive). Illuminate binds query rows to decision inputs by NAME, not by sourceId. If names don't match, the decision will silently never fire even though the rule conditions are met. Fetch field names via get-fields and use them verbatim. Rules: every inputValues array must cover ALL inputFields (use operation='ANY' for unconstrained fields). Actions: use 'actionType' (not 'type'). OutputFields: use 'variable' and 'name' (no 'type'). ACTION DEFAULT: when the user doesn't specify what action to fire, default to actionType='PUBNUB_PUBLISH' with a message body that includes the relevant input/output values via dollar-brace template references. PUBNUB_PUBLISH requires no external infrastructure and is trivially verifiable via check-action-log or by subscribing to the target channel. Only use WEBHOOK when the user has provided a specific URL. Account limits: METRIC decisions max 3/account; saved queries ~10/account. DASHBOARD charts: use metric: { id: '<metricId>' } — NOT metricId directly. PUT is FULL replacement for charts array — always include all existing charts when updating. | |
| subscribe_key | No | PubNub subscribe key (sub-c-...). Required for business-object activate and publish-fake-data. Obtain via manage_keysets with operation list. | |
| publish_key | No | PubNub publish key (pub-c-...). Required for publish-fake-data. Obtain via manage_keysets with operation list. | |
| secret_key | No | PubNub secret key (sec-c-...). Optional for publish-fake-data. Use this when the keyset has Access Manager enabled — initializing the SDK with the secret key grants the publisher root permissions and bypasses 403 errors. Never expose secret keys to client devices. | |
| auth_key | No | PubNub Access Manager v3 grant token (authKey). Optional for publish-fake-data. Use this when the keyset has Access Manager enabled and you have a token issued via grantToken() that allows publishing on the test channels. Prefer secret_key for backend test harnesses unless you specifically need a scoped grant. | |
| bo_id | No | Business Object UUID. Required for: publish-fake-data, raw-snapshot, aggregate, field-health. | |
| query_id | No | Saved query UUID. Required for verify-query. | |
| decision_id | No | Decision UUID. Required for check-action-log. | |
| scenario | No | Fake-data scenario for publish-fake-data. generic: random users and channels (default). chat-flooding: many messages from one user on one channel — triggers message_count > N rules. cross-posting: same user posting to many channels — triggers channel_count > N rules. | |
| count | No | Number of fake messages to publish (1–50). Defaults to 5. | |
| user_id | No | Specific user ID to use for chat-flooding and cross-posting scenarios. | |
| channel | No | Specific channel for generic/chat-flooding publish. | |
| limit | No | Max rows to return for raw-snapshot, aggregate, field-health (1–500). Defaults to 50. | |
| group_by | No | Field names to group by for the aggregate operation (e.g. ['userId', 'channel']). Defaults to the first two TEXT fields found in the Business Object. | |
| pipeline | No | Full pipeline body for custom-query. Must include version='2.0': { version: '2.0', pipeline: { sources: [...], output: {...} } }. CRITICAL: version must be the string '2.0' — omitting it returns 400. |