The translation was generated automatically and may contain mistakes

Module: 4. Development

Lesson 13. Notifications

The main thing in the lesson

  • Notifications are an important mechanism of interaction with the audience. Use notifications to get users into the app and report changes. Only mini-apps published in the catalog can send notifications.

  • You can use notifications of different types : mass, automatic or single. For example, one-time notifications are best for telling users when an order is being executed.

  • There are limits to sending notifications. If they are exceeded, the user will not see the notification.

  • By default, notifications are disabled. To request permission to send notifications, call the event VKWebAppAllowNotifications .

    JavaScript
    bridge.send('VKWebAppAllowNotifications') .then((data) => { if (data.result) { // Разрешение получено } }) .catch((error) => { /* … */ }); };

    The user can also allow or prohibit the mini-app to send him notifications in the menu of this mini-app.

  • To find out if the mini-app has permission to send notifications to the user who launched this mini-app, check the launch parameter vk_are_notifications_enabled or execute an API request apps.isNotificationsAllowed .

  • To send a one-time notification, complete the request notifications.sendMessage from the server side of the mini-app. Use it to send a request service access key from the settings of your mini-app.

Useful links

:::