OneSignal
Push notification, email, SMS, and in-app messaging platform for customer engagement at scale.
OneSignal
Push notification, email, SMS, and in-app messaging platform for customer engagement at scale.
Capabilities
| Integration | Available | Notes |
|---|---|---|
| API | ✓ | Notifications, Users, Segments, Templates, Apps |
| MCP | - | Not available |
| CLI | ✓ | [onesignal.js](../clis/onesignal.js) |
| SDK | ✓ | JavaScript, Node.js, Python, Java, PHP, Ruby, Go, .NET |
Authentication
- Type: App API Key
- Header:
Authorization: Key {REST_API_KEY} - App ID: Required as
app_idin request bodies - Get credentials: Dashboard > Settings > Keys & IDs
- Security: HTTPS required, TLS 1.2+ on port 443
Common Agent Operations
Send push notification to segment
POST https://api.onesignal.com/api/v1/notifications
Headers:
Authorization: Key {REST_API_KEY}
Content-Type: application/json
{
"app_id": "YOUR_APP_ID",
"included_segments": ["Subscribed Users"],
"headings": { "en": "New Feature!" },
"contents": { "en": "Check out our latest update." },
"url": "https://example.com/feature"
}Send notification to specific users
POST https://api.onesignal.com/api/v1/notifications
Headers:
Authorization: Key {REST_API_KEY}
Content-Type: application/json
{
"app_id": "YOUR_APP_ID",
"include_aliases": { "external_id": ["user-123", "user-456"] },
"target_channel": "push",
"contents": { "en": "You have a new message." }
}Send email using the local CLI
node tools/clis/onesignal.js notifications send --emails "[email removed]" --email-subject "Welcome" --email-body "<p>Thanks for joining.</p>"
node tools/clis/onesignal.js notifications send --channel email --segment "Customers" --heading "News" --message "<p>Product update.</p>"Email sends require an email subject and HTML body. --heading and --message remain aliases for these email fields. --emails selects the email channel automatically; --channel email also works with existing alias, segment, or subscription targeting. Push remains the default channel, and SMS uses --channel sms --message .... An explicit incompatible channel with --emails is rejected locally.
The send command uses the current /notifications?c=<channel> resource, target_channel, and email_to for direct email recipients. It does not send push contents, headings, url, data, or ttl as email content. --dry-run previews the same request with masked authorization and no network request.
Primary contracts: Email, SMS, and sending messages.
Schedule a notification
POST https://api.onesignal.com/api/v1/notifications
Headers:
Authorization: Key {REST_API_KEY}
Content-Type: application/json
{
"app_id": "YOUR_APP_ID",
"included_segments": ["Subscribed Users"],
"contents": { "en": "Scheduled notification" },
"send_after": "2025-12-01 12:00:00 GMT-0500"
}List notifications
GET https://api.onesignal.com/api/v1/notifications?app_id={APP_ID}&limit=50&offset=0
Headers:
Authorization: Key {REST_API_KEY}View a notification
GET https://api.onesignal.com/api/v1/notifications/{notification_id}?app_id={APP_ID}
Headers:
Authorization: Key {REST_API_KEY}Cancel a scheduled notification
DELETE https://api.onesignal.com/api/v1/notifications/{notification_id}?app_id={APP_ID}
Headers:
Authorization: Key {REST_API_KEY}List segments
GET https://api.onesignal.com/api/v1/apps/{APP_ID}/segments
Headers:
Authorization: Key {REST_API_KEY}Create a segment
POST https://api.onesignal.com/api/v1/apps/{APP_ID}/segments
Headers:
Authorization: Key {REST_API_KEY}
Content-Type: application/json
{
"name": "Active Users",
"filters": [
{ "field": "session_count", "relation": ">", "value": "5" }
]
}Get user by external ID
GET https://api.onesignal.com/apps/{APP_ID}/users/by/external_id/{external_id}
Headers:
Authorization: Key {REST_API_KEY}Create a user
POST https://api.onesignal.com/apps/{APP_ID}/users
Headers:
Authorization: Key {REST_API_KEY}
Content-Type: application/json
{
"identity": { "external_id": "user-789" },
"subscriptions": [
{ "type": "Email", "token": "[email removed]" }
],
"properties": { "tags": { "plan": "pro", "signup_source": "organic" } }
}List templates
GET https://api.onesignal.com/api/v1/templates?app_id={APP_ID}
Headers:
Authorization: Key {REST_API_KEY}Key Metrics
Notification Metrics
successful- Number of successful deliveriesfailed- Number of failed deliveriesconverted- Users who clicked/convertedremaining- Notifications still queuederrored- Count of errorsopened- Notification open count
User Metrics
session_count- Total user sessionslast_active- Last activity timestamptags- Custom key-value metadatasubscriptions- Active subscription channels
Parameters
Notification Parameters
app_id- Application ID (required)included_segments- Target segments arrayexcluded_segments- Excluded segments arrayinclude_aliases- Target specific users by aliastarget_channel- Channel:push,email,smscontents- Message content by language codeheadings- Notification title by language codeurl- Launch URL on clickdata- Custom key-value data payloadsend_after- Scheduled send time (UTC string)ttl- Time to live in seconds
Segment Filter Fields
session_count- Number of sessionsfirst_session- First session datelast_session- Last session datetag- Custom tag valuelanguage- User languageapp_version- App versioncountry- User country code
When to Use
- Sending push notifications for product updates
- Triggered notifications based on user behavior
- Multi-channel messaging (push + email + SMS)
- Re-engagement campaigns for inactive users
- Segmenting users for targeted messaging
- A/B testing notification content
- Scheduling promotional campaigns
Rate Limits
- Free Plan: 150 notification requests/second per app
- Paid Plan: 6,000 notification requests/second per app
- User/Subscription ops: 1,000 requests/second per app
- Burst limit: No more than 10x total subscribers in 15 minutes
- 429 response: Includes
RetryAfterheader with seconds to wait
Relevant Skills
- push-notifications
- customer-engagement
- retention-campaign
- re-engagement
- lifecycle-marketing
Source: https://github.com/coreyhaines31/marketingskills/blob/main/tools/integrations/onesignal.md
Author: coreyhaines31, Marketing skills. License: MIT.
Shown here with formatting for the web; email addresses removed. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The Codex library holds 7,009 entries. Members can search all of them by meaning and read every one in full.