# GCloud Pub/Sub

Google Cloud Pub/Sub is a messaging service that enables real-time event-driven communication between applications. It facilitates asynchronous messaging by allowing publishers to send messages to topics and subscribers to receive them efficiently.

### **How to Integrate GCloud Pub/Sub with ZBrain Flow** <a href="#how-to-integrate-gcloud-pub-sub-with-zbrain-flow" id="how-to-integrate-gcloud-pub-sub-with-zbrain-flow"></a>

To integrate GCloud Pub/Sub with ZBrain Flow:

1. Click the ‘+’ button in ZBrain Flow.
2. In the search bar, type "GCloud Pub/Sub" and select it from the available options.
3. Choose an action to begin the setup process.

### **How to Connect GCloud Pub/Sub to ZBrain Flow** <a href="#how-to-connect-gcloud-pub-sub-to-zbrain-flow" id="how-to-connect-gcloud-pub-sub-to-zbrain-flow"></a>

To connect GCloud Pub/Sub to ZBrain Flow, you need to create a service account and obtain a JSON service key for authentication. Follow these steps to establish a secure connection:

1. **Provide a Connection Name** – Assign a name for easy identification.
2. **Enter the Service Key (JSON)** – Use the authentication key for secure access.
3. **To Get the Service Key (JSON), Follow These Steps:**
   * **Create a Service Account:**
     * Go to the Google Cloud Console.
     * Navigate to IAM & Admin > Service Accounts.
     * Click ‘Create Service Account’.
     * Provide a name and description, then click ‘Create.’
   * **Assign Roles to the Service Account:**
     * In the Service Account Permissions section, assign roles like:
       * **Pub/Sub Publisher** (to publish messages).
       * **Pub/Sub Subscriber** (to receive messages).
     * Click ‘Continue’ and then ‘Done.’
   * **Create and Download the Key:**
     * Locate the created service account in the list.
     * Click the Actions menu (three dots) and select Manage keys.
     * Click ‘Add Key’ > ‘Create New Key.’
     * Choose JSON as the key type and click ‘Create.’
     * The JSON key file will be downloaded to your computer.
4. Click ‘Save’ to finalize the setup.

Once connected, ZBrain Flow can send messages to topics, manage Pub/Sub workflows, and automate real-time communication.

### **Actions Available in ZBrain Flow** <a href="#actions-available-in-zbrain-flow" id="actions-available-in-zbrain-flow"></a>

#### **Publish Message to Topic** <a href="#publish-message-to-topic" id="publish-message-to-topic"></a>

This action allows you to publish messages to a specific Google Cloud Pub/Sub topic, enabling real-time communication between applications and services.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One**
   * If a connection to Google Cloud Pub/Sub already exists, select it from the list.
   * If not, follow the connection setup process to authenticate and establish a new connection.
2. **Enter the Message Content**
   * Provide the message content that needs to be published.
   * Click ‘+ Add Item’ to include multiple messages if required.
3. **Specify the Topic**
   * Enter the exact name of the Pub/Sub topic where the message will be published.
   * Ensure the topic exists in your Google Cloud Pub/Sub project and has the correct permissions for message publishing.

**Note:** Click *‘f’* to insert dynamic values for flexible configurations.
