> For the complete documentation index, see [llms.txt](https://wiki.playgama.com/playgama/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.playgama.com/playgama/bridge-sdk/api/notifications.md).

# Notifications

{% hint style="info" %}
You are reading the documentation for Bridge SDK **v2**. If you need the obsolete v1 documentation, see [Documentation (v1)](https://wiki.playgama.com/playgama/bridge-sdk-v1).
{% endhint %}

Schedule notifications that the host platform shows **after the player leaves the game**. Use them to bring players back: a daily energy refill, an expiring bonus, "your building is ready".

{% hint style="warning" %}
Notifications are delivered by the host platform, not by the game. Support is platform-specific — currently only [MSN](https://www.msn.com/en-us/play) shows them. Everywhere else `isSupported` is `false` and the methods reject, so always gate your UI on `isSupported`.
{% endhint %}

## Implementation order

1. **Required** — Map every notification id to its platform value in the [config](/playgama/bridge-sdk/config.md) under `notifications`.
2. **Recommended** — Check [`isSupported`](#is-supported) before showing any notification-related UI.
3. **Recommended** — [`schedule()`](#schedule) a re-engagement notification at a natural moment (level completed, energy spent, session about to end).
4. **Recommended** — On launch, read [`platform.payload`](/playgama/bridge-sdk/api/platform.md) to find out whether the game was opened from a notification, and route the player accordingly.

## Configuration

The game always works with its own notification `id`. Platforms that need their own identifier get it from the `notifications` section of the [config](/playgama/bridge-sdk/config.md):

```json
{
    "notifications": [
        {
            "id": "come_back",  // the id you pass to schedule() / cancel()
            "msn": 1            // MSN notification type — an integer from 0 to 15
        },
        {
            "id": "energy_full",
            "msn": 2
        }
    ]
}
```

{% hint style="warning" %}
On MSN a notification without an integer type in the config is rejected — the platform identifies notifications by type, not by name.
{% endhint %}

### Automatic re-engagement notifications

On MSN, Bridge schedules three re-engagement notifications right after initialization — shown no earlier than 1 day, 3 days, and 7 days after the session. They require no code and occupy MSN types `8`, `9`, and `10`, which is why those types are rejected for your own notifications.

To replace them with your own, turn them off in the config:

```json
{
    "platforms": {
        "msn": {
            "disableAutoNotifications": true
        }
    }
}
```

## Is Supported

Check support before showing notification-related UI (an opt-in toggle, a "remind me" button).

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.notifications.isSupported
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.notifications.isSupported
```

{% endtab %}

{% tab title="Construct 3" %}
Use the `Is Notifications Supported` condition.
{% endtab %}

{% tab title="GDevelop" %}
Use the `Is Notifications Supported` condition.
{% endtab %}

{% tab title="Godot" %}

```gdscript
Bridge.notifications.is_supported
```

{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_notifications_is_supported()
```

{% endtab %}

{% tab title="Defold" %}

```lua
bridge.notifications.is_supported()
```

{% endtab %}

{% tab title="Cocos Creator" %}

```typescript
bridge.notifications.isSupported
```

{% endtab %}
{% endtabs %}

<details>

<summary>Platform support · 1 of 25 platforms</summary>

**Supports:** `msn`

**Does not support:** `crazy_games`, `discord`, `dlightek`, `facebook`, `game_distribution`, `gamepush`, `gamesnacks`, `huawei`, `jio_games`, `lagged`, `microsoft_store`, `ok`, `playgama`, `poki`, `portal`, `reddit`, `samsung`, `telegram`, `tiktok`, `vk`, `xiaomi`, `y8`, `yandex`, `youtube`

</details>

## Schedule

Schedules a notification. The platform shows it after the player has left the game, no earlier than `delaySeconds` from now.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.notifications.schedule({
    id: 'come_back',
    title: 'Ready for another round?',
    description: 'Jump back in right where you left off.',
    delaySeconds: 86400,
    payload: 'come_back'
})
    .then(() => {
        // scheduled
    })
    .catch(error => {
        // error
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
using Playgama;
using Playgama.Modules.Notifications;

private void ScheduleComeBackNotification()
{
    var notification = new ScheduledNotification
    {
        id = "come_back",
        title = "Ready for another round?",
        description = "Jump back in right where you left off.",
        delaySeconds = 86400,
        payload = "come_back"
    };

    Bridge.notifications.Schedule(notification, success =>
    {
        Debug.Log($"Notification scheduled: {success}");
    });
}
```

{% endtab %}

{% tab title="Construct 3" %}
Build the notification with the common `Add Action Parameter` actions (`id`, `title`, `description`, `delaySeconds`, `image`, `callToAction`, `payload`), then run `Notifications Schedule` and handle the `On Notifications Schedule Completed` trigger.

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"id\"","value":"\"come_back\""}},{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"title\"","value":"\"Ready for another round?\""}},{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"description\"","value":"\"Jump back in right where you left off.\""}},{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"delaySeconds\"","value":"86400"}},{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"payload\"","value":"\"come_back\""}},{"id":"notifications-schedule","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-notifications-schedule-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"scheduled"}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
Build the notification with the common `Add Action Parameter` actions (`id`, `title`, `description`, `delaySeconds`, `image`, `callToAction`, `payload`), then run `Notifications Schedule` and handle the `On Notifications Schedule Completed` condition.

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"id\"","\"come_back\"",""]},{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"title\"","\"Ready for another round?\"",""]},{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"description\"","\"Jump back in right where you left off.\"",""]},{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"delaySeconds\"","\"86400\"",""]},{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"payload\"","\"come_back\"",""]},{"type":{"value":"PlaygamaBridge::NotificationsSchedule"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnNotificationsScheduleCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"scheduled\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
Bridge.notifications.schedule({
    "id": "come_back",
    "title": "Ready for another round?",
    "description": "Jump back in right where you left off.",
    "delaySeconds": 86400,
    "payload": "come_back"
}, funcref(self, "_on_schedule_completed"))

func _on_schedule_completed(success):
    print("Notification scheduled: ", success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
Bridge.notifications.schedule({
    "id": "come_back",
    "title": "Ready for another round?",
    "description": "Jump back in right where you left off.",
    "delaySeconds": 86400,
    "payload": "come_back"
}, Callable(self, "_on_schedule_completed"))

func _on_schedule_completed(success):
    print("Notification scheduled: ", success)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
var notification = {
    id: "come_back",
    title: "Ready for another round?",
    description: "Jump back in right where you left off.",
    delaySeconds: 86400,
    payload: "come_back"
}
playgama_bridge_notifications_schedule(json_stringify(notification))

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_notifications_schedule_callback" {
    if async_load[? "success"] {
        // notification scheduled
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    bridge.notifications.schedule(
        {
            id = "come_back",
            title = "Ready for another round?",
            description = "Jump back in right where you left off.",
            delaySeconds = 86400,
            payload = "come_back"
        },
        function ()
            -- scheduled
        end,
        function ()
            -- error
        end
    )
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```typescript
bridge.notifications.schedule({
    id: 'come_back',
    title: 'Ready for another round?',
    description: 'Jump back in right where you left off.',
    delaySeconds: 86400,
    payload: 'come_back'
})
    .then(() => {
        // scheduled
    })
    .catch(error => {
        // error
    })
```

{% endtab %}
{% endtabs %}

### Notification fields

<table><thead><tr><th width="170">Field</th><th width="110">Type</th><th width="100">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>string</td><td>yes</td><td>Game-level id, mapped to the platform value in the config.</td></tr><tr><td><code>title</code></td><td>string</td><td>yes</td><td>Notification headline. MSN: up to 60 characters.</td></tr><tr><td><code>description</code></td><td>string</td><td>yes</td><td>Notification body. MSN: up to 200 characters.</td></tr><tr><td><code>delaySeconds</code></td><td>integer</td><td>no</td><td>Minimum delay before the notification may be shown. MSN: up to 604800 (7 days).</td></tr><tr><td><code>image</code></td><td>string</td><td>no</td><td>Image for the notification. MSN expects base64 image data.</td></tr><tr><td><code>callToAction</code></td><td>string</td><td>no</td><td>Label of the notification button.</td></tr><tr><td><code>payload</code></td><td>string</td><td>no</td><td>Arbitrary string returned through <a href="/pages/FSIWFFx0RkjCmkpWOkfJ">platform.payload</a> when the game is launched from this notification.</td></tr></tbody></table>

## Cancel

Cancels a previously scheduled notification by its game-level id.

{% hint style="warning" %}
No platform supports cancellation yet — the call rejects on every platform, MSN included. Schedule notifications you are sure about, and use `payload` to detect and skip an outdated one at launch.
{% endhint %}

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.notifications.cancel('come_back')
    .then(() => {
        // canceled
    })
    .catch(error => {
        // error
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.notifications.Cancel("come_back", success =>
{
    Debug.Log($"Notification canceled: {success}");
});
```

{% endtab %}

{% tab title="Construct 3" %}
Call the `Notifications Cancel` action with the notification id, then handle the `On Notifications Cancel Completed` trigger.

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"notifications-cancel","objectClass":"PlaygamaBridge","parameters":{"id":"\"come_back\""}}]},{"eventType":"block","conditions":[{"id":"on-notifications-cancel-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"canceled"}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
Call the `Notifications Cancel` action with the notification id, then handle the `On Notifications Cancel Completed` condition.

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::NotificationsCancel"},"parameters":["","\"come_back\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnNotificationsCancelCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"canceled\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
Bridge.notifications.cancel("come_back", funcref(self, "_on_cancel_completed"))

func _on_cancel_completed(success):
    print("Notification canceled: ", success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
Bridge.notifications.cancel("come_back", Callable(self, "_on_cancel_completed"))

func _on_cancel_completed(success):
    print("Notification canceled: ", success)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_notifications_cancel("come_back")

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_notifications_cancel_callback" {
    if async_load[? "success"] {
        // notification canceled
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    bridge.notifications.cancel(
        "come_back",
        function ()
            -- canceled
        end,
        function ()
            -- error
        end
    )
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```typescript
bridge.notifications.cancel('come_back')
    .then(() => {
        // canceled
    })
    .catch(error => {
        // error
    })
```

{% endtab %}
{% endtabs %}

## Cancel All

Cancels every notification scheduled by the game. Same platform limitation as [Cancel](#cancel).

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.notifications.cancelAll()
    .then(() => {
        // canceled
    })
    .catch(error => {
        // error
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.notifications.CancelAll(success =>
{
    Debug.Log($"All notifications canceled: {success}");
});
```

{% endtab %}

{% tab title="Construct 3" %}
Call the `Notifications Cancel All` action, then handle the `On Notifications Cancel All Completed` trigger.
{% endtab %}

{% tab title="GDevelop" %}
Call the `Notifications Cancel All` action, then handle the `On Notifications Cancel All Completed` condition.
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
Bridge.notifications.cancel_all(funcref(self, "_on_cancel_all_completed"))

func _on_cancel_all_completed(success):
    print("All notifications canceled: ", success)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
Bridge.notifications.cancel_all(Callable(self, "_on_cancel_all_completed"))

func _on_cancel_all_completed(success):
    print("All notifications canceled: ", success)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_notifications_cancel_all()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_notifications_cancel_all_callback" {
    if async_load[? "success"] {
        // all notifications canceled
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    bridge.notifications.cancel_all(
        function ()
            -- canceled
        end,
        function ()
            -- error
        end
    )
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```typescript
bridge.notifications.cancelAll()
    .then(() => {
        // canceled
    })
    .catch(error => {
        // error
    })
```

{% endtab %}
{% endtabs %}

## Handling the launch payload

When the player opens the game from a notification, the notification's `payload` arrives as the regular platform payload. There is no separate notifications API for it — read [`platform.payload`](/playgama/bridge-sdk/api/platform.md) after initialization.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
if (bridge.platform.payload === 'come_back') {
    // the player came back from the notification — show the returning-player bonus
}
```

{% endtab %}

{% tab title="Unity" %}

```csharp
if (Bridge.platform.payload == "come_back")
{
    // the player came back from the notification
}
```

{% endtab %}

{% tab title="Construct 3" %}
On **System → On start of layout**, compare the `PlaygamaBridge.PlatformPayload` expression with the payload you scheduled.

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-start-of-layout","objectClass":"System"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformPayload","comparison":0,"second-value":"\"come_back\""}}],"actions":[{"type":"comment","text":"the player came back from the notification"}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
Once **Is Initialized** is true, compare the `PlaygamaBridge::PlatformPayload()` expression with the payload you scheduled.

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsInitialized"},"parameters":["",""]},{"type":{"value":"BuiltinCommonInstructions::CompareStrings"},"parameters":["PlaygamaBridge::PlatformPayload()","=","\"come_back\""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"the player came back from the notification\"","\"info\"",""]}]}],"eventsCount":1,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}

```gdscript
if Bridge.platform.payload == "come_back":
    # the player came back from the notification
    pass
```

{% endtab %}

{% tab title="GameMaker" %}

```javascript
if playgama_bridge_platform_payload() == "come_back" {
    // the player came back from the notification
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    if bridge.platform.payload() == "come_back" then
        -- the player came back from the notification
    end
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```typescript
if (bridge.platform.payload === 'come_back') {
    // the player came back from the notification
}
```

{% endtab %}
{% endtabs %}
