Skip to content

feat(session): add ?autoVoice=1 deep-link param to auto-start realtime voice#1412

Open
averymkeller83-hub wants to merge 1 commit into
slopus:mainfrom
averymkeller83-hub:autovoice-deeplink-param
Open

feat(session): add ?autoVoice=1 deep-link param to auto-start realtime voice#1412
averymkeller83-hub wants to merge 1 commit into
slopus:mainfrom
averymkeller83-hub:autovoice-deeplink-param

Conversation

@averymkeller83-hub

Copy link
Copy Markdown

Summary

Adds an opt-in ?autoVoice=1 query param to the session route so external automations can open a session and start the realtime voice assistant in a single step.

Before this PR: a deep-link can land you on session/<id>, but the voice session still requires a manual mic tap.
After: happy://session/<id>?autoVoice=1 (or the universal-link equivalent) lands you straight into voice mode.

Why

This unlocks a class of integrations that were previously two-tap:

  • Siri Shortcuts → "Hey Siri, ask Happy about X"
  • Push notifications that should resume voice (e.g. follow-up tap)
  • Custom URL schemes from other apps / OS automations

The param is opt-in: existing links and the in-app session opener behave exactly as before.

Implementation

  • session/[id].tsx: switch from @react-navigation/native's useRoute to expo-router's useLocalSearchParams so we can read both the path param (id) and the query string (autoVoice). Per the project CLAUDE.md ("Always use expo-router api, not react-navigation one"), this also brings this route in line with the rest of the codebase.
  • SessionView.tsx: thread an optional autoVoice?: boolean prop through SessionViewSessionViewLoaded.
  • One small useEffect in SessionViewLoaded, gated by a useRef, fires handleMicrophonePress() exactly once on mount and only when realtimeStatus === 'disconnected' — so it never racing-stacks against an already-connecting/connected session.

Accepts autoVoice=1 and autoVoice=true; everything else (including absent) is a no-op.

Test plan

  • pnpm typecheck clean
  • Manual: open happy://session/<id>?autoVoice=1 from Siri Shortcut → voice connects without tapping the mic
  • Manual: open https://app.happy.engineering/session/<id>?autoVoice=1 on web → same
  • Manual: open happy://session/<id> (no param) → unchanged behavior, no auto-mic
  • Manual: deep-link in while a session is already voice-active → does not re-trigger

🧙 Built with WOZCODE

Lets external automations (Siri Shortcuts, push notifications, custom URL
schemes, etc.) open a session and start the realtime voice assistant in
one step instead of requiring a manual mic tap.

- Switch session/[id] route to expo-router's useLocalSearchParams so
  query-string params can be read alongside the path param.
- Thread an autoVoice prop through SessionView -> SessionViewLoaded.
- When the prop is true and the realtime layer is idle, fire the
  existing handleMicrophonePress() exactly once on mount.

Usage:
  happy://session/<sessionId>?autoVoice=1
  https://app.happy.engineering/session/<sessionId>?autoVoice=1
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