Despia Setup
Configure the native shortcut in your Despia project:
- Navigate to Add-ons → Hard Coded → Quick Actions
- Click Add New to create a shortcut
- Name your shortcut (e.g., “Don’t Leave”, “Track Macros”, “Scan Invoice”)
- Select an icon that represents the action
- Leave the Quick Link field empty (some apps need a redirect URL)
-
In the JavaScript editor, call your defined window function inside the commented section:
- Save your changes
- Go to Publish App → Rebuild iOS App (shortcuts are native components, so rebuilding is required)
Note: Replace
dontLeave with your chosen function name. You can create multiple shortcuts by repeating this process.Lovable Prompt
Define a Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.Customize the prompt:
window.{WORKFLOW-NAME} function globally that if called shows a popup asking the user to provide feedback.The function
window.{WORKFLOW-NAME}() (your custom function name) will be invoked by the Despia Native Runtime when the user taps the shortcut and does NOT need to be explicitly called from your Web App Code. Simply define it globally on the window object, and Despia will automatically call it when the corresponding shortcut is activated.- Replace
{WORKFLOW-NAME}with your function name (must match what you defined in Despia) - Replace the action description with your desired behavior:
- “opens the macro tracking form” for
window.trackMacros - “opens the camera to scan an invoice” for
window.scanInvoice - “displays a reward popup offering 15 free coins” for
window.unlockCoins
- “opens the macro tracking form” for
window.functionName() you’ve defined. No manual function calls are needed - simply define the global function and Despia handles the rest.
Installation
No NPM package installation required for this feature. Shortcuts work by defining global window functions that Despia’s native runtime calls automatically.Usage
1. Define the Global Function
In your Lovable app, define a global window function:2. Configure in Despia Editor
In the Despia Quick Actions JavaScript editor, define the code to call the function:3. Expected Behavior
When the user taps the shortcut:window.{WORKFLOW-NAME} (your custom function name) will be invoked by the Despia Native Runtime when the user taps the shortcut and does not need to be explicitly called from your Web App Code. Simply define it globally on the window object, and Despia will automatically call it when the corresponding shortcut is activated.
Resources
- NPM Package
- View full NPM documentation for additional configuration options