Skip to main content

Google Pub/Sub Module

Introduction

Google Pub/Sub is a messaging service for exchanging event data among applications and services. It provides a reliable and scalable way to manage event-driven communication in your cloud infrastructure. With the Google Pub/Sub module in LoyJoy, you can integrate your chatbot with Google Pub/Sub to publish data in real-time for further processing and analysis.

How to Use the Module

Integration

To successfully establish the connection to Google Pub/Sub, you need to provide the following fields:

  • Project in the Google Cloud Platform: The ID of your Google Cloud project.
  • Pub/Sub Topic: The topic in Pub/Sub to which messages will be published.
  • Pub/Sub Service Account Credentials (JSON): The credentials file for your service account in JSON format.

Steps to Set Up the Module:

  1. Create a Topic in Google Cloud Platform
  • Navigate to the Pub/Sub section in the Google Cloud Console.
  • Click "Create Topic" and provide a name for your topic.
  1. Set Up a Service Account
  • Go to the "IAM & Admin" section and select "Service Accounts."
  • Create a new service account and assign it the "Pub/Sub Editor" role.
  • Generate a JSON key for this service account and download the file.
  1. Configure the LoyJoy Module
  • Enter your Google Cloud Platform project ID in the "Project" field.
  • Provide the name of your Pub/Sub topic in the "Pub/Sub Topic" field.
  • Paste the JSON content from your downloaded key file into the "Service Account Credentials" field.
  1. Define Mappings

Specify source expressions from LoyJoy and map them to target fields in Pub/Sub.

Example Mappings

  • Mapping 1:

    • Source Expression: participation
    • Target Field: participation_code
  • Mapping 2:

    • Source Expression: lottery
    • Target Field: lottery_entry

Additional Information

Source Expression: This is used to declare what information will be transmitted from the chatbot to google.

Target Field: This is the field in the Pub/Sub message where the data will be written.

Useful Tips

  • Message Format: Ensure that your message format in Pub/Sub aligns with the expected structure in your processing or consuming applications.