Back to All

[One Signal] Using Median Javascript Bridge in a NextJS app

Hello :)

I'm trying to use the Javascript Bridge to log my users to One Signal in order to retrieve the OneSignalUserId (and enable individual push notifications).

But for the moment, I can't. I'm on NextJS 14, I've installed the Median JavaScript Bridge NPM Package (median-js-bridge), and here's what I'm trying to do:

useEffect(() => {
  Median.onReady(() => {
    Median.onesignal.login('<redacted-user-id>').then((result: CallbackData) => {
      if (result.success) { => {
          // ...
          // Do something with the oneSignalInfo.oneSignalUserId (store in DB)
          // ...

When I deploy this code, nothing happens. It seems that everything in the Median.onReady callback is not executed. Is this correct in principle? The use of the NPM package is not well documented.

Do you have an example of reusable code for this use case? Or how to use the Npm Package correctly ?

On the configuration side, everything seems correct:

  • One Signal is enabled
  • Legacy Mode is deactivated
  • App Id is correctly set
  • Registration and Data Transmission are set to automatic
  • Users have been sent to One Signal

Thank you for your support :)