Skip to content

pwaPromptPushPermission ​

Requests push-notification permission and registers the browser subscription with BetterForms.

pwaPromptPushPermission asks the browser for push-notification permission and, when permission is granted, creates or reuses a push subscription and registers it with BetterForms.

Action Object ​

KeyTypeDescription
actionstringMust be "pwaPromptPushPermission"
optionsobjectOptional metadata sent with the push subscription registration

Example ​

json
{
  "action": "pwaPromptPushPermission",
  "options": {
    "idUser": "BF_USER_ID"
  }
}

Behavior Notes ​

  • Requires browser support for both Notification and PushManager.
  • BetterForms requests notification permission from the browser.
  • If permission is granted, BetterForms retrieves the VAPID public key from the server, subscribes the browser, and saves the subscription using pushDataRegister.
  • If the browser does not support push notifications, BetterForms alerts the user.

Klai Studio documentation