Skip to content

Add WhatsApp analytics and collector metrics commands - #66

Merged
purpshell merged 9 commits into
devfrom
codex/whatsapp-analytics
Oct 4, 2026
Merged

purpshell merged 9 commits into
devfrom
codex/whatsapp-analytics

Conversation

@purpshell

@purpshell purpshell commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Adds analytics get and analytics metrics for scoped WhatsApp business analytics. Customers can filter by project/number and RFC3339 range, inspect message/call vitals, retrieve complete JSON, or print Prometheus/OpenMetrics collector text and response metadata. Invalid ranges, windows and formats fail before transport; HTML upstream failures produce safe errors.

JSON preserves observed phone activity spans, quiet gaps, weighted averages and sample counts. These describe observed intervals, not device power state.

The CLI pins published SDK 0.1.0-dev.20261004011426, using its native analytics.get and analytics.metrics methods and shared aggregate types. This removes duplicated response models and local request construction. The SDK's complete contracts pin merged API revision 171a9683ff45d11a4b5d3917dc428ad2722b0d99 from API/Console #473, including Logs and Usage. This PR inherits Usage CLI #67.

Part Assessment
API Updated in merged #473: four public Analytics JSON/metrics reads, consented aggregates, scoped authorization and failure paths. The immutable source revision is recorded above.
SDKs Updated in merged SDK #330, inheriting Usage SDK #331. The exact published SDK version and registry integrity are pinned in package.json and package-lock.json.
CLI Updated Analytics commands, filters/defaults/help, human/JSON/collector output and safe response handling. Analytics now uses native published SDK methods. Client credentials cannot read Analytics; project credentials cannot widen their scope.
Docs Updated README with executable filter and collector examples and the pinned SDK version. Mintlify Analytics, collector, API and CLI guides are included in merged #473 and pass validation and anchor checks.
Feature releases CLI source changes are not a package release. API access requires sessions:read and live project authority; business data requires Console opt-in. No new flag or entitlement is introduced. API deployment and authenticated acceptance are separate gates.
Admin controls Covered by merged #473 through API-owned consent/coverage reads and reviewed drain forwarding controls. These read-only CLI commands add no saved setting or staff operation. Private Console drains remain outside CLI authority.

Validation: all 1,018 CLI tests across 107 files pass on Node 22 with three workers, including project-confined Analytics and collector HTTP requests, complete interval JSON, call vitals and safe HTML failures. Formatting, lint, typecheck, production build and package dry-run pass. The production dependency audit reports zero vulnerabilities. All eight SDK packages are confirmed in npm at the exact version, and the installed SDK lock integrity matches the registry.

SDK publication is verified separately from CLI publication. This PR does not publish the CLI or deploy the API.

Summary by CodeRabbit

  • New Features
    • Added analytics get to retrieve WhatsApp analytics for a selected time range or session.
    • Added analytics metrics to retrieve activity metrics in Prometheus or OpenMetrics format, with optional session and segment filters.
  • Documentation
    • Added guidance on analytics commands, access requirements, defaults, limits, and metric interpretation.
    • Updated the displayed SDK version and API contract hash.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 60e77659-7798-436d-bc53-5122fbc408e7
📥 Commits

Reviewing files that changed from the base of the PR and between 49c2671 and e1c4888.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • README.md
  • package.json
  • src/commands/analytics/get.ts
  • src/commands/analytics/metrics.ts
  • src/services/analytics.ts
  • test/commands/analytics.test.ts
 __________________________
< Grammarly for your code. >
 --------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@purpshell
purpshell changed the base branch from dev to t3code/limits-priorities October 4, 2026 00:14
@purpshell
purpshell changed the base branch from t3code/limits-priorities to dev October 4, 2026 01:04
@purpshell
purpshell merged commit 519868b into dev Oct 4, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant