Skip to content

[DX-725] Add extras in the message for channel push notifications#134

Merged
maratal merged 1 commit intomainfrom
channel-push-support
Mar 4, 2026
Merged

[DX-725] Add extras in the message for channel push notifications#134
maratal merged 1 commit intomainfrom
channel-push-support

Conversation

@maratal
Copy link
Contributor

@maratal maratal commented Feb 10, 2026

It is not support of push notifications with deviceId or clientId. Just have added extras.push support 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 data vs extras.

Overview
ably channels publish now supports publishing messages with extras (notably extras.push for push notification metadata) when provided in the JSON payload, and avoids duplicating extras inside data.

Message preparation also skips setting data when the JSON payload contains only extras/name (i.e., no data and nothing else), and the test suite adds coverage for extras+data, extras-only, and name+extras scenarios.

Written by Cursor Bugbot for commit d3575be. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • Added support for including push notification metadata (extras.push) in Ably channel message publish payloads, enabling push notification data to be transmitted alongside messages.
  • Documentation

    • Updated product requirements documentation to reflect the new push notification metadata publishing capability.
  • Tests

    • Added test coverage to verify push notification metadata is correctly passed through the publish flow.

@vercel
Copy link

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli-web-cli Ready Ready Preview, Comment Mar 3, 2026 9:56pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

Walkthrough

The 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

Cohort / File(s) Summary
Documentation
docs/Product-Requirements.md
Updated to document support for extras.push in the publish command payload for Ably channels.
Implementation
src/commands/channels/publish.ts
Added logic to extract extras from message data and assign to Ably.Message.extras, preventing duplication in the data payload. Includes CLI example demonstrating extras.push usage.
Tests
test/unit/commands/channels/publish.test.ts
Added test block verifying extras.push is correctly passed through to the channel.publish call with data integrity maintained.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A flutter through extras we go,
Push notifications now steal the show,
Separated from data with care and grace,
Message and extras each find their place! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title directly and concisely describes the main change: adding support for extras in messages for channel push notifications, which aligns with the PR's primary objective and the modifications across all three files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch channel-push-support

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@maratal maratal requested a review from AndyTWF February 10, 2026 13:59
@maratal maratal force-pushed the channel-push-support branch from 6a7494b to 207544c Compare February 17, 2026 13:44
@maratal maratal changed the title Add extras in the message for channel push notifications [DX-725] Add extras in the message for channel push notifications Feb 19, 2026
@sacOO7 sacOO7 requested a review from Copilot February 26, 2026 14:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 extras extraction logic to prepareMessage method 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.

Copy link
Contributor

@sacOO7 sacOO7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maratal can you also link JIRA ticket on the PR description, so it's easy to link underlying issue

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 data key and only attach extras when present as an object, preserving string data behavior and enabling extras.push.

Create PR

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;
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@sacOO7 sacOO7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@maratal
Copy link
Contributor Author

maratal commented Mar 4, 2026

@AndyTWF if you don't mind I'll merge.

@maratal maratal merged commit 36c21a6 into main Mar 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants