class str = '/home/docs/.credentials/platypush/google/pubsub.json', **kwargs)[source]

Send messages over a Google pub/sub instance. You’ll need a Google Cloud active project and a set of credentials to use this plugin:

  1. Create a project on the Google Cloud console if you don’t have one already.
  2. In the Google Cloud API console create a new service account key. Select “New Service Account”, choose the role “Pub/Sub Editor” and leave the key type as JSON.
  3. Download the JSON service credentials file. By default platypush will look for the credentials file under ~/.credentials/platypush/google/pubsub.json.


  • google-cloud-pubsub (pip install google-cloud-pubsub)
__init__(credentials_file: str = '/home/docs/.credentials/platypush/google/pubsub.json', **kwargs)[source]
Parameters:credentials_file – Path to the JSON credentials file for Google pub/sub (default: ~/.credentials/platypush/google/pubsub.json)
send_message(topic: str, msg, **kwargs)[source]

Sends a message to a topic

  • topic – Topic/channel where the message will be delivered. You can either specify the full topic name in the format projects/<project_id>/topics/<topic_name>, where <project_id> must be the ID of your Google Pub/Sub project, or just <topic_name> - in such case it’s implied that you refer to the topic_name under the project_id of your service credentials.
  • msg – Message to be sent. It can be a list, a dict, or a Message object
  • kwargs – Extra arguments to be passed to .publish()