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-subDescription
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 acloudTopicName
.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 subscriptionMyTopic-sub
.
- In the window that opens, enter
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 menuLeave the default values for the remaining options.
Click Create
- You see the success message:
Subscription successfully added.
- You see the success message:
Click the Topics page and click
MyTopic
.The
MySub
subscription is now attached to the topicMyTopic
. Pub/Sub delivers all messages sent toMyTopic
to theMySub
andMyTopic-sub
subscriptions.
Cloud Pub/Sub accepts your subscription and associates that
cloudTopicName
with your URL. When messages are published to thatcloudTopicName
(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:
- 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.
- From APIs & Services > Library, activate the Google Content API for Shopping
- To create API Credentials navigate to Enabled APIs & Services and select Content API for Shopping
- Select Create Credentials
- Ensure the Pub/Sub API is enabled
- Choose User Data and select Next
- Fill out the OAuth consent screen with an app name (your company or product's name), support email, app logo, domain, etc.
- Select Add Or Remove scopes, search ‘Pub/Sub’, and check the boxes for the following scopes
- 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/callback
Click CREATE.- Take note of the Client ID and Client Secret that are generated, as you will enter them into Prismatic for Authentication.
- 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 a raw HTTP request to Google Cloud Pub/Sub API | 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