The video uses a specific AI coding tool to demonstrate the setup, but the configuration works 1:1 with Cursor, Claude Code, or any other tool. Despia is web framework and tooling agnostic, so the only thing that matters is the SDK call.
Siri Shortcuts is currently in beta. The SDK shape is stable but edge cases around HomePod and CarPlay invocation may change. Test on real iOS hardware before relying on this in production.
Installation
- Bundle
- CDN
How it works
Two pieces have to line up. First, define the function you want Siri to trigger as a global onwindow. Second, call addtosiri:// with the phrase the user will speak and the name of that global function. The native runtime registers the shortcut with Siri, and when the user later speaks the phrase, your app launches and calls the function.
jsFunction value must include the trailing parentheses, since the runtime executes it as a callable expression. The function itself must be globally accessible, attaching it to window is the simplest way to guarantee that across bundlers.
URL parameters
Theaddtosiri:// scheme takes two query parameters.
| Parameter | Value | Notes |
|---|---|---|
command | The natural language phrase the user will speak to Siri | Encode special characters with encodeURIComponent. Keep it short and distinctive, Siri matches phonetically, not semantically |
jsFunction | A global function name with trailing parens | Must exist on window before Siri triggers it. Include parentheses, e.g. orderCoffee(), not just orderCoffee |
Register a shortcut from a button
The typical pattern is a “Add to Siri” button in your settings or onboarding flow. The user taps it, the native shortcut registration sheet appears, and the shortcut is now live on their device.useEffect rather than in the component body, so it lands on window on mount and is available the next time Siri launches your app, even if the component is no longer rendered.
Pass arguments to the function
ThejsFunction value is executed as a literal expression, so you can hardcode arguments directly into it. This is useful when one shortcut should always do one specific thing.
Platform support
Siri Shortcuts work anywhere Siri itself is available, with the limit that some surfaces only run a subset of shortcut types. Custom JavaScript shortcuts launch your app to run the function, so they are best for surfaces where launching the app is acceptable.| Surface | Works |
|---|---|
| iPhone, iPad, iPod touch | Yes |
| Apple Watch (paired with iPhone) | Yes, opens iPhone app |
| HomePod (linked to user account) | Yes, opens iPhone app |
| CarPlay | Yes, for shortcuts that do not require complex UI |
| Mac (designed for iPad apps) | Yes |
isDespia guard keeps it safe in browsers, but you may also want to detect platform and hide the “Add to Siri” button on Android entirely.
Resources
NPM Package
despia-native