milesoft pubsub

Manage platform Google Cloud PubSub topics and subscriptions.


1. Overview

The pubsub command subtree enables developers to list available platform Google Cloud PubSub topics, check active webhook/push subscriptions, and manage subscriptions (subscribe/unsubscribe webhook endpoints).


2. Command Reference

milesoft pubsub topics

List all available Google Cloud PubSub topics configured on the platform gateway.

  • Usage: milesoft pubsub topics [flags]
  • Flags: None besides global flags.
Examples
Terminal TTY Output (Default)
$ milesoft pubsub topics
=========================================================================
             Available PubSub Topics
=========================================================================
- v1-ping-minute
- v1-ping-hour
- v1-ping-day
- v1-ping-week
- v1-ping-month
- v1-account-added
- v1-account-saved
- v1-account-deleted
- v1-user-added
- v1-user-saved
- v1-user-deleted
- v1-user-date
- v1-contact-added
- v1-contact-saved
- v1-contact-deleted
- v1-contact-date
- v1-task-date
=========================================================================
Automated JSON Output (via Pipe, Redirect, or --json)
$ milesoft pubsub topics --json

JSON Schema Result:

[
  "v1-ping-minute",
  "v1-ping-hour",
  "v1-ping-day",
  "v1-ping-week",
  "v1-ping-month",
  "v1-account-added",
  "v1-account-saved",
  "v1-account-deleted",
  "v1-user-added",
  "v1-user-saved",
  "v1-user-deleted",
  "v1-user-date",
  "v1-contact-added",
  "v1-contact-saved",
  "v1-contact-deleted",
  "v1-contact-date",
  "v1-task-date"
]

milesoft pubsub subscriptions

Retrieve all registered webhooks / push subscriptions currently listening to platform events across both accounts and contacts sub-systems.

  • Usage: milesoft pubsub subscriptions [flags]
  • Flags: None besides global flags.
Examples
Terminal TTY Output (Default)
$ milesoft pubsub subscriptions
===============================================================================================
TOPIC                    PROJECT ID               PUSH ENDPOINT                                
===============================================================================================
v1-user-added            my-gcp-project-123       https://my-service-url.a.run.app/api/v1/pubSub/userAdded
v1-contact-added         my-gcp-project-123       https://my-service-url.a.run.app/api/v1/pubSub/contactAdded
===============================================================================================
Automated JSON Output (via Pipe, Redirect, or --json)
$ milesoft pubsub subscriptions --json

JSON Schema Result:

[
  {
    "topic": "v1-user-added",
    "projectId": "my-gcp-project-123",
    "pushEndpoint": "https://my-service-url.a.run.app/api/v1/pubSub/userAdded"
  },
  {
    "topic": "v1-contact-added",
    "projectId": "my-gcp-project-123",
    "pushEndpoint": "https://my-service-url.a.run.app/api/v1/pubSub/contactAdded"
  }
]

milesoft pubsub subscribe

Subscribe a push endpoint (webhook URL) to a specified platform PubSub topic for a GCP project. If no --endpoint or --url is specified, the CLI will auto-detect the service URL.

  • Usage: milesoft pubsub subscribe --topic <topic> --project <project-id> [flags]
  • Flags:
    • --topic string (Required): PubSub topic name to subscribe to.
    • --project string (Required): GCP project ID.
    • --endpoint string (Optional): Precise HTTPS push endpoint URL. If omitted, the CLI will derive it from either --url or auto-detected Cloud Run service URL.
    • --url string (Optional): The Cloud Run service base URL. If omitted (and --endpoint is also omitted), the CLI will auto-detect it.
Automatic Endpoint Derivation & Detection

If --endpoint is not explicitly provided, the CLI will:

  1. If --url is provided, it uses it as the service base URL.
  2. If --url is not provided, it executes gcloud run services list on the target --project to auto-detect the Cloud Run service URL.
  3. Once a service base URL is resolved, the CLI automatically derives the push endpoint matching the topic version using the formula: ${baseURL}/api/v1/pubSub/${camelCaseTopic} (e.g., converting v1-user-added suffix to userAdded).
Examples
Terminal TTY Output (Default with Auto-Detection)
$ milesoft pubsub subscribe --topic v1-user-added --project my-gcp-project-123
No --url or --endpoint specified, attempting to auto-detect Cloud Run service URL...
Auto-detected Cloud Run service URL: https://my-service-url.a.run.app
Derived Push Endpoint: https://my-service-url.a.run.app/api/v1/pubSub/userAdded
=========================================================================
             Created PubSub Subscription
=========================================================================
Topic:         v1-user-added
Project ID:    my-gcp-project-123
Push Endpoint: https://my-service-url.a.run.app/api/v1/pubSub/userAdded
=========================================================================
Explicit Endpoint Subscription
$ milesoft pubsub subscribe --topic v1-user-added --project my-gcp-project-123 --endpoint https://custom.endpoint.com/webhook
=========================================================================
             Created PubSub Subscription
=========================================================================
Topic:         v1-user-added
Project ID:    my-gcp-project-123
Push Endpoint: https://custom.endpoint.com/webhook
=========================================================================
Automated JSON Output (via Pipe, Redirect, or --json)
$ milesoft pubsub subscribe --topic v1-user-added --project my-gcp-project-123 --json

JSON Schema Result:

{
  "topic": "v1-user-added",
  "projectId": "my-gcp-project-123",
  "pushEndpoint": "https://my-service-url.a.run.app/api/v1/pubSub/userAdded"
}

milesoft pubsub unsubscribe

Delete an active Google Cloud PubSub push subscription/webhook for a specified topic and GCP project.

  • Usage: milesoft pubsub unsubscribe --topic <topic> --project <project-id> [flags]
  • Flags:
    • --topic string (Required): PubSub topic name.
    • --project string (Required): GCP project ID.
Examples
Terminal TTY Output (Default)
$ milesoft pubsub unsubscribe --topic v1-user-added --project my-gcp-project-123
Success! Unsubscribed from topic v1-user-added for project my-gcp-project-123.