Skip to main content

Google Cloud Pub/Sub Component

Google Cloud Pub/Sub provides messaging between applications. Publisher applications can send messages to a 'topic' and other applications can subscribe to that topic to receive the messages.

Component key: google-cloud-pub-sub

Description

Google Cloud Pub/Sub provides messaging between applications. Publisher applications can send messages to a "topic" and other applications can subscribe to that topic to receive the messages.

The Push Notifications service lets you to receive notifications that an order has been created. This is called "push" since Google will push notifications to you about events, such as orders, that happen on the Google side.

  • The Content API's pubsubnotificationsettings.update receives the request and sends you back a cloudTopicName.

  • To configure additional Topics

    • In the Google Cloud console, select the navigation menu scroll to the Pub/Sub page (Navigation Menu > More Products > Analytics > Pub/Sub)
    • In the Topics page, click Create Topic
      • In the window that opens, enter MyTopic in the Topic ID field.
        • Leave the default values for the remaining options, and then click Create.
        • You see the success message: A new topic and a new subscription have been successfully created.
        • You have just created a topic called MyTopic and an associated default subscription MyTopic-sub.
  • You create a subscription for the topic and register the URL push endpoint with Cloud Pub/Sub.

  • To Configure Subscription go to Pub/Sub > Subscriptions

    • In the Subscriptions page, click Create subscription.

    • Enter MySub in the Subscription ID field.

    • For Select a Cloud Pub/Sub topic, select the MyTopic topic from the drop-down menu

    • Leave the default values for the remaining options.

    • Click Create

      • You see the success message: Subscription successfully added.
    • Click the Topics page and click MyTopic.

      • The MySub subscription is now attached to the topic

        MyTopic. Pub/Sub delivers all messages sent to

        MyTopic to the MySub and MyTopic-sub subscriptions.

  • Cloud Pub/Sub accepts your subscription and associates that cloudTopicName with your URL. When messages are published to that cloudTopicName (for example, your order notifications), they will be sent to your URL push endpoint.

Request

PUT https://shoppingcontent.googleapis.com/content/v2.1/merchantId/pubsubnotificationsettings

Connections

OAuth2

All requests to the Google Pub/Sub API must be authorized by an authenticated user.

The details of the authorization process, or "flow," for OAuth 2.0 vary somewhat depending on what kind of application you're writing. The following general process applies to all application types:

  1. When you create your application, you register it using the Google API Console. Google then provides information you'll need later, such as a client ID and a client secret.
  2. From APIs & Services > Library, activate the Google Content API for Shopping
  3. To create API Credentials navigate to Enabled APIs & Services and select Content API for Shopping
    1. Select Create Credentials
    2. Ensure the Pub/Sub API is enabled
    3. Choose User Data and select Next
    4. Fill out the OAuth consent screen with an app name (your company or product's name), support email, app logo, domain, etc.
    5. Select Add Or Remove scopes, search ‘Pub/Sub’, and check the boxes for the following scopes
      1. https://www.googleapis.com/auth/cloud-platform
      2. https://www.googleapis.com/auth/pubsub
    6. For OAuth Client ID, under Application type select Web application.Under Authorized redirect URIs enter Prismatic's OAuth 2.0 callback URL: https://oauth2.prismatic.io/callbackClick CREATE.
      1. Take note of the Client ID and Client Secret that are generated, as you will enter them into Prismatic for Authentication.
    7. Client Id and Secret can also be obtained in the Credentials Page under the OAuth 2.0 Client IDs section by selecting the name of the OAuth client created.

Google Pub/Sub Private Key

Triggers

PubSub Notification

PubSub Notification Trigger Settings | key: myTrigger


Data Sources

Fetch subscriptions

Fetch an array of subscriptions | key: subscriptions | type: picklist

Data Source Payload

{
"result": [
{
"label": "projects/{project}/subscriptions/{subscription} / projects/{project}/topics/{topic}",
"key": "projects/{project}/subscriptions/{subscription}"
}
]
}

Fetch Topics

Fetch an array of topics | key: topics | type: picklist

Data Source Payload

{
"result": [
{
"label": "projects/{project}/topics/{topic}.",
"key": "projects/{project}/topics/{topic}."
}
]
}

Actions

Create Subscription

Creates a subscription to a given topic. | key: createSubscription


Create Topic

Creates the given topic with the given name. | key: createTopic


Create Webhook Subscription

Creates a webhook subscription to a given topic. | key: createWebhookSubscription


Delete Subscription

Deletes an existing subscription. | key: deleteSubscription


Delete Topic

Deletes the topic with the given name. | key: deleteTopic


Get Policy

Gets the access control policy for a resource. | key: getPolicy


Get Subscription

Gets the configuration details of a subscription. | key: getSubscription


Get Topic

Gets the configuration of a topic. | key: getTopic


List Subscriptions

Lists matching Subscriptions. | key: listSubscriptions


List Topics

Lists matching topics. | key: listTopics


Pull Messages

Pulls messages from the server. | key: pullMessages


Raw Request

Send raw HTTP request to Google Cloud Pub/Sub | key: rawRequest


Set Gmail IAM Policy for Topic

Configure a topic to allow publish notifications from Gmail. | key: setTopicIamPolicy


Set Policy

Sets the access control policy on the specified resource. | key: setPolicy


Update Push Config

This may be used to change a push subscription to a pull one (signified by an empty PushConfig) or vice versa, or change the endpoint URL and other attributes of a push subscription. | key: updatePushConfig


Update Subscription

Updates an existing subscription. | key: updateSubscription


Update Topic

Updates an existing topic. | key: updateTopic