Skip to content

Commit 0124328

Browse files
authored
Merge pull request #3310 from ably/DX-927-new-CLI-push-commands-
fix: update channel push CLI commands to use push publish --channel flag
2 parents 04a4fa7 + 511cb72 commit 0124328

5 files changed

Lines changed: 27 additions & 16 deletions

File tree

src/pages/docs/push/getting-started/apns.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ func unsubscribeFromChannel(_ channelName: String) {
276276

277277
Sending push notifications using `deviceId` or `clientId` requires the `push-admin` capability for your API key. Use this method for testing purposes. In a production environment, you would typically send push notifications from your backend server (by posting messages with `push` `extras` field to a channel).
278278

279-
To test push notifications in your app, you can use [Ably dashboard](https://ably.com/dashboard), [Apple developer dashboard](https://icloud.developer.apple.com/dashboard/) or Ably CLI.
279+
To test push notifications in your app, you can use [Ably dashboard](https://ably.com/dashboard), [Apple developer dashboard](https://icloud.developer.apple.com/dashboard/) or [Ably CLI](/docs/platform/tools/cli).
280280

281-
To send to your client ID using Ably CLI paste the following command into your terminal:
281+
To publish to your client ID using the [Ably CLI](/docs/platform/tools/cli) paste the following command into your terminal:
282282

283283
<Code>
284284
```shell
@@ -554,12 +554,14 @@ You can get your device ID from the device details button (don't confuse it with
554554

555555
### Send push via channel <a id="step-4-send-channel"/>
556556

557-
To test pushes via channel, subscribe to "Channel 1" in the UI and post a message to the "exampleChannel1"
558-
with a `push` `extras` field using Ably CLI:
557+
To test pushes via channel, subscribe to "Channel 1" in the UI and publish a push notification to the channel using the [Ably CLI](/docs/platform/tools/cli):
559558

560559
<Code>
561560
```shell
562-
ably channels publish exampleChannel1 '{"name":"example","data":"Hello from CLI!","extras":{"push":{"notification":{"title":"Ably CLI","body":"Hello from CLI!"},"data":{"foo":"bar"}}}}'
561+
ably push publish --channel exampleChannel1 \
562+
--title "Hello" \
563+
--body "World!" \
564+
--message '{"name":"greeting","data":"Hello World!"}'
563565
```
564566
</Code>
565567

@@ -989,5 +991,6 @@ Verify that your app receives and handles location push notifications correctly
989991
* Learn about [rules](/docs/channels#rules) for channel-based push notifications.
990992
* Read more about the [Push Admin API](/docs/api/realtime-sdk?lang=swift#push-admin).
991993
* Check out the [Push Notifications](/docs/push) documentation for advanced use cases.
994+
* Explore [Ably CLI push commands](/docs/cli/push) for the full list of push CLI options.
992995

993996
You can also explore the [Ably SDK for Swift](https://github.com/ably/ably-cocoa) on GitHub, or visit the [API references](/docs/api/realtime-sdk?lang=swift) for additional functionality.

src/pages/docs/push/getting-started/fcm.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ fun subscribeToRealtime(channelName: String) {
399399
Sending push notifications using `deviceId` or `clientId` requires the `push-admin` capability for your API key. Use this method for testing purposes. In a production environment, you would typically send push notifications from your backend server (by posting messages with `push` `extras` field to a channel).
400400
</Aside>
401401

402-
Now use the Ably CLI to test sending a push notification to your client ID:
402+
Now use the [Ably CLI](/docs/platform/tools/cli) to test publishing a push notification to your client ID:
403403

404404
<Code>
405405
```shell
@@ -660,11 +660,14 @@ Build and run your app on an Android device or emulator. Tap **Activate Push** a
660660

661661
### Send push via channel <a id="step-4-send-channel"/>
662662

663-
To test push notifications via channel, tap **Subscribe to Channel** in the app and then publish a message to "exampleChannel1" with a `push` `extras` field using Ably CLI:
663+
To test push notifications via channel, tap **Subscribe to Channel** in the app and then publish a push notification to the channel using the [Ably CLI](/docs/platform/tools/cli):
664664

665665
<Code>
666666
```shell
667-
ably channels publish exampleChannel1 '{"name":"example","data":"Hello from CLI!","extras":{"push":{"notification":{"title":"Ably CLI","body":"Hello from CLI!"},"data":{"foo":"bar"}}}}'
667+
ably push publish --channel exampleChannel1 \
668+
--title "Hello" \
669+
--body "World!" \
670+
--message '{"name":"greeting","data":"Hello World!"}'
668671
```
669672
</Code>
670673

@@ -824,5 +827,6 @@ Build and run your app again. Use the new buttons to send push notifications dir
824827
* Explore [push notification administration](/docs/push#push-admin) for managing devices and subscriptions.
825828
* Learn about [rules](/docs/channels#rules) for channel-based push notifications.
826829
* Read more about the [Push Admin API](/docs/api/realtime-sdk/push-admin).
830+
* Explore [Ably CLI push commands](/docs/cli/push) for the full list of push CLI options.
827831

828832
You can also explore the [Ably SDK for Android](https://github.com/ably/ably-java) on GitHub, or visit the [API references](/docs/api/realtime-sdk?lang=kotlin) for additional functionality.

src/pages/docs/push/getting-started/flutter.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ In the app tap **Activate Push** and wait until the status message displays your
454454

455455
### Publish directly to your device <a id="step-5-direct"/>
456456

457-
Publish a push notification directly to your client ID (or device ID using `--device-id` instead of `--client-id`) via the Ably CLI:
457+
Publish a push notification directly to your client ID (or device ID using `--device-id` instead of `--client-id`) via the [Ably CLI](/docs/platform/tools/cli):
458458

459459
<Code fixed="true">
460460
```shell
@@ -467,7 +467,7 @@ ably push publish --client-id push-tutorial-client \
467467

468468
### Publish via a channel <a id="step-5-channel"/>
469469

470-
Tap **Subscribe to Channel** in the app, then publish a push notification to your channel using the Ably CLI:
470+
Tap **Subscribe to Channel** in the app, then publish a push notification to the channel using the [Ably CLI](/docs/platform/tools/cli):
471471

472472
<Code fixed="true">
473473
```shell

src/pages/docs/push/getting-started/react-native.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ In the app tap **Activate Push** and wait until the status message displays your
478478

479479
### Publish directly to your device <a id="step-5-direct"/>
480480

481-
Publish a push notification directly to your client ID (or device ID using `--device-id` instead of `--client-id`) via the Ably CLI:
481+
Publish a push notification directly to your client ID (or device ID using `--device-id` instead of `--client-id`) via the [Ably CLI](/docs/platform/tools/cli):
482482

483483
<Code fixed="true">
484484
```shell
@@ -491,7 +491,7 @@ ably push publish --client-id push-tutorial-client \
491491

492492
### Publish via a channel <a id="step-5-channel"/>
493493

494-
Tap **Subscribe to Channel** in the app, then publish a push notification to your channel using the Ably CLI:
494+
Tap **Subscribe to Channel** in the app, then publish a push notification to the channel using the [Ably CLI](/docs/platform/tools/cli):
495495

496496
<Code fixed="true">
497497
```shell

src/pages/docs/push/getting-started/web.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,9 @@ async function unsubscribeFromChannel() {
405405
406406
Sending push notifications using `deviceId` or `clientId` requires the `push-admin` capability for your API key. Use this method for testing purposes. In a production environment, you would typically send push notifications from your backend server (by posting messages with `push` `extras` field to a channel).
407407
408-
To test push notifications in your app, you can use [Ably dashboard](https://ably.com/dashboard) or Ably CLI.
408+
To test push notifications in your app, you can use [Ably dashboard](https://ably.com/dashboard) or [Ably CLI](/docs/platform/tools/cli).
409409
410-
To send to your client using Ably CLI paste the following command into your terminal:
410+
To publish to your client using the [Ably CLI](/docs/platform/tools/cli) paste the following command into your terminal:
411411
412412
<Code>
413413
```shell
@@ -570,11 +570,14 @@ Try sending push using this `deviceId` or `clientId` as shown earlier.
570570

571571
### Send push via channel <a id="step-4-send-channel"/>
572572

573-
To test pushes via channel, subscribe to the channel in the UI and post a message to the "exampleChannel1" with a `push` `extras` field using Ably CLI:
573+
To test pushes via channel, subscribe to the channel in the UI and publish a push notification to the channel using the [Ably CLI](/docs/platform/tools/cli):
574574

575575
<Code>
576576
```shell
577-
ably channels publish exampleChannel1 '{"name":"example","data":"Hello from CLI!","extras":{"push":{"notification":{"title":"Ably CLI","body":"Hello from CLI!"},"data":{"foo":"bar"}}}}'
577+
ably push publish --channel exampleChannel1 \
578+
--title "Hello" \
579+
--body "World!" \
580+
--message '{"name":"greeting","data":"Hello World!"}'
578581
```
579582
</Code>
580583

@@ -727,5 +730,6 @@ Safari on macOS 13+ supports Web Push, but with some limitations. Notification a
727730
* Learn about [rules](/docs/channels#rules) for channel-based push notifications.
728731
* Read more about the [Push Admin API](/docs/api/realtime-sdk/push-admin).
729732
* Check out the [Web Push Notifications](/docs/push/configure/web) documentation for advanced use cases.
733+
* Explore [Ably CLI push commands](/docs/cli/push) for the full list of push CLI options.
730734

731735
You can also explore the [Ably JavaScript SDK](https://github.com/ably/ably-js) on GitHub, or visit the [API references](/docs/api/realtime-sdk?lang=javascript) for additional functionality.

0 commit comments

Comments
 (0)