Repository navigation
fix: restore notification API backwards compatibility - #4747
Conversation
PR #4605 broke existing apps by requiring chat_messages.enabled in manifest and gating the push notification behind chat_messages.notify. Apps without chat_messages in their manifest got a 403 error. Restore original behavior: always send push notification. The chat_messages manifest config now only controls whether the message is additionally stored in chat. Co-Authored-By: Claude Opus 4.6 <[email protected]>
send_app_notification now accepts a target parameter so apps using
target='main' navigate to /chat/omi (main chat) instead of always
navigating to /chat/{app_id}. Default is 'app' so existing callers
are unaffected.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request aims to restore backwards compatibility for the notification API, which was broken in a previous change. The fix correctly ensures that notifications are always sent, regardless of the chat_messages manifest configuration, and that this configuration only controls whether the message is also stored in chat. The change to send_app_notification to respect the target parameter for deep links is also a good improvement. However, I've found a critical issue where the target parameter is not being passed correctly, which would cause incorrect navigation for notifications. I've provided a suggestion to fix this.
| # Always send push notification | ||
| send_app_notification(uid, app.name, app.id, data['message']) | ||
|
|
||
| # If app has chat_messages enabled in manifest, also store the message in chat | ||
| if app.external_integration and app.external_integration.chat_messages_enabled: | ||
| target = app.external_integration.chat_messages_target | ||
| chat_app_id = None if target == 'main' else app.id | ||
| add_app_message(data['message'], chat_app_id, uid) |
There was a problem hiding this comment.
The send_app_notification function is called without the target parameter. This means it will always use the default value 'app', causing the notification's navigate_to deep link to be incorrect for apps that configure target: 'main' in their manifest. According to the PR description, the target should control the navigation link.
To fix this, you should determine the target before sending the notification and pass it to send_app_notification. This ensures the deep link is correct, and you can reuse the target variable for storing the message in chat if needed. The suggested change refactors the logic to be more concise and correct.
| # Always send push notification | |
| send_app_notification(uid, app.name, app.id, data['message']) | |
| # If app has chat_messages enabled in manifest, also store the message in chat | |
| if app.external_integration and app.external_integration.chat_messages_enabled: | |
| target = app.external_integration.chat_messages_target | |
| chat_app_id = None if target == 'main' else app.id | |
| add_app_message(data['message'], chat_app_id, uid) | |
| # Determine if message should be stored in chat and get target. | |
| store_in_chat = app.external_integration and app.external_integration.chat_messages_enabled | |
| target = app.external_integration.chat_messages_target if store_in_chat else 'app' | |
| # Always send push notification, respecting the target for navigation. | |
| send_app_notification(uid, app.name, app.id, data['message'], target=target) | |
| # If enabled, also store the message in chat. | |
| if store_in_chat: | |
| chat_app_id = None if target == 'main' else app.id | |
| add_app_message(data['message'], chat_app_id, uid) |
## Summary - Follow-up to #4747 — `send_app_notification` was called without the `target` parameter, so apps with `target: "main"` in their manifest still got `navigate_to='/chat/{app_id}'` instead of `'/chat/omi'` - Determines `target` from manifest before sending the notification so the deep link matches where the message is stored ## Test plan - [ ] App with `target: "main"` — notification click opens main chat - [ ] App with `target: "app"` or no manifest — notification click opens app chat (unchanged) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…4747) ## Summary - PR BasedHardware#4605 broke existing apps by requiring `chat_messages.enabled` in manifest — apps without it got a 403 error instead of sending the notification - Restores original behavior: push notification is always sent regardless of manifest config - `chat_messages` manifest config now only controls whether the message is **additionally stored** in chat (main or app chat based on `target`) - `send_app_notification` now respects `target` parameter for `navigate_to` deep link — apps using `target: "main"` navigate to `/chat/omi` instead of `/chat/{app_id}` ## Test plan - [ ] Existing apps without `chat_messages` in manifest can still send notifications (no 403) - [ ] Apps with `chat_messages.enabled: true, target: "main"` store message in main chat and notification navigates to main chat - [ ] Apps with `chat_messages.enabled: true, target: "app"` store message in app chat and notification navigates to app chat - [ ] Apps without `chat_messages` in manifest only send notification, no message stored in chat 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…dHardware#4748) ## Summary - Follow-up to BasedHardware#4747 — `send_app_notification` was called without the `target` parameter, so apps with `target: "main"` in their manifest still got `navigate_to='/chat/{app_id}'` instead of `'/chat/omi'` - Determines `target` from manifest before sending the notification so the deep link matches where the message is stored ## Test plan - [ ] App with `target: "main"` — notification click opens main chat - [ ] App with `target: "app"` or no manifest — notification click opens app chat (unchanged) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…4747) ## Summary - PR BasedHardware#4605 broke existing apps by requiring `chat_messages.enabled` in manifest — apps without it got a 403 error instead of sending the notification - Restores original behavior: push notification is always sent regardless of manifest config - `chat_messages` manifest config now only controls whether the message is **additionally stored** in chat (main or app chat based on `target`) - `send_app_notification` now respects `target` parameter for `navigate_to` deep link — apps using `target: "main"` navigate to `/chat/omi` instead of `/chat/{app_id}` ## Test plan - [ ] Existing apps without `chat_messages` in manifest can still send notifications (no 403) - [ ] Apps with `chat_messages.enabled: true, target: "main"` store message in main chat and notification navigates to main chat - [ ] Apps with `chat_messages.enabled: true, target: "app"` store message in app chat and notification navigates to app chat - [ ] Apps without `chat_messages` in manifest only send notification, no message stored in chat 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…dHardware#4748) ## Summary - Follow-up to BasedHardware#4747 — `send_app_notification` was called without the `target` parameter, so apps with `target: "main"` in their manifest still got `navigate_to='/chat/{app_id}'` instead of `'/chat/omi'` - Determines `target` from manifest before sending the notification so the deep link matches where the message is stored ## Test plan - [ ] App with `target: "main"` — notification click opens main chat - [ ] App with `target: "app"` or no manifest — notification click opens app chat (unchanged) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
chat_messages.enabledin manifest — apps without it got a 403 error instead of sending the notificationchat_messagesmanifest config now only controls whether the message is additionally stored in chat (main or app chat based ontarget)send_app_notificationnow respectstargetparameter fornavigate_todeep link — apps usingtarget: "main"navigate to/chat/omiinstead of/chat/{app_id}Test plan
chat_messagesin manifest can still send notifications (no 403)chat_messages.enabled: true, target: "main"store message in main chat and notification navigates to main chatchat_messages.enabled: true, target: "app"store message in app chat and notification navigates to app chatchat_messagesin manifest only send notification, no message stored in chat🤖 Generated with Claude Code