Send Notification By Token API
POST /sendNotificationByToken
Description
This API endpoint allows sending a notification to a device identified by its token. The notification includes a subject and content.
Request Body
The request utilizes GraphQL to perform the sendNotificationByToken
mutation.
Mutation:
mutation sendNotificationByToken ($token: String!, $notification: NotificationInput!) {
sendNotificationByToken (token: $token, notification: $notification) {
status
message
}
}
Variables:
{
"token": "<Device_Token>",
"notification": {
"subject": "<Notification_Subject>",
"content": "<Notification_Content>"
}
}
- token (String): The unique token associated with the device where the notification will be sent.
- notification (NotificationInput):
- subject (String): The subject of the notification.
- content (String): The content or message of the notification.
Response:
-
Success (200 OK):
- The response indicates the status of the notification sending operation, along with a message.
{
"data": {
"sendNotificationByToken": {
"status": "<Status>",
"message": "<Message>"
}
}
} -
Error (4XX/5XX):
- If there is an issue with sending the notification, such as an invalid token or notification content, the response will include an appropriate error message and status code.
Note:
Ensure that the token
is correct and the notification content is properly formatted. The response will confirm whether the notification was successfully sent.