Notification API with User Segmentation
Stop blasting every user with the same message. Target notifications by plan, role, company, or any custom attribute. Individual, segment, or broadcast. One REST API, real-time delivery via SSE.
Targeting
Three ways to reach your users
From a single user to your entire base. Send the right message to the right audience via the REST API.
Individual User
Target a single user by their ID. Perfect for transactional notifications like order confirmations, password resets, or personal alerts.
"userId": "user_123" Segment
Target users matching attribute filters. Notify all Pro users, all admins, or all users from a specific company in one API call.
"segment": "plan:pro,role:admin" Broadcast
Send to everyone. Ideal for system-wide announcements, maintenance notices, or major feature launches across your entire user base.
"broadcast": true Custom Attributes
Define any attribute. Segment on anything.
Set custom key-value attributes on user profiles via the API. Then use those attributes to target notifications. No predefined schema. Use whatever makes sense for your product.
By Plan Tier
Notify only Enterprise users about SSO availability. plan:enterprise
By User Role
Send billing alerts to admins only, not every team member. role:admin
By Company
Target all members of a specific organization. company:acme-corp
By Region
Announce regional maintenance windows. region:eu-west
By Feature Flag
Notify beta testers about updates to their feature. beta:dashboard-v2
Set attributes via the API
curl -X POST https://api.notilayer.com/v1/users \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"userId": "user_123",
"attributes": {
"plan": "pro",
"role": "admin",
"company": "acme-corp",
"region": "us-east"
}
}' Then target a segment
curl -X POST https://api.notilayer.com/v1/notify/batch \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"segment": "plan:pro,role:admin",
"title": "New audit log available",
"body": "View security events in Settings."
}'
// Only Pro admins receive this notification
// Delivered in real time via SSE Backend Integration
Send from your Node.js backend
The batch endpoint accepts a segment filter and delivers to all matching users. Combine multiple attributes with commas for AND logic. Notifications arrive in real time via SSE.
- Combine attributes:
plan:pro,role:admin - No segment limits on any plan
- Delivered via SSE in under 1 second
- Works with any language that can make HTTP requests
Node.js example
const response = await fetch(
'https://api.notilayer.com/v1/notify/batch',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
segment: 'plan:enterprise',
title: 'SSO is now available',
body: 'Enable SAML in your org settings.',
}),
}
); Use Cases
Smarter notifications drive better engagement
When users only see notifications relevant to them, open rates go up and noise goes down. Read our segmentation guide for best practices.
Onboarding by Plan
Guide free users toward activation steps while sending Pro users tips about advanced features they are paying for.
Feature Rollouts
Announce a new feature only to users who have the corresponding feature flag enabled. No noise for everyone else.
Account-Level Alerts
Send billing alerts to admins only, not every team member. Reduce noise for individual contributors.
Company-Specific Updates
Running a multi-tenant SaaS? Notify all members of a specific company about an outage or data migration affecting their account.
FAQ
Segmentation questions
How does user segmentation work in the Notilayer notification API?
plan:pro,role:admin to target only matching users. Segments are dynamic filters, not static lists.What user attributes can I use for notification segmentation?
Can I send notifications to a specific user and a segment in the same request?
Is there a cost for using user segmentation in Notilayer?
Explore more: Home · Node.js Backend Guide · Segmentation Guide
Start Sending Targeted Notifications
Set user attributes, define segments, and reach the right audience. Free plan included.