Skip to main content

Overview

The OneSignal + Google Cloud SQL integration enables automatic syncing of custom events from your Cloud SQL database to OneSignal. This allows you to trigger automated Journeys and personalized messaging campaigns based on user behavioral data stored in your managed PostgreSQL database.

Requirements

Google Cloud SQL

  • Cloud SQL for PostgreSQL instance (version 11 or higher recommended)
  • Database access with read permissions for event tables
  • Network connectivity from OneSignal to your Cloud SQL instance
  • Cloud SQL Auth proxy for secure connections (recommended)

Setup

1

Configure Cloud SQL database access

Create a dedicated user for OneSignal with read-only access to event tables:
2

Configure network access

Ensure OneSignal can connect to your Cloud SQL instance:Option 1: Authorized Networks (Public IP)
  • In Google Cloud Console, go to SQL > Instances
  • Select your instance → ConnectionsNetworking
  • Add the IP addresses provided by OneSignal in the Integration setup to Authorized networks
Option 2: Private IP (Recommended)
  • Configure your Cloud SQL instance with a private IP
  • Use Cloud SQL Auth Proxy for secure connections
  • Ensure proper VPC peering or firewall rules
Option 3: Cloud SQL Auth Proxy
  • Download and configure the Cloud SQL Auth Proxy
  • Use service account authentication
  • Connect through secure proxy tunnel
3

Set up Cloud SQL Auth Proxy (recommended)

For enhanced security, use Cloud SQL Auth Proxy:
Create a service account with Cloud SQL Client role:
4

Add integration in OneSignal

In OneSignal, go to Data > Integrations and click Add Integration.Select Google Cloud SQL and provide:
  • Instance Connection Name: PROJECT_ID:REGION:INSTANCE_ID
  • Database Name: Your event database name
  • Username: onesignal_reader
  • Password: The password created in Step 1
  • SSL Mode: require (recommended for security)
  • Connection Type: Choose between Direct, Auth Proxy, or Private IP
5

Configure event data queries

Define the SQL query to retrieve event data from your Cloud SQL database:
Ensure your event tables include:
  • Event name/type (String)
  • User identifier (String)
  • Event timestamp (Timestamp)
  • Event properties (JSON/JSONB)
6

Test the connection

Click Test Connection to verify OneSignal can connect to your Cloud SQL instance and execute the event query successfully.

Event data mapping

Map your to OneSignal’s custom events format:

Advanced Configuration

Connection Pooling

Optimize database connections for high-volume event syncing:

Query Optimization

Improve event query performance:

JSON Data Handling

If using JSONB for event properties, optimize JSON queries:
Monitor your Cloud SQL instance’s performance when OneSignal queries event data. Consider using read replicas for analytics workloads to avoid impacting production performance.

FAQ

How often does OneSignal sync events from Cloud SQL?

OneSignal syncs event data based on your configured schedule, with a minimum interval of 15 minutes.

Can I use Cloud SQL read replicas for event syncing?

Yes, using read replicas is recommended to isolate analytics queries from your production database workload.

What happens if my Cloud SQL instance is temporarily unavailable?

OneSignal will retry connections with exponential backoff. Event syncing will resume automatically once your instance is accessible again.