Overview
The OneSignal + SQL Server integration enables syncing of custom events from your Microsoft SQL Server database to OneSignal to trigger automated messaging campaigns and Journeys based on user behavior. SQL Server is Microsoft’s relational database management system designed for enterprise applications and data warehousing.Requirements
- Access to Custom Events (currently in beta)
- Updated Account Plan (not available on free apps).
SQL Server
- SQL Server instance with network access
- Database user with appropriate permissions
- Event tables containing structured behavioral data
- Network connectivity from OneSignal to your SQL Server instance
Setup
1
Create dedicated user for OneSignal
Create a dedicated user account with a strong, unique password:
All SQL Server commands will run within the database that is specified when running the script.
2
Grant read permissions
Provide read-only access to your event data:
Replace
<your-schema>
with your actual schema name containing event data. Repeat this command for each schema you want OneSignal to access.3
Configure Advanced Sync Engine (Optional)
For enhanced performance, create a bookkeeping schema for OneSignal’s sync state:
Skip this step if using Basic Sync Engine or read-only mode.
4
Connect to OneSignal
In OneSignal, go to Data > Integrations and click Add Integration.Select SQL Server and provide the following connection details:
- Host: Your SQL Server instance hostname or IP address
- Port: 1433 (default) or your custom port
- Database: Your database name
- Username:
CENSUS
- Password: The password from Step 1
Event data mapping
Map your to OneSignal’s custom events format:OneSignal Field | Description | Required | |
---|---|---|---|
name | event_name | Event identifier | Yes |
external_id | user_id | User identifier | Yes |
timestamp | event_timestamp | When event occurred | No |
properties | event_data | No |
Example Event Table Schema
SQL Query Mode
Write custom SQL queries to transform your event data:Advanced Network Configuration
OneSignal can successfully connect to SQL Server instances that are using advanced networking controls including region constraints, IP address allow lists, or SSH Tunneling. For more information about configuring network access, contact your SQL Server administrator or OneSignal support.Sync Engine Options
Basic Sync Engine
- Read-only access to your event data
- State tracking managed by OneSignal infrastructure
- Simpler setup with minimal permissions
Advanced Sync Engine
- Enhanced performance with local state tracking
- Requires additional permissions to create tables
- Recommended for high-volume event processing
Limitations
- Complex queries may impact database performance during high-traffic periods
- JSON operations require SQL Server 2016 or later for optimal performance
- All permissions are granted at the database level specified during setup
FAQ
Can I connect to multiple SQL Server schemas?
Yes, you can grant the CENSUS user access to multiple schemas by running theGRANT SELECT, VIEW DEFINITION ON SCHEMA::<schema>
statement for each schema containing event data.