Notification Event¶
Description¶
Notification events are pushed automatically to authenticated client WebSocket sessions with a selected active_login.
No separate subscription is required.
Client notifications are account-scoped:
- account-targeted notifications are delivered when
active_loginmatches the notification account - manager-only notifications are not delivered through client WebSocket sessions
- legacy rows with
user_id = 0are deprecated and are not part of the client notify flow
Event Marker¶
"n"
Payload Format¶
Notifications are sent as compact JSON arrays.
| Index | Field | Type | Description |
|---|---|---|---|
| 0 | "n" |
string | Event marker |
| 1 | message | string | Short title or message payload |
| 2 | description | string | Optional extended description |
| 3 | token | string | Notification token |
| 4 | status | int | Notification status |
| 5 | level | int | Notification level |
| 6 | user_id | int | Account login |
| 7 | create_time | int | Unix timestamp |
| 8 | data or code | object or int | Structured data when present, otherwise result code |
| 9 | code | int | Result code when structured data is present |
Example¶
[
"n",
"Order opened",
"Your order was opened successfully",
"OPEN_ORDER",
1,
0,
100500,
1734312345,
{
"order": 58123,
"symbol": "EURUSD"
},
201
]
Marketing Popup Notifications¶
Back-office workflows can create client popup notifications through the same notification channel. There is no separate WebSocket event for popups: the client receives a regular "n" notification and decides how to render it.
A workflow-generated popup notification is identified by notification level = 4 (NOTIFY_LEVEL_MARKETING). The notification type is stored with the notification record and defines message format, for example NOTIFY_TYPE_TXT_MSG for text templates or NOTIFY_TYPE_AST_MSG for AST/JSON message payloads. The compact WebSocket event itself does not include type; clients that need it should load the notification list/details through the REST notify API.
For popup text templates, message can contain placeholders in {{field}} format. The values are supplied in the structured data object at index 8. The object is flat; clients should replace placeholders from keys with the same name.
Example popup notification:
[
"n",
"Open order {{order}} price {{open_price}}",
"",
"WORKFLOW_NOTIFY",
0,
4,
2000009,
1734312345,
{
"trigger": "account.switch",
"account_login": 2000009,
"account_name": "John Smith",
"order": 58123,
"open_price": 1.08952
},
201
]
Common workflow data keys include trigger, brand, rule_id, rule_code, account_login, account_name, account_group, account_email, customer_id, customer_name, customer_first_name, customer_last_name, customer_email, order, symbol, cmd, volume, open_price, close_price, and amount_usd.