Send Notification By Device ID API
Send push notifications to specific devices using their unique device identifiers
Send Notification By Device ID API
Target specific devices with push notifications using their unique device ID. Perfect for device-specific alerts and personalized messages.
Device Targeting
Send to specific devices precisely.
Push Notifications
Instant alerts on mobile devices.
Precise Delivery
Reach exactly the device you want.
Endpoint Overview
/graphqlSend a push notification to a specific device using its unique device ID. The notification includes a subject and content body.
Request Parameters
deviceIdString!RequiredThe unique identifier of the target device.
notificationNotificationInput!RequiredObject containing the notification details.
subjectString!RequiredThe notification title/subject.
contentString!RequiredThe notification body/message content.
dataJSONAdditional data payload for the notification.
GraphQL Mutation
mutation sendNotificationByDeviceId(
$deviceId: String!
$notification: NotificationInput!
) {
sendNotificationByDeviceId(
deviceId: $deviceId
notification: $notification
) {
status
message
}
}Variables:
{
"deviceId": "device_abc123xyz",
"notification": {
"subject": "Security Alert",
"content": "New login detected from a new location. If this wasn't you, please secure your account."
}
}HTTP Request:
curl -X POST https://api.orbnet.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-d '{
"query": "mutation sendNotificationByDeviceId($deviceId: String!, $notification: NotificationInput!) { sendNotificationByDeviceId(deviceId: $deviceId, notification: $notification) { status message } }",
"variables": {
"deviceId": "device_abc123xyz",
"notification": {
"subject": "Security Alert",
"content": "New login detected from a new location."
}
}
}'Response
{
"data": {
"sendNotificationByDeviceId": {
"status": "sent",
"message": "Notification delivered successfully"
}
}
}{
"errors": [
{
"message": "Device not found or inactive",
"path": ["sendNotificationByDeviceId"],
"extensions": {
"code": "DEVICE_NOT_FOUND"
}
}
],
"data": null
}{
"errors": [
{
"message": "Device push token is invalid or expired",
"path": ["sendNotificationByDeviceId"],
"extensions": {
"code": "INVALID_PUSH_TOKEN"
}
}
],
"data": null
}Use Cases
Security Alerts
Notify specific device about security events.
Session Warnings
Alert before disconnecting a device.
Connection Updates
Notify about server changes or maintenance.
Support Messages
Direct support communication to user's device.
Best Practices
Verify Device
Confirm device ID is valid before sending.
Clear Subject
Use concise, informative notification titles.
Handle Failures
Implement fallback for failed deliveries.
Rate Limit
Don't spam devices with too many notifications.
Related Endpoints
Finding Device IDs
Use the Devices query to retrieve device IDs for users. Device IDs are assigned when devices are activated.
Need to Reach All Users?
Use the Send Notification to All API for broadcast messages to all users.