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.What data syncs
Data moves one way, from MySQL into OneSignal.
The MySQL integration does not create users or subscriptions, set Tags, or import audiences. OneSignal does not send message events to MySQL. To send message events to a system you control, use Event Streams. See what data each integration syncs to compare integrations.
Requirements
OneSignal
- A paid OneSignal plan. This integration isn’t available on the Free plan. See plans.
- If you import events, they become Custom Events. Custom Events follow your plan’s stored event allotment.
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.