> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeotap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Pub/Sub

## Overview

Google Pub/Sub is an asynchronous and scalable messaging service that decouples services producing messages from services processing those messages. Pub/Sub is used for streaming analytics and data integration pipelines to ingest and distribute data.

## Prerequisites

Ensure that you have the following details available before starting the integration:

* Project Id
* Topic Id
* Authentication

### Project Id

A Project ID is a unique string that differentiates your project from all others on Google Cloud. You can use the [Google Cloud console](https://cloud.google.com/resource-manager/docs/creating-managing-projects?hl=en\&ref_topic=6158848\&visit_id=638040066804795299-2594272843\&rd=1) to generate a Project ID. You can find the Project ID in the Google Cloud console - [Dashboard page](https://console.cloud.google.com/home). In the below example, the Project name is **My Sample Project** and the Project ID is **my-sample-project-191923**.

<Frame>
  <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub-2023-01-12.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=9720c2a32db4d02c38639535961ca989" width="1174" height="644" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub-2023-01-12.png" />
</Frame>

### Topic Id

In the Google Cloud console, go to the [**Pub/Sub**](https://console.cloud.google.com/cloudpubsub/topicList?_ga=2.230005471.2138624224.1673155280-188740464.1653481288) page > **Topics**. A list of all the topics created appears. Copy the relevant Topic Id and use it for the destination setup.

<Frame>
  <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub-2023-01-12-3.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=9bd2ec034898217f0748ceeb6e63f9ce" width="2758" height="692" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub-2023-01-12-3.png" />
</Frame>

### Authentication

The authentication method for the Pub/Sub destination can be **Refresh Token** or **Service Account**. Provide the required details based on the authentication method you choose.

#### Refresh Token Authentication

To authenticate using a Refresh Token, you need the following details:

* Client ID
* Client Secret
* Refresh Token

For this integration, if you decide to perform the authentication through the **Refresh Token**, then Zeotap CDP requires the **Client ID**, **Client Secret**, and **Refresh Token** to establish a connection with the Pub/Sub destination where you want to send data. In Google Cloud, these unique credentials can be used to authorise applications or services, such as Pub/Sub, through OAuth 2.0. For detailed steps to generate them, refer to [Google Pub/Sub documentation](https://developers.google.com/google-ads/api/docs/oauth/playground).

In the [Refresh Token generation steps](https://developers.google.com/google-ads/api/docs/oauth/playground#generate_tokens), add the **Cloud Pub/Sub API v1** scope when specifying API scopes, as shown in the image below.

<Frame>
  <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-5.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=1a698ddea354880eeeb33862ba3ede3c" width="3022" height="1612" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-5.png" />
</Frame>

#### Service Account Authentication

To authenticate using a Service Account, you must assign the **Pub/Sub Publisher** role to the "[pub-sub-publisher@dcr-orchestration-prod.iam.gserviceaccount.com](mailto:pub-sub-publisher@dcr-orchestration-prod.iam.gserviceaccount.com)" service account within Pub/Sub as shown below.

<Frame>
  <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-6.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=b689d42a86c96e1fd626617842dce245" width="2804" height="1658" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-6.png" />
</Frame>

## Destination Setup

Once you have taken care of the prerequisites mentioned above, you can proceed to [creating workflow in Journeys](https://docs.zeotap.com/articles/orchestrate-customer/create-a-workflow) (Zeotap CDP). After you have applied filters or added conditions for your users in Journeys as mentioned in [Create a Workflow](https://docs.zeotap.com/articles/orchestrate-customer/create-a-workflow), you can activate them in Google Pub/Sub in the **Send to Destinations** node as shown below.

<Frame>
  <img src="https://mintcdn.com/zeotap/uj9kV6WkF-FC0bHW/articles/integrate-customer/Storage/integrate-customer/sfmc-personalization-journeys/sfmc-personalization-journeys-2024-09-26.png?fit=max&auto=format&n=uj9kV6WkF-FC0bHW&q=85&s=8ed8abd70040c3e575c94c98ad4e6956" width="1258" height="1442" data-path="articles/integrate-customer/Storage/integrate-customer/sfmc-personalization-journeys/sfmc-personalization-journeys-2024-09-26.png" />
</Frame>

A new window appears, where you can set up your destination. You can use an already existing destination from the list of available Destinations or create a new one by clicking **+ Add New Destination**.

<Frame>
  <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-4.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=5a47343c81ea1d50842d49e6e22efe88" width="1914" height="716" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-4.png" />
</Frame>

<Note>
  **Note:**

  To use an existing destination for activation in Journeys, click [here](/articles/integrate-customer/google-pub-sub#h2__290574186).
</Note>

### Add New Destination

Perform the following steps to add a new destination:

<Steps>
  <Step>
    Click **Add New Destination.**
  </Step>

  <Step>
    Search for **Google Pub/Sub.**
  </Step>

  <Step>
    Click **Google Pub/Sub** and enter a name for the Destination.
  </Step>

  <Step>
    Enter the **Instance**, which is an internal field for the Destination.
  </Step>

  <Step>
    Provide the **Project Id** and **Topic Id** obtained from your Google Cloud. [Learn more](/articles/integrate-customer/google-pub-sub#h4_2023180516)

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-2.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=5ab86385cfa67d7f56f5b33da518c8cc" width="1168" height="1474" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-2.png" />
    </Frame>
  </Step>

  <Step>
    Choose either **Refresh Token** or **Service Account** as your Authentication method, based on your requirement.

    a. If you choose **Refresh Token**, then provide the **Client Id**, **Client Secret** and **Refresh Token** details in the respective fields. [Learn more](/articles/integrate-customer/google-pub-sub#h4__107804704)

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-4.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=cf1a0dbb2b491edbe5871a5b8e3aaa4d" width="976" height="940" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-4.png" />
    </Frame>

    b. If you choose **Service Account**, then the following **Google** **Service Account** is displayed. Ensure to provide "**Pub/Sub Publisher**" role to this service account within Pub/Sub. [Learn more](/articles/integrate-customer/google-pub-sub#h3__1953899986)

    **Service Account:** [pub-sub-publisher@dcr-orchestration-prod.iam.gserviceaccount.com](mailto:pub-sub-publisher@dcr-orchestration-prod.iam.gserviceaccount.com)

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-3.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=df8e8ba797ec570ec2a481db28cc1512" width="984" height="454" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-3.png" />
    </Frame>
  </Step>

  <Step>
    In the mapping screen that appears, under **Choose your Action**, select **Send identifiers to Google Cloud PubSub in realtime** as the action for sending data from the workflow created in Journeys.

    Under **Map the Fields**, use **+ Add Mapping Field** to add any custom field that you wish to send to Google Pub/Sub. Ensure that you map at least one attribute. Otherwise, the data does not flow to the Pub/Sub destination.

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-08-07-2.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=67f896c5af865fc1afafab97d1d77b38" width="1940" height="1744" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-08-07-2.png" />
    </Frame>
  </Step>

  <Step>
    Once the mapping is complete, click **Create Destination**. The destination is created and made available for activation on Journeys as shown below.

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-5.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=cb019caa9c0ad11eb9f5e50a4829d2c3" width="1914" height="716" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-5.png" />
    </Frame>
  </Step>
</Steps>

## Activate the Destination on Journeys

After creating a destination, next, you need to link it in the **Send to Destination** node within the workflow, as explained below.

<Steps>
  <Step>
    In the workflow, click **+** and choose **Send to Destinations**.

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-08-07-3.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=fc32cb0fd7764a5193810c7b6c33f96f" width="1032" height="542" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-08-07-3.png" />
    </Frame>
  </Step>

  <Step>
    Choose the destination from the list of available destinations by using the search feature.
  </Step>

  <Step>
    Under the **Destination Details** tab, based on the authentication type you have chosen, the **Instance,** **Project Id, Topic Id, Authentication (Refresh Token/Service Account) and other fields** as shown in the image below automatically populates based on the values that you have entered while creating the destination. However, you need to provide an **Audience Name** to save the Destination.

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-7.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=59baa8fcf2857735a7cd5f9ef8253f4e" width="3878" height="1312" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2025-03-20-7.png" />
    </Frame>
  </Step>

  <Step>
    Under the **Destination Settings** tab, choose the action and mapping as per your requirement.

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-08-07-4.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=a62ac36a3d6aea34cfb1c2633fd4178c" width="1914" height="1248" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-08-07-4.png" />
    </Frame>
  </Step>

  <Step>
    Upon clicking **Save Destination**. The destination is attached as shown in the image below.

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-1.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=589230ec725b342f83e98fca0ed7839e" width="1886" height="1112" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-1.png" />
    </Frame>
  </Step>

  <Step>
    Click **Add Destinations** at the bottom right corner of the screen. Note that you can also add multiple destinations at this step if needed.
  </Step>

  <Step>
    The linked Destinations appear in the **Send to Destinations** node within the workflow as shown below. Further, you can then build and customise your workflow as needed by clicking '+' . Note that you must enter a name for your workflow in the provided text box to save it.

    <Frame>
      <img src="https://mintcdn.com/zeotap/FCzFgv-TEYPP6Zvb/articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-6.png?fit=max&auto=format&n=FCzFgv-TEYPP6Zvb&q=85&s=7ecb8709ced7573b4b9074d1d7d1b795" width="938" height="1786" data-path="articles/integrate-customer/Storage/integrate-customer/google-pub-sub/google-pub-sub-2024-11-06-6.png" />
    </Frame>
  </Step>

  <Step>
    After adding conditions and filters for users, choose one of the following options:

    * **Save Draft**: Enables you to revisit and edit the workflow before publishing.
    * **Next: Re-entry Condition**: Determines whether a user can re-enter the same workflow.
  </Step>

  <Step>
    After defining the re-entry criteria, click **Publish Workflow**. The workflow appears in the Workflow listing screen with a **Published** status.

    <Frame>
      <img src="https://mintcdn.com/zeotap/uj9kV6WkF-FC0bHW/articles/integrate-customer/Storage/integrate-customer/sfmc-personalization-journeys/sfmc-personalization-journeys-2024-09-26-8.png?fit=max&auto=format&n=uj9kV6WkF-FC0bHW&q=85&s=634ab0c131fbe99396837bc9f7b8fc91" width="742" height="380" data-path="articles/integrate-customer/Storage/integrate-customer/sfmc-personalization-journeys/sfmc-personalization-journeys-2024-09-26-8.png" />
    </Frame>
  </Step>
</Steps>
