{"id":15661129,"url":"https://github.com/adamcooke/apns-proxy","last_synced_at":"2025-05-05T21:33:47.174Z","repository":{"id":18037552,"uuid":"21079607","full_name":"adamcooke/apns-proxy","owner":"adamcooke","description":"A proxy for sending requests to the Apple Push Notification Service","archived":false,"fork":false,"pushed_at":"2023-01-19T11:00:50.000Z","size":141,"stargazers_count":21,"open_issues_count":11,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T23:51:10.578Z","etag":null,"topics":["apns","ios","notifications","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/adamcooke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-21T21:48:59.000Z","updated_at":"2023-05-20T23:25:41.000Z","dependencies_parsed_at":"2023-02-10T22:45:25.557Z","dependency_job_id":null,"html_url":"https://github.com/adamcooke/apns-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamcooke%2Fapns-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamcooke%2Fapns-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamcooke%2Fapns-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamcooke%2Fapns-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamcooke","download_url":"https://codeload.github.com/adamcooke/apns-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252580003,"owners_count":21771249,"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":["apns","ios","notifications","ruby"],"created_at":"2024-10-03T13:26:03.408Z","updated_at":"2025-05-05T21:33:47.134Z","avatar_url":"https://github.com/adamcooke.png","language":"Ruby","readme":"# APNS Proxy\n\nThis is a Rails application which orchestrates the sending of push notifications\nfrom applications to the Apple Push Notification Service (APNS). Rather than\nindividual applications talking to APNS directly, they send an HTTP request to\nthis service which maintains a connection to the APNS service and delivers\nthe notification down this persistent connection.\n\n* Manage multiple applications\n* Handle multiple environments per application - different APNS certificates\n  for your Beta, Release and Debug builds if needed.\n* Keep track of the notifications sent.\n* Monitors for device unsubscriptions and alerts the sending application next\n  time it tries to send a message.\n\n## Requirements\n\n* A MySQL database server\n* A RabbitMQ server\n* Ruby 2.3 or above\n\n## Installation\n\nTo install this service, just follow these instructions. Before you run these\nbe sure to set up a backend database. At present only MySQL has been tested.\n\n```\ngit clone git://github.com/adamcooke/apns-proxy.git\ncd apns-proxy\nbundle install --without development\n# Open config/database.yml and add appropriate DB connection details\nrake db:schema:load\nrake apns_proxy:setup\n```\n\nOnce this is setup, you can then run the tasks outlined in the next section.\nThe default username is **admin** and the default password is **password**.\n\n## Server Tasks\n\n* **Web Server** - you should run the web server to provide an admin interface\n  as well as the HTTP API service used for sending notifications. This runs\n  continuously.\n\n  ```\n  rails server\n  ```\n\n* **Worker** - the worker is responsible for sending notifications from the\n  local system to the APNS backend. This runs continuously.\n\n  ```\n  rake apns_proxy:worker\n  ```\n\nThere is a `Procfile` provided so APNS Proxy can be run on services like [Viaduct](https://viaduct.io)\nand Heroku but can also be executed using process managers like [Procodile](https://github.com/adamcooke/procodile)\nand Foreman.\n\n## API Methods\n\nThis section outlines the HTTP API methods which are available to you and are\nused for sending notifications and registering devices.\n\nThis is an HTTP JSON API and parameters should be sent as JSON in the body of\nthe HTTP request. It is recommended that you use the POST HTTP verb for all\nrequests. Any parameters shown below which include periods represent a hash\nwhich should be passed.\n\n### Sending Notifications\n\nIn order to send a notification, you will need an `auth_key` and a device\nidentifier.\n\n```\nPOST /api/notify\n```\n\n* `auth_key` - your auth key (string, required)\n* `device` - the device identifier (string, required)\n* `notification.alert.body` - the text body for your notification (string)\n* `notification.alert.action_loc_key` - localization key for your action button (string)\n* `notification.alert.loc_key` - localization key for your alert message (string)\n* `notification.alert.log_args` - arguments for your localization (array of strings)\n* `notification.alert.launch_image` - the launch image to display (string)\n* `notification.sound` - the name of a sound file to play (string)\n* `notification.badge` - the badge to display on the app (integer)\n* `notification.content_available` - whether content is available or not (boolean)\n* `notification.custom_data` - custom data to return to the API (hash)\n\n**NOTE:** APNS allows a maximum of 256 bytes to be sent to them so you should\nensure that your notification is smaller than this. There is a some overhead.\nIf your notification is too big, the interface will provide you with a `2000`\nerror code.\n\nWhen you submit this, you will receive either a `201 Created` status which\nmeans that your notification was added and delivery will be attempted. If there\nis an error, you'll receive a `422 Unprocessable Entity` status and the response\nbody will contain an array of `errors`.\n\nThe most significant thing to look out for is information that a device you\nare sending notifications for has been unsubscribed. Such an issue will look\nthis like in the response body:\n\n```javascript\n{\n  \"errors\": {\n    \"device\": [ \"unsubscribed\" ]\n  }\n}\n```\n\n### Registering devices\n\nIt is strongly recommended to let the proxy service know whenever a new device\nis registered with your application. This allows us to help manage the\nunsubscriptions for your application and ensure that certificates aren't\nblocked by Apple.\n\n```\nPOST /api/register\n```\n\n* `auth_key` - your auth key (string, required)\n* `device` - the device identifier (string, required)\n* `label` - a label to identified this device in the admin UI (string)\n\nYou will always receive a `200 OK` from this message with a response body\nsimilar to that shown below:\n\n```javascript\n{\n  \"device\": 1,\n  \"status\": \"ok\"\n}\n```\n\n## Licence\n\nThis software is licenced under the MIT-LICENSE.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamcooke%2Fapns-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamcooke%2Fapns-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamcooke%2Fapns-proxy/lists"}