# Set up a Google Cloud Pub/Sub listener This guide shows step-by-step how to configure a listener for Google Pub/Sub to get a real-time feed of events from a Pub/Sub topic to a Foundry streaming dataset. Google Pub/Sub can be used in conjunction with various Google Cloud services to route events to Foundry. For example, it can be used for streaming emails from a Gmail account. [Review guidance provided by Google for streaming from Gmail ↗.](https://developers.google.com/gmail/api/guides/push) [Learn more about Google Pub/Sub. ↗](https://cloud.google.com/pubsub) ## Prerequisites Prior to configuration, ensure: * Your enrollment's ingress policy has been appropriately configured to accept Google Pub/Sub requests. You can either allow-list the [IPs of your Google Cloud region ↗](../../../assets/a3e32c124639a5e386b66744b22cc8ef9277ce82c724845e9f5854a19ae64e3e.json), or the countries. [Learn how to Configure ingress.](../../administration/configure-ingress/index.md) The provider may alter the IPs anytime after the listener has been implemented, and you would need to update ingress appropriately. * You have access to Pub/Sub in the Google Cloud Console. ## Instructions 1. Create a Pub/Sub topic if you do not already have one. This is the stream of events that will be pushed to your Foundry Listener.

![In the Google Cloud interface, create a new Pub/Sub topic.](../../../assets/7aa5f5a61aa55d05ebf857eb8674742fc642f61df271b5a944c5aaa26cf952f7.webp)

2. Navigate to the **Listeners** tab in Data Connection. Create a Foundry Pub/Sub listener by selecting Google Cloud Pub/Sub from the listener type menu. This step will not finish setting up the listener, but is required to generate the listener URL which is then used in step 3.

![Google Cloud Pub/Sub listener configuration page in Data Connection.](../../../assets/57dc4f090ab6797e86f6fefa351ff295a65b5f10aecaafd7d140affb04218360.webp)

3. Create a subscription for your Google Pub/Sub topic from step 1. a. Select **Push** as the subscription type. b. Copy the URL generated from step 2 into the **URL** field for your push subscription. c. Tick the box to enable **Authentication**. [Review Pub/Sub authentication information on external documentation. ↗](https://cloud.google.com/pubsub/docs/push?authuser=1#authentication) * Select a service account to use for authentication. * To use a shared secret, enter your shared secret into the URL field as a query parameter after the listener endpoint URL. Example: `?token=` d. Save your subscription.

![Google Cloud Pub/Sub Add subscription to topic page with sample configuration values.](../../../assets/e71331bb38827ec2c650422f45a3c79578d32cc4fe43b496bc1487c82928f900.webp)

4. Copy the **service account email address**, optional **audience claim**, and optional **shared secret** into the listener configuration as shown below then **Continue**.

![Google Cloud Pub/Sub Add subscription to topic page with sample configuration values.](../../../assets/94e7948d954747a9097728334bd98daf20d1e0ffb24d2dee53ae59e1c85d1f07.webp)

5. Administrator approval is now required from the Information Security Officer. Review the toggle description. 6. Select **Start** on the listener **Test** page to turn on your listener and start accepting events. 7. Send a test message to your topic, and see it appear in the listener test interface.

![Publish a message to test in Google Cloud Pub/Sub as part of testing your setup.](../../../assets/85a8a3591704d76dc51bd91d64ff6647d45bf4c3d15a02a79882d3570235b116.webp)

![Receive an event in your successfully configured listener.](../../../assets/f712294336e45e49048a04b8a88565feae938eaef95701db6877fa2d1c38c3d3.webp)

The payload arrives base64 encoded. You can decode it in a streaming pipeline using the base64 decode transformation board in order to get a string representation of the message. *** *All screenshots of Google Cloud Pub/Sub™ are provided for reference purposes only and are the property of Google LLC.*