Game notifications
Notifications are a separate channel of communication with users that can be used by games for various purposes.
All notifications sent to users are available for viewing on all platforms, in a separate notification section:
- https://ok.ru/notifications for desktop devices;
- https://m.ok.ru/notifications on mobile platforms.
There are several interaction types for notifications:
- user-to-user notifications sent by users to each other:
- invitation to the game;
- notification from the game;
- single app-to-user notifications sent to the user by the game;
- bulk app-to-user notifications sent to a group of users by the game.
user-to-user notifications are sent via the FAPI SDK; app-to-user are sent via the REST API.
FAPI.UI.showNotification: a user-to-user notification
The FAPI.UI.showNotification method of the FAPI SDK is used to send this notification. This notification can be sent by users to each other within the game.
This is what the notification sending process looks like:
- a sender initiates the notification sending in the game UI;
- the game calls the sending method;
- the sender selects recipients of the notification, as well as its text (optional), in the window that appears;
- the notification is sent to the user.
As a result, the recipient will receive a notification, where the sender’s name and the name of the game from which it was sent can be seen:
FAPI.UI.showInvite: a user-to-user invitation to the game
The FAPI.UI.showInvite method of the FAPI SDK is used to send this notification. This is an invitation to the game meant for the user’s friends that haven’t launched this game yet.
This is what the notification sending process looks like:
- a sender initiates the invitation sending in the game UI;
- the game calls the sending method;
- the sender selects recipients of the invitation, as well as its text (optional), in the window that appears;
- the invitation is sent to the user.
As a result, the recipient will receive a notification, where the sender’s name and the name of the game from which it was sent can be seen:
notifications.sendSimple: an app-to-user notification
The notifications.sendSimplemethod of the REST API is used to send this notification. This is an information notification from the game to the user which can be sent to any user who plays the game.
If the method was called correctly, the user will receive the notification with the following text from the game:
notifications.sendMass: bulk app-to-user notifications
The notifications.sendMass method of the REST API is used to send this notification. This is an information notification from the game to the user which can be sent to a group of users, based on filters that are supported when calling the method, for example: users’ gender or the time of last launch of the game.
If the method was called correctly, all users that fall under conditions of the notification sending will receive the notification with the following text from the game within 30 minutes: