Overview
The OneSignal + MySQL integration enables syncing of custom events from your MySQL database to OneSignal to trigger automated messaging campaigns and Journeys based on user behavior. MySQL is a widely-used open-source relational database management system, ideal for storing structured event data that can power personalized messaging campaigns.Requirements
- Access to Event Streams for outbound message events (Plan limitations and overages apply)
- Access to Custom Events for inbound event syncing (Plan limitations and overages apply)
- Updated Account Plan (not available on free apps)
MySQL
- MySQL Community 5.7 or later, or recent versions of MariaDB
- Event tables containing structured behavioral data
- Network connectivity from OneSignal to your MySQL instance
- TLS v1.2 or greater supported
Setup
1
Create dedicated user for OneSignal
Create a dedicated user account with read-only permissions:
If you have multiple schemas that contain event data, repeat the
GRANT SELECT statement for each schema.2
Configure OneSignal connection
In OneSignal, go to Data > Integrations and click Add Integration.Select MySQL and provide your connection details:
- Host: Your MySQL server hostname
- Port: MySQL port (typically 3306)
- Database: Database name containing your event tables
- Username:
CENSUS - Password: The password you created above
3
Test connection
Click Test Connection to verify OneSignal can successfully connect to your MySQL database and access your event tables.
Event data mapping
Map your MySQL event data to OneSignal’s custom events format:The Sync Key is the column you designate as the unique identifier for each row during sync. OneSignal uses it to detect whether a row has already been processed, so re-syncing your data doesn’t create duplicate events. Choose a column with a unique text value per row. Don’t use a boolean or a value that repeats across rows.