Skip to content

Notifications (Unity)

FRVRSDK.Notifications schedules a remote push / chatbot message to be delivered later — the classic “come back tomorrow” retention prompt. Facebook Instant is the primary target on the Unity wrapper; other channels may no‑op.

FRVRSDK.Notifications.CanScheduleMessages(canSchedule =>
{
    if (canSchedule) ShowReminderToggle();
});

The player has to consent to receive messages from the channel. Subscribing is free once CanScheduleMessages says yes:

FRVRSDK.Notifications.SubscribeScheduleMessages(
    () => Debug.Log("subscribed"),
    err => Debug.LogError(err));

Show your “Remind me tomorrow” toggle only after CanScheduleMessages is true; call SubscribeScheduleMessages the first time the player turns the toggle on.

var config = new ScheduleMessageConfig
{
    playerId       = "5116605215082224",
    delayInSeconds = 86400,                              // 1 day
    imageUrl       = "https://cdn.mygame.com/push.png",
    message        = "Your daily reward is ready!",
    buttons        = new[]
    {
        new ScheduleMessageButton
        {
            type    = "game_play",
            title   = "Play!",
            payload = "{\"deepLink\":\"daily\"}"
        }
    }
};

FRVRSDK.Notifications.ScheduleMessage(config,
    () => Debug.Log("scheduled"),
    err => Debug.LogError(err));

When the player taps through the push, your game receives the payload string in its entrypoint data — route the player into the correct screen there.

FRVRSDK.Notifications.CanScheduleMessages(canSchedule =>
{
    if (!canSchedule) return;

    FRVRSDK.Notifications.SubscribeScheduleMessages(() =>
    {
        var cfg = new ScheduleMessageConfig
        {
            playerId       = currentPlayerId,
            delayInSeconds = 86400,
            imageUrl       = "https://cdn.mygame.com/daily.png",
            message        = "Your daily reward is ready!",
            buttons        = new[] { new ScheduleMessageButton { type = "game_play", title = "Play!", payload = "" } }
        };

        FRVRSDK.Notifications.ScheduleMessage(cfg,
            () => { /* scheduled */ },
            err => Debug.LogError(err));
    }, err => Debug.LogError(err));
});