{"id":13472758,"url":"https://github.com/b8ne/react-native-pusher-push-notifications","last_synced_at":"2026-04-03T23:01:21.034Z","repository":{"id":37840099,"uuid":"81619762","full_name":"b8ne/react-native-pusher-push-notifications","owner":"b8ne","description":"Manage pusher interest subscriptions and notification events in Javascript.","archived":false,"fork":false,"pushed_at":"2025-01-27T20:39:34.000Z","size":154,"stargazers_count":102,"open_issues_count":27,"forks_count":90,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-25T16:59:05.758Z","etag":null,"topics":["push-notifications","pusher","react-native","react-native-js"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b8ne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-11T00:41:35.000Z","updated_at":"2025-10-06T08:58:17.000Z","dependencies_parsed_at":"2024-01-16T06:10:11.556Z","dependency_job_id":"ad29e86a-3f47-4071-ab2f-4689ca37cde5","html_url":"https://github.com/b8ne/react-native-pusher-push-notifications","commit_stats":{"total_commits":141,"total_committers":24,"mean_commits":5.875,"dds":0.7588652482269503,"last_synced_commit":"1a201191572a8a6521569530e9a87da15575ba7c"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/b8ne/react-native-pusher-push-notifications","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b8ne%2Freact-native-pusher-push-notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b8ne%2Freact-native-pusher-push-notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b8ne%2Freact-native-pusher-push-notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b8ne%2Freact-native-pusher-push-notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b8ne","download_url":"https://codeload.github.com/b8ne/react-native-pusher-push-notifications/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b8ne%2Freact-native-pusher-push-notifications/sbom","scorecard":{"id":222187,"data":{"date":"2025-08-11","repo":{"name":"github.com/b8ne/react-native-pusher-push-notifications","commit":"65b3f267f9bbe4a30ca9a6f4a12db17903116350"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":7,"reason":"Found 10/14 approved changesets -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/b8ne/react-native-pusher-push-notifications/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/b8ne/react-native-pusher-push-notifications/publish.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T02:50:02.990Z","repository_id":37840099,"created_at":"2025-08-17T02:50:02.991Z","updated_at":"2025-08-17T02:50:02.991Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31381007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T21:40:47.592Z","status":"ssl_error","status_checked_at":"2026-04-03T21:40:05.436Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["push-notifications","pusher","react-native","react-native-js"],"created_at":"2024-07-31T16:00:57.727Z","updated_at":"2026-04-03T23:01:20.672Z","avatar_url":"https://github.com/b8ne.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# react-native-pusher-push-notifications\n\nManage pusher interest subscriptions from within React Native JS\n\n**UPDATE: 4/02/2021**\n[LuminateOne](https://www.luminate.one/) have taken over maintaince of this project, release 2.5 is now out which contains data handling for android apps\n\nMore information about Pusher Beams and their Swift library, `push-notifications-swift`, can be found on their [Github repo](https://github.com/pusher/push-notifications-swift).\n\n[![npm version](https://badge.fury.io/js/react-native-pusher-push-notifications.svg)](https://badge.fury.io/js/react-native-pusher-push-notifications)\n\n## Requirements\n**This branch is only compatible with React Native \u003e0.60.x**\n\n## Getting started\n\n`$ npm install react-native-pusher-push-notifications --save`\n\nor yarn\n\n`$ yarn add react-native-pusher-push-notifications`\n\n## Automatic installation\n\nReact native link will install the pods required for this to work automatically.\n\n### Install via yarn/npm\n```\nyarn add react-native-pusher-push-notifications\n```\n\n### Additional, Manual Steps Required\n\n#### iOS\n\n\n** DO NOT follow the pusher.com push notification docs that detail modifying the AppDelegate.h/m files! - this package takes care of most of the steps for you**\n\n1. Open ios/PodFile and update `platform :ios, '9.0'` to `platform :ios, '10.0'`\n2.  Open `AppDelegate.m` and add:\n\n```\n    // Add this at the top of AppDelegate.m\n    #import \u003cRNPusherPushNotifications.h\u003e\n\n    // Add the following as a new methods to AppDelegate.m\n    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {\n      NSLog(@\"Registered for remote with token: %@\", deviceToken);\n      [[RNPusherPushNotifications alloc] setDeviceToken:deviceToken];\n    }\n\n    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {\n      [[RNPusherPushNotifications alloc] handleNotification:userInfo];\n    }\n\n    -(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {\n      NSLog(@\"Remote notification support is unavailable due to error: %@\", error.localizedDescription);\n    }\n```\n\n#### Enable remote notifications\n\nTo receive background push notifications you will need to enable Remote notifications capability In Xcode.\n\n1. Open your workspace Xcode and select your project\n2. Go go Signing \u0026 Capabilities tab\n3. If you don't have Background modes enabled, click `+ Capability`\n4. Make sure `Remote notifications` is checked\n\n##### Possible Issues\n\n- `linker command failed with exit code 1 (use -v to see invocation)`\n    1. Open ios/YourAppName.xcodeproj in XCode\n    2. Right click on Your App Name in the Project Navigator on the left, and click \"New File…\"\n    3. Create a single empty Swift file to the project (make sure that Your App Name target is selected when adding)\n    4. when Xcode asks, press Create Bridging Header and do not remove Swift file then. re-run your build.\n\n\n#### Android\n\nRefer to https://docs.pusher.com/beams/reference/android for up-to-date Pusher Beams installation \ninstructions (summarized below):\n\n1. Update `android/build.gradle`\n\n```gradle\nbuildscript {\n    // ...\n    dependencies {\n        // ...\n        // Add this line\n        classpath('com.google.gms:google-services:4.3.0')\n    }\n}    \n```\n\n2. Add this to `android/app/build.gradle`:\n\n```gradle\n\n// add to plugins\nplugins {\n    ...\n    id('com.google.gms.google-services')\n}\n\ndependencies {\n    ...\n    implementation 'com.google.firebase:firebase-messaging:20.0.0'\n    implementation project(':react-native-pusher-push-notifications')\n    implementation 'com.pusher:push-notifications-android:1.4.4'\n}\n```\n\n3. Update `android/settings.gradle`\n```\napply from: file(\"../node_modules/@react-native-community/cli-platform-android/native_modules.gradle\"); applyNativeModulesSettingsGradle(settings)\n...\ninclude ':react-native-pusher-push-notifications'\nproject(':react-native-pusher-push-notifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-pusher-push-notifications/android')\n...\ninclude ':app'\n```\n\n4. Set up `android/app/google-services.json`\n\n    This file is generated via [Google Firebase](https://console.firebase.google.com) console when creating a new app. Setup your app there and download the file.\n    \n    Pusher Beams requires a FCM secret, this is also found under Cloud Messaging in Google Firebase.\n\n5. Add react-native.config.js to root of react-native directory\n```\nmodule.exports = {\n    dependencies: {\n        \"react-native-pusher-push-notifications\": {\n            platforms: {\n                android: null // this skips autolink for android\n            }\n        }\n    }\n};\n\n```\n\n6. Add `RNPusherPushNotificationsPackage` to `MainApplication.java`:\n```java\nimport com.b8ne.RNPusherPushNotifications.RNPusherPushNotificationsPackage;\n// ...\n@Override\n    protected List\u003cReactPackage\u003e getPackages() {\n      @SuppressWarnings(\"UnnecessaryLocalVariable\")\n      List\u003cReactPackage\u003e packages = new PackageList(this).getPackages();\n      // Packages that cannot be autolinked yet can be added manually here, for example:\n      // packages.add(new MyReactNativePackage());\n      packages.add(new RNPusherPushNotificationsPackage()); // \u003c\u003c Make sure this line is here \n      return packages;\n    }\n```\n\n#### _suggested, first time_ Clean caches and install all dependencies\n```\n\\\\ suggested commands; tested on osx\n\\\\ nuke node_modules\n$ rm -rf ./node_modules \u0026\u0026 yarn install\n\\\\ nuke pods\n$ rm -r ~/Library/Developer/Xcode/DerivedData ; cd ./ios \u0026\u0026 pod deintegrate \u0026\u0026 pod install ; cd ..\n\\\\ nuke gradle\n$ cd ./android \u0026\u0026 ./gradlew clean \u0026\u0026 ./gradlew --stop; cd ..\n```\n\n## Implementation\n\nIn typescript:\n\n```typescript jsx\nimport {Platform} from \"react-native\";\nimport {PUSHER_BEAMS_INSTANCE_ID} from \"react-native-dotenv\";\nimport RNPusherPushNotifications from \"react-native-pusher-push-notifications\";\n\nconst init= (): void =\u003e {\n    RNPusherPushNotifications.setInstanceId(PUSHER_BEAMS_INSTANCE_ID);\n\n    RNPusherPushNotifications.on(\"notification\", handleNotification);\n    RNPusherPushNotifications.setOnSubscriptionsChangedListener(onSubscriptionsChanged);\n};\n\nconst subscribe = (interest: string): void =\u003e {\n    console.log(`Subscribing to \"${interest}\"`);\n    RNPusherPushNotifications.subscribe(\n        interest,\n        (statusCode, response) =\u003e {\n            console.error(statusCode, response);\n        },\n        () =\u003e {\n            console.log(`CALLBACK: Subscribed to ${interest}`);\n        }\n    );\n};\n\nconst handleNotification = (notification: any): void =\u003e {\n    console.log(notification);\n    if (Platform.OS === \"ios\") {\n        console.log(\"CALLBACK: handleNotification (ios)\");\n    } else {\n        console.log(\"CALLBACK: handleNotification (android)\");\n        console.log(notification);\n    }\n};\n\nconst onSubscriptionsChanged = (interests: string[]): void =\u003e {\n    console.log(\"CALLBACK: onSubscriptionsChanged\");\n    console.log(interests);\n}\n```\n\n## Usage\n\n```jsx\n// Import module\nimport RNPusherPushNotifications from 'react-native-pusher-push-notifications';\n\n// Get your interest\nconst donutsInterest = 'debug-donuts';\n\n// Initialize notifications\nexport const init = () =\u003e {\n  // Set your app key and register for push\n  RNPusherPushNotifications.setInstanceId(CONSTANTS.PUSHER_INSTANCE_ID);\n\n  // Init interests after registration\n  RNPusherPushNotifications.on('registered', () =\u003e {\n    subscribe(donutsInterest);\n  });\n\n  // Setup notification listeners\n  RNPusherPushNotifications.on('notification', handleNotification);\n\n  // Optionally you can assign the listeners to variables so you can clean them up later.\n  //    const listener = RNPusherPushNotifications.on('registered', () =\u003e {});\n  //    listener.remove();\n};\n\n// Handle notifications received\nconst handleNotification = notification =\u003e {\n  console.log(notification);\n\n  // iOS app specific handling\n  if (Platform.OS === 'ios') {\n    switch (notification.appState) {\n      case 'inactive':\n      // inactive: App came in foreground by clicking on notification.\n      //           Use notification.userInfo for redirecting to specific view controller\n      case 'background':\n      // background: App is in background and notification is received.\n      //             You can fetch required data here don't do anything with UI\n      case 'active':\n      // App is foreground and notification is received. Show a alert or something.\n      default:\n        break;\n    } else {\n        // console.log(\"android handled notification...\");\n    }\n  }\n};\n\n// Subscribe to an interest\nconst subscribe = interest =\u003e {\n  // Note that only Android devices will respond to success/error callbacks\n  RNPusherPushNotifications.subscribe(\n    interest,\n    (statusCode, response) =\u003e {\n      console.error(statusCode, response);\n    },\n    () =\u003e {\n      console.log('Success');\n    }\n  );\n};\n\n// Unsubscribe from an interest\nconst unsubscribe = interest =\u003e {\n  RNPusherPushNotifications.unsubscribe(\n    interest,\n    (statusCode, response) =\u003e {\n      console.tron.logImportant(statusCode, response);\n    },\n    () =\u003e {\n      console.tron.logImportant('Success');\n    }\n  );\n};\n```\n\n## iOS only methods\n\n```jsx\n// Set interests\nconst donutInterests = ['debug-donuts', 'debug-general'];\nconst setSubscriptions = donutInterests =\u003e {\n  // Note that only Android devices will respond to success/error callbacks\n  RNPusherPushNotifications.setSubscriptions(\n    donutInterests,\n    (statusCode, response) =\u003e {\n      console.error(statusCode, response);\n    },\n    () =\u003e {\n      console.log('Success');\n    }\n  );\n};\n```\n\n# Sample Payload\n\n`POST` to `https://{pusher_instance_id}.pushnotifications.pusher.com/publish_api/v1/instances/{pusher_instance_id}/publishes` with headers:\n```headers\n    Content-Type: application/json\n    Authorization: Bearer {pusher_secret_key}\n```\n```json\n{\n  \"interests\": [\n  \t\"debug-donuts\"\n  ],\n  \"apns\": {\n    \"aps\": {\n    \t\"alert\" : {\n\t      \"title\": \"iOS Notification\",\n\t      \"body\": \"Hello ios user\",\n    \t},\n    \"sound\": \"default\"\n    \"badge\": 12,\n    \"data\": {\n      \t\"example\": \"hello world\"\n      }\n    }\n  },\n  \"fcm\": {\n    \"notification\": {\n      \"title\": \"Android notification\",\n      \"body\": \"Hello android user\"\n    },\n    \"data\": {\n      \"example\": \"hello world\"\n    }\n  }\n}\n\n```\n\n## Increment Badge number\n\nThe APS data sent to Pusher Beams and then to Apple have an option `badge`. This will update your apps badge counter to the current number. If you send 1, the badge will show 1. This means you need to handle notification read status in your backend and when pushing update to the current number.\n\nBy adding `incrementBadge` you can increment the badge number without having to deal with your backend.\n\n```json\n{\n  \"aps\": {\n    \"data\": {\n      \"incrementBadge\": true\n    }\n  }\n}\n```\n\n## Data handling Android\n\nWhen the application does not have focus the extra data is passed to the application via its lunanching intent which will need to be passed to the service\n\n```\nimport com.b8ne.RNPusherPushNotifications.NotificationsMessagingService;\n\npublic class MainActivity extends ReactActivity {\n\n...\n  protected void onStart() {\n    super.onStart();\n\n    ReactInstanceManager reactInstanceManager = getReactNativeHost().getReactInstanceManager();\n    NotificationsMessagingService.read(reactInstanceManager, this);\n  }\n\n  @Override\n  public void onNewIntent(Intent intent) {\n    super.onNewIntent(intent);\n    setIntent(intent);\n    ReactInstanceManager reactInstanceManager = getReactNativeHost().getReactInstanceManager();\n    NotificationsMessagingService.read(reactInstanceManager, this);\n  }\n}\n\n```\n\nIf you have a splash screen you will need to forward the intent extras to your MainActivity\n\n```\n\npublic class SplashActivity extends AppCompatActivity {\n...\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.launch_screen);\n\t\n        final Intent splashScreenIntent = getIntent();\n\n        new Handler().postDelayed(new Runnable(){\n            @Override\n            public void run() {\n                Intent intent = new Intent(SplashActivity.this, MainActivity.class);\n                intent.putExtras(splashScreenIntent);\n                startActivity(intent);\n                finish();\n            }\n        }, SPLASH_DISPLAY_LENGTH);\n\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb8ne%2Freact-native-pusher-push-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb8ne%2Freact-native-pusher-push-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb8ne%2Freact-native-pusher-push-notifications/lists"}