API
API
This page provides a reference for the notifier SDK’s API.
notifier.notify(player, config)
Schedules a potential notification to be sent to the player. This is the primary function for sending notifications.
Parameters
player(Player): The player to notify.config(table): A table containing the notification configuration.
Configuration (config)
The config table can contain the following fields:
asset_id(string): The unique identifier for the notification string you created in the Creator Dashboard.time(DateTime?): Optional. The desired time to send the notification.priority(number?): Optional. A number between -32768 and 32767 that determines the notification’s priority. Higher numbers are higher priority.string_parameters(table?): Optional. A table of key-value pairs to substitute into the notification string. Values can be strings or numbers. Strings will be truncated to 100 characters.launch_data(string?): Optional. Data that can be used to customize the user’s experience when they join from the notification. Max 200 characters.analytics_data(string?): Optional. Custom data for analytics purposes. Max 100 characters.
Example
notifier.notify(player, {
asset_id = "842f00f6-758b-e948-95a9-745431d90a97",
time = DateTime.now(),
priority = 5,
string_parameters = { points = "55555" },
launch_data = "red",
analytics_data = "daily",
})notifier.canOptIn(player)
Checks if a player is eligible to opt-in to receiving notifications based on Roblox’s policies. This function yields until the check is complete.
Parameters
player(Player): The player to check.
Returns
boolean: Returnstrueif the player can be prompted to opt-in, otherwisefalse.
Example
if notifier.canOptIn(player) then
print(player.DisplayName .. " can opt-in to notifications.")
notifier.optIn(player)
else
print(player.DisplayName .. " cannot opt-in to notifications.")
endnotifier.optIn(player)
Prompts the player to opt-in to receive notifications using the standard Roblox UI. You should only call this after a successful canOptIn check.
Parameters
player(Player): The player to prompt.
Example
if notifier.canOptIn(player) then
-- It is good practice to only prompt the user based on some interaction,
-- like clicking a button.
notifier.optIn(player)
endnotifier.joined(player)
Tracks when a player has joined the game. This is used for analytics to track engagement and retention.
Parameters
player(Player): The player who joined.
Example
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player: Player)
notifier.joined(player)
end)