[DX-725] Add extras in the message for channel push notifications#134
[DX-725] Add extras in the message for channel push notifications#134
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe changes add support for including extras.push in the Ably channel publish command payload. Documentation is updated to reflect this capability, implementation extracts extras from messageData and assigns them to the message's extras field, and tests verify the extras.push content passes through correctly to the channel publish call. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6a7494b to
207544c
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds support for including push notification metadata via the extras.push field in channel messages published through the CLI. The implementation extracts the extras object from JSON message input and includes it as a top-level message property, following the same pattern used for the name field.
Changes:
- Added
extrasextraction logic toprepareMessagemethod in the publish command - Added unit test to verify extras.push is correctly forwarded in publish calls
- Updated documentation to reflect the new extras.push capability
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/commands/channels/publish.ts | Extracts extras from message JSON and assigns it to message object, removes it from messageData to avoid duplication. Adds example showing extras.push usage. |
| test/unit/commands/channels/publish.test.ts | Adds test case verifying that extras.push is correctly included when provided in message data |
| docs/Product-Requirements.md | Updates command description to mention support for extras.push in message payload |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Free Tier Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Condition requires object data, breaking string data handling
- I restored data extraction to trigger whenever a parsed object contains a
datakey and only attachextraswhen present as an object, preserving stringdatabehavior and enablingextras.push.
- I restored data extraction to trigger whenever a parsed object contains a
Or push these changes by commenting:
@cursor push d2e3dc7bd1
Preview (d2e3dc7bd1)
diff --git a/src/commands/channels/publish.ts b/src/commands/channels/publish.ts
--- a/src/commands/channels/publish.ts
+++ b/src/commands/channels/publish.ts
@@ -207,11 +207,16 @@
delete messageData.name;
}
- // If it's an object with data and extras, use them to construct the message
- if (messageData.data && typeof messageData.data === "object" &&
- messageData.extras && typeof messageData.extras === "object") {
+ // If data is explicitly provided in the message, use it
+ if (
+ messageData &&
+ typeof messageData === "object" &&
+ "data" in messageData
+ ) {
message.data = messageData.data;
- message.extras = messageData.extras;
+ if (messageData.extras && typeof messageData.extras === "object") {
+ message.extras = messageData.extras;
+ }
} else {
// Otherwise use the entire messageData as the data
message.data = messageData;a3ef173 to
dcbc096
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
dcbc096 to
9bd4071
Compare
9bd4071 to
f4bc58f
Compare
f4bc58f to
0e884cc
Compare
0e884cc to
d3575be
Compare
|
@AndyTWF if you don't mind I'll merge. |

It is not support of push notifications with deviceId or clientId. Just have added
extras.pushsupport for channel pushes. Tried locally with./bin/run.js channels publish exampleChannel1 '{"data":"Test","extras":{"push":{"notification":{"title":"Hello","body":"World!"}}}}' --api-key "***"and it works.
Jira issue: https://ably.atlassian.net/browse/DX-725
Note
Low Risk
Small, additive change to CLI message shaping plus unit tests; low risk aside from potential edge cases in how JSON input is mapped into
datavsextras.Overview
ably channels publishnow supports publishing messages withextras(notablyextras.pushfor push notification metadata) when provided in the JSON payload, and avoids duplicatingextrasinsidedata.Message preparation also skips setting
datawhen the JSON payload contains onlyextras/name(i.e., nodataand nothing else), and the test suite adds coverage forextras+data,extras-only, andname+extrasscenarios.Written by Cursor Bugbot for commit d3575be. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
New Features
Documentation
Tests