notifications: emit Tapped DM Push Notification on tap#5871
notifications: emit Tapped DM Push Notification on tap#5871patosullivan wants to merge 6 commits into
Conversation
5f308ad to
1d0472b
Compare
1d0472b to
86f8cb3
Compare
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
@claude review once |
|
@claude review once |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c9debfea4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@claude review once |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38c953cbb5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Adds a
Tapped DM Push Notificationanalytics event so we can measure whether nudge notifications actually bring users back into the app. The event is emitted from the mobile notification tap handler and carries only the fields needed to join it, in PostHog, to the existing OpenClaw nudge-send event onmessageId. This gives us a send-to-tap funnel for nudges.Fixes TLON-5728
Companion PR in openclaw-tlon: tloncorp/openclaw-tlon#155
Changes
AnalyticsEvent.ActionTappedDmPushNotif = 'Tapped DM Push Notification'inpackages/api/src/types/analytics.ts.apps/tlon-mobile/src/lib/dmTapTelemetry.ts— pure helpers that read the raw notification payload, parse the activity event, and build the DM-tap telemetry (attribution-window math, sigil normalization, malformed-payload guards). The payload carries join/diagnostic fields only —ownerShip,senderShip,messageId,messageSentAtMs,delayMs,withinAttributionWindow,notificationUid,platform(no DM content).useNotificationListener.ts, keyed only on the notification response so it fires exactly once per tap and is fully decoupled from the routing effect (it cannot cause navigation to re-run). The owner ship is read synchronously viagetCurrentUserId()— the same already-initialized client identity the rest of the API layer uses — so there is no async hydration that could race the response-clearing and drop a cold-start tap. Best-effort: wrapped so a failure can never break navigation.pickPlatformPayload(now shared between the telemetry read andpayloadFromNotification),preSig, andgetCurrentUserIdfrom@tloncorp/api.uidfrom native into JS on iOS (NotificationService.swift) and Android (TalkMessagingService.kt,NotificationManager.kt). This is best-effort and diagnostic-only;notificationUidis nullable.dmTapTelemetryJest suite and a vitest round-trip canary (packages/shared/src/api/__tests__/dmTapTelemetryRoundTrip.test.ts).A paired PR in openclaw-tlon adds
messageIdandnudgeSentAtMsto theTlonBot Heartbeat Nudge Sentevent so the two events can be joined in PostHog.How did I test?
pnpm -r tscpasses.dmTapTelemetrysuite and the existinguseNotificationListenerhook suite (its routing effect is unchanged by this PR).Risks and impact
Rollback plan
Revert.
Screenshots / videos
N/A