Skip to main content

GCP Pub/Sub Node

The GCP (Google Cloud Platform) Pub/Sub Node allows a workflow to publish a message to a Google Pub/Sub topic of your choosing.

GCP Pub/Sub Node

Configuration​

Configuration for the node is broken up into four sections.

Authentication​

First, configure the authentication method for connecting to Google Cloud Platform.

Note: We recommend that you create a service account key specifically for use in Losant workflows that has appropriate access to publish to the relevant Pub/Sub topics.

GCP Pub/Sub Node Authentication

The next configuration field will depend on the Authentication Method selected:

  • If you selected Choose an Integration … as your Authentication Method, choose a Google Pub/Sub Integration you have created for your application.

  • If you selected Select a Service Credential … as your Authentication Method, Credential Name Template can either be a string template that references your Service Credential name or you can select a Service Credential you have created for your application.

  • If you selected Enter Account Key (JSON Template) (or JSON Template in Edge Workflows) as your Authentication Method, Account Key JSON Template can either be a JSON template that references your Google Service Account JSON Key or you may enter it directly.

  • If you selected Enter Account Key (Payload Path) (or Payload Path in Edge Workflows) as your Authentication Method, Account Key Payload Path is a payload path that references a Google Service Account Key that has access to publish to the selected topic.

The third configuration field appears for all Authentication Methods except for Integrations.

  • Project ID Template: Can either be a string template that references your Project ID, or it can be left blank to use the default Project ID associated with your credential. Note: For Edge Workflows, this field is only available in GEA version 1.42.0 or higher.

Topic & Message​

The Topic Template is the topic on which the message will be published. (Note: It is not necessary to be subscribed to a topic in order to publish to it.)

  • Message Data Method: Select the format of the message data:
  • Message Template / Message Payload Path: Enter the message data in the selected format.

Attributes​

You may optionally include some attributes along with your message. Attributes are a map of key/value pairs. In the Attribute Method dropdown, there are three methods by which you may include the attributes:

  • Individual Fields allows you to enter each key/value separately, with the key and the value both accepting string templates.
  • JSON Template accepts an object of key/value pairs in one block. The object may not contain any nested properties, and Handlebars helpers may be used for either the keys or values.
  • Payload Path accepts a payload path to an object of key/value pairs on your payload.

Result Path​

Optionally, you can store the message response on the current payload by entering a payload path here. The value will be an object with the following properties:

  • messageId: On a successful publish, the ID of the published message.
  • error: If the message failed to publish, the result will include an error object with properties detailing why the sending failed.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.