Custom Notifications
Preparation
Custom notifications are considered an advanced feature, and requires basic knowledge of JSON syntax and creating your own scripts/tools to handle sending the payloads.
Read through the main Notifications page
Copy any module's device-based or user-based webhook URL from LunaSea
You will need to slightly modify the webhook URL you have copied from any of the modules. Simply replace the name of the module within the webhook URL to custom
and you're good to go!
Alternatively, you can copy the content of the URL after the last slash (after device/
or user/
) to obtain your Firebase device or user identifier.
Endpoints
Custom notifications are supported by both device-based and user-based notifications, with full endpoint details below:
Device-Based
POST
https://notify.lunasea.app/v1/custom/device/:device_id
Send a custom notification using a device token to a single device running LunaSea.
Path Parameters
device_id*
string
The Firebase device identifier
Request Body
title*
string
The notification's title.
body*
string
The notification's body content.
image
string
A
publicly accessible
URL to an image that will be attached to the notification.
User-Based
POST
https://notify.lunasea.app/v1/custom/user/:user_id
Send a custom notification using a user token to all devices signed into that LunaSea account.
Path Parameters
user_id*
string
The Firebase user identifier
Request Body
title*
string
The notification's title.
body*
string
The notification's body content.
image
string
A
publicly accessible
URL to an image that will be attached to the notification.
Troubleshooting
Ensure that the required
title
parameter is a string type.If the type is not a string, the notification will fail.
Sending no value or a null value will result in the title "Unknown Title" being used.
Ensure that the required
body
parameter is a string type.If the type is not a string, the notification will fail.
Sending no value or a null value will result in the body "Unknown Content" being used.
If sending an image, ensure that the content is a valid URL.
If the content is not a valid URL, the notification will fail.
The URL must contain the protocol,
http://
orhttps://
.The URL must be a direct link to the image and does not redirect.
The URL must be publicly accessible, not requiring any authentication to access.
If sending an image, the image must be a supported image type.
Supported types include JPGs, PNGs, and animated GIFs.
Last updated