Use this method to send a notification to a single user through SMS, Email, or Push.
Unlike a chat message, a notification is delivered through the app's configured notification channel rather than into a chat.
Field | Type | Required | Description |
method | String | Yes | "sendUserNotification" |
account_id | Number | Yes | Account id of the user to notify. The request is ignored if this is missing or 0. |
type | String | Yes | Delivery channel. One of SMS, Email, Push. Case-sensitive. |
message | String | Yes | The notification body. The request is ignored if this is missing. |
title | String | Conditional | Used as the subject for Email and the title for Push. Not used for SMS. |
app_id | String | Yes | Unique identifier for the App. |
Behaviour by type
type | What is sent |
SMS | message is delivered as the SMS body. title is ignored. |
Email | title becomes the email subject, message becomes the body. |
Push | title and message are delivered as the push notification title and body. |
Preconditions for API Functionality
The following tables outline the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
Action | Requirement | Description |
Send notification | Configured channel | The app must have the matching channel configured β an SMS gateway for SMS, SMTP settings for Email, or push credentials for Push. |
Send notification | Valid app_id | app_id must resolve to an existing app; the notification is sent on behalf of that app's owner. |
Response
β οΈ This method does not return an acknowledgement. It is fire-and-forget: there is no
_ack and no response method, and the SDKs expose no callback for it.If
message or account_id is missing, or type is not exactly SMS, Email, or Push, the request is silently discarded β no error code is returned. Validate these fields before sending.SDK Mapping β sendUserNotification
SDK | Request Method | Response Callback |
Java | api.sendNotification(userId, NotificationType.Push, title, message, appId); | β none |
JavaScript | api.sendNotification(userId, "Push", title, message, appId); | β none |
Python | napi.send_notification(user_id=user_id, notification_type="Push", title=title, message=message, app_id=app_id) | β none |
Example
Requests
json{ "method": "sendUserNotification", "account_id": 90090684293000559, "type": "Push", "title": "Order shipped", "message": "Your order #1042 is on its way.", "app_id": "90090684293000559" }
javaapi.sendNotification(90090684293000559L, NandboxClient.NotificationType.Push, "Order shipped", "Your order #1042 is on its way.", "90090684293000559");
javascriptapi.sendNotification(90090684293000559, "Push", "Order shipped", "Your order #1042 is on its way.", "90090684293000559");
pythonnapi.send_notification( user_id=90090684293000559, notification_type="Push", title="Order shipped", message="Your order #1042 is on its way.", app_id="90090684293000559" )