{"id":13486246,"url":"https://github.com/node-apn/node-apn","last_synced_at":"2025-12-14T21:41:39.955Z","repository":{"id":989931,"uuid":"797129","full_name":"node-apn/node-apn","owner":"node-apn","description":":calling: Apple Push Notification module for Node.js","archived":false,"fork":false,"pushed_at":"2024-06-26T13:12:20.000Z","size":1386,"stargazers_count":4414,"open_issues_count":98,"forks_count":688,"subscribers_count":110,"default_branch":"master","last_synced_at":"2025-04-30T12:18:51.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"nolimits4web/Framework7","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-apn.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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":"2010-07-25T21:15:03.000Z","updated_at":"2025-04-23T19:22:25.000Z","dependencies_parsed_at":"2023-02-10T22:15:41.134Z","dependency_job_id":"f82ec5fd-6c65-4964-b35c-79440ee27135","html_url":"https://github.com/node-apn/node-apn","commit_stats":{"total_commits":1051,"total_committers":79,"mean_commits":13.30379746835443,"dds":"0.15699333967649853","last_synced_commit":"38a357ed0c153aad09c2857e48a710527e685bfc"},"previous_names":["argon/node-apn"],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-apn%2Fnode-apn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-apn%2Fnode-apn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-apn%2Fnode-apn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-apn%2Fnode-apn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-apn","download_url":"https://codeload.github.com/node-apn/node-apn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252963853,"owners_count":21832582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-07-31T18:00:42.425Z","updated_at":"2025-12-14T21:41:39.899Z","avatar_url":"https://github.com/node-apn.png","language":"JavaScript","funding_links":[],"categories":["Libraries","JavaScript","🔧 Utilities \u0026 Miscellaneous"],"sub_categories":["Push Notifications"],"readme":"[\u003cp align=\"center\"\u003e\u003cimg src=\"doc/logo.png\" alt=\"node-apn\" width=\"450\" height=\"auto\"\u003e\u003c/p\u003e][node-apn]\n\nnode-apn\n========\n\n\u003e A Node.js module for interfacing with the Apple Push Notification service.\n\n[![Maintenance help wanted](https://img.shields.io/badge/maintenance-help%20wanted-red.svg)](https://github.com/node-apn/node-apn/issues/436)\n[![Build status][ci-image] ][ci-url]\n[![Code coverage][coverage-image]][coverage-url]\n[![Codacy][codacy-image]][codacy-url]\n[![dependencies][dependencies-image]][dependencies-url]\n[![devdependencies][devdependencies-image]][devdependencies-url]\n\n[logo]:doc/logo.png\n[npm-image]:https://nodei.co/npm/apn.png?downloads=true\n[npm-url]:https://npmjs.com/package/apn\n[ci-image]:https://api.travis-ci.org/node-apn/node-apn.svg\n[ci-url]:https://travis-ci.org/node-apn/node-apn\n[coverage-image]:https://coveralls.io/repos/argon/node-apn/badge.svg?branch=develop\n[coverage-url]:https://coveralls.io/r/argon/node-apn\n[codacy-image]:https://www.codacy.com/project/badge/e7735fbe0db244f3b310657d0dabaa11\n[codacy-url]:https://www.codacy.com/public/argon/node-apn\n\n[dependencies-image]:https://david-dm.org/node-apn/node-apn/status.svg\n[dependencies-url]:https://david-dm.org/node-apn/node-apn\n[devdependencies-image]:https://david-dm.org/node-apn/node-apn/dev-status.svg\n[devdependencies-url]:https://david-dm.org/node-apn/node-apn?type=dev\n\n## Features\n\n- Based on HTTP/2 based provider API\n- Maintains a connection to the server to maximise notification batching and throughput.\n- Automatically resends unsent notifications if an error occurs\n\n## Installation\n\n[npm][] is the preferred installation method:\n\n```bash\n$ npm install apn --save\n```\n\n## Quick Start\n\nThis readme is a brief introduction, please refer to the full [documentation](doc/apn.markdown) in `doc/` for more details.\n\nIf you have previously used v1.x and wish to learn more about what's changed in v2.0, please see [What's New](doc/whats-new.markdown)\n\n### Load in the module\n\n```javascript\nvar apn = require('apn');\n```\n\n### Connecting\nCreate a new connection to the Apple Push Notification provider API, passing a dictionary of options to the constructor. You must supply your token credentials in the options.\n\n```javascript\nvar options = {\n  token: {\n    key: \"path/to/APNsAuthKey_XXXXXXXXXX.p8\",\n    keyId: \"key-id\",\n    teamId: \"developer-team-id\"\n  },\n  production: false\n};\n\nvar apnProvider = new apn.Provider(options);\n```\n\nBy default, the provider will connect to the sandbox unless the environment variable `NODE_ENV=production` is set.\n\nFor more information about configuration options consult the [provider documentation](doc/provider.markdown).\n\nHelp with preparing the key and certificate files for connection can be found in the [wiki][certificateWiki]\n\n#### Connecting through an HTTP proxy\n\nIf you need to connect through an HTTP proxy, you simply need to provide the `proxy: {host, port}` option when creating the provider. For example:\n\n```javascript\nvar options = {\n  token: {\n    key: \"path/to/APNsAuthKey_XXXXXXXXXX.p8\",\n    keyId: \"key-id\",\n    teamId: \"developer-team-id\"\n  },\n  proxy: {\n    host: \"192.168.10.92\",\n    port: 8080\n  },\n  production: false\n};\n\nvar apnProvider = new apn.Provider(options);\n```\n\nThe provider will first send an HTTP CONNECT request to the specified proxy in order to establish an HTTP tunnel. Once established, it will create a new secure connection to the Apple Push Notification provider API through the tunnel.\n\n### Sending a notification\nTo send a notification you will first need a device token from your app as a string\n\n```javascript\nlet deviceToken = \"a9d0ed10e9cfd022a61cb08753f49c5a0b0dfb383697bf9f9d750a1003da19c7\"\n```\n\nCreate a notification object, configuring it with the relevant parameters (See the [notification documentation](doc/notification.markdown) for more details.)\n\n```javascript\nvar note = new apn.Notification();\n\nnote.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.\nnote.badge = 3;\nnote.sound = \"ping.aiff\";\nnote.alert = \"\\uD83D\\uDCE7 \\u2709 You have a new message\";\nnote.payload = {'messageFrom': 'John Appleseed'};\nnote.topic = \"\u003cyour-app-bundle-id\u003e\";\n```\n\nSend the notification to the API with `send`, which returns a promise.\n\n```javascript\napnProvider.send(note, deviceToken).then( (result) =\u003e {\n  // see documentation for an explanation of result\n});\n```\n\nThis will result in the the following notification payload being sent to the device\n\n```json\n{\"messageFrom\":\"John Appleseed\",\"aps\":{\"badge\":3,\"sound\":\"ping.aiff\",\"alert\":\"\\uD83D\\uDCE7 \\u2709 You have a new message\"}}\n```\n\nYou should only create one `Provider` per-process for each certificate/key pair you have. You do not need to create a new `Provider` for each notification. If you are only sending notifications to one app then there is no need for more than one `Provider`. \n\nIf you are constantly creating `Provider` instances in your app, make sure to call `Provider.shutdown()` when you are done with each provider to release its resources and memory.\n\n## Troubleshooting\n\nYou are encouraged to read the extremely informative [Troubleshooting Push Notifications][tn2265] Tech Note in the first instance, in case your query is answered there.\n\n## Support\n\nIf you have any questions or difficulties working with the module, the [node-apn Google group][googlegroup] should be your first port of call.\n\nPlease include as much detail as possible - especially debug logs. If the problem is reproducible, sample code is also extremely helpful. GitHub Issues should only be created for verified problems and enhancements, this will allow them to be tracked more easily.\n\n## Resources\n\n* [Local and Push Notification Programming Guide: APNs Overview][pl]\n* [Apple Technical Note: Troubleshooting Push Notifications][tn2265]\n* [List of Projects, Applications and Companies Using Node-apn][pacapn]\n\n## Credits\n\nCreated by [Andrew Naylor][argon]\n\nThanks to: [Ian Babrou][bobrik], [dgthistle][dgthistle], [Keith Larsen][keithnlarsen], [Mike P][mypark], [Greg Bergé][neoziro], [Asad ur Rehman][AsadR], [Nebojsa Sabovic][nsabovic], [Alberto Gimeno][gimenete], [Randall Tombaugh][rwtombaugh], [Michael Stewart][thegreatmichael], [Olivier Louvignes][mgcrea], [porsager][porsager], [Craig Hockenberry][chockenberry]\n\n## License\n\nReleased under the MIT License\n\n\u003e Copyright (c) 2013 Andrew Naylor\n\u003e\n\u003e Permission is hereby granted, free of charge, to any person obtaining a copy\n\u003e of this software and associated documentation files (the \"Software\"), to deal\n\u003e in the Software without restriction, including without limitation the rights\n\u003e to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\u003e copies of the Software, and to permit persons to whom the Software is\n\u003e furnished to do so, subject to the following conditions:\n\u003e\n\u003e The above copyright notice and this permission notice shall be included in\n\u003e all copies or substantial portions of the Software.\n\u003e\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[npm]: https://npmjs.org\n[node-apn]: https://github.com/node-apn/node-apn\n[certificateWiki]:https://github.com/node-apn/node-apn/wiki/Preparing-Certificates \"Preparing Certificates\"\n[pl]: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html \"Local and Push Notification Programming Guide: APNs Overview\"\n[tn2265]: http://developer.apple.com/library/ios/#technotes/tn2265/_index.html \"Troubleshooting Push Notifications\"\n[googlegroup]:https://groups.google.com/group/node-apn \"node-apn Google Group\"\n[pacapn]:https://github.com/node-apn/node-apn/wiki/Projects,-Applications,-and-Companies-Using-Node-apn \"List of Projects, Applications and Companies Using node-apn\"\n[argon]: https://github.com/argon\n[bobrik]: https://github.com/bobrik\n[dgthistle]: https://github.com/dgthistle\n[keithnlarsen]: https://github.com/keithnlarsen\n[mypark]: https://github.com/mypark\n[neoziro]: https://github.com/neoziro\n[AsadR]: https://github.com/AsadR\n[nsabovic]: https://github.com/nsabovic\n[gimenete]: https://github.com/gimenete\n[rwtombaugh]: https://github.com/rwtombaugh\n[thegreatmichael]: https://github.com/thegreatmichael\n[mgcrea]: https://github.com/mgcrea\n[porsager]: https://github.com/porsager\n[chockenberry]: https://github.com/chockenberry\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-apn%2Fnode-apn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-apn%2Fnode-apn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-apn%2Fnode-apn/lists"}