{"id":26648928,"url":"https://github.com/kataras/azurepush","last_synced_at":"2025-03-25T00:47:22.616Z","repository":{"id":283881140,"uuid":"953040323","full_name":"kataras/azurepush","owner":"kataras","description":"Cross-platform push notification library for Azure Notification Hubs (iOS + Android) in Go","archived":false,"fork":false,"pushed_at":"2025-03-22T18:56:41.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T19:30:47.166Z","etag":null,"topics":["apns","azure","fcm","go","mobile","notification-hubs","push-notifications","serverless"],"latest_commit_sha":null,"homepage":"https://learn.microsoft.com/en-us/azure/notification-hubs/","language":"Go","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/kataras.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":"2025-03-22T12:38:17.000Z","updated_at":"2025-03-22T18:56:45.000Z","dependencies_parsed_at":"2025-03-22T19:42:35.795Z","dependency_job_id":null,"html_url":"https://github.com/kataras/azurepush","commit_stats":null,"previous_names":["kataras/azurepush"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fazurepush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fazurepush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fazurepush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fazurepush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kataras","download_url":"https://codeload.github.com/kataras/azurepush/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245377955,"owners_count":20605375,"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","azure","fcm","go","mobile","notification-hubs","push-notifications","serverless"],"created_at":"2025-03-25T00:47:21.986Z","updated_at":"2025-03-25T00:47:22.573Z","avatar_url":"https://github.com/kataras.png","language":"Go","readme":"# azurepush\n\n[![build status](https://img.shields.io/github/actions/workflow/status/kataras/azurepush/ci.yml?branch=main\u0026style=for-the-badge)](https://github.com/kataras/azurepush/actions/workflows/ci.yml)\n\nGo client for Azure Notification Hubs (iOS + Android) with dynamic SAS authentication.\n\n## ✨ Features\n\n- ✅ Device registration (iOS + Android)\n- ✅ Push notification sending with per-user tagging\n- ✅ Auto-refreshing SAS token generation\n- ✅ YAML config loading (with support for full connection strings)\n- ✅ Single unified client struct with minimal boilerplate\n\n## ☁️ Azure Setup\n\n### 1. Create a Notification Hub\n\n- Azure Portal → **Create Resource** → **Notification Hub**\n- Create or choose an existing **Namespace** (e.g. `mynamespace`)\n- Create a **Hub** inside it (e.g. `myhubname`)\n\n### 2. Get Access Credentials\n\n- In Azure Portal → Your Notification Hub → **Access Policies**\n- Click `DefaultFullSharedAccessSignature` (or create your own)\n- Copy the **Connection String**, which looks like:\n\n```\nEndpoint=sb://mynamespace.servicebus.windows.net/;\nSharedAccessKeyName=DefaultFullSharedAccessSignature;\nSharedAccessKey=YOUR_SECRET_KEY\n```\n\n### 🔍 Azure Notification Hubs vs AWS SNS: Device Management Capabilities\n\nThe table below compares the core device management and introspection features between **AWS SNS** and **Azure Notification Hubs**:\n\n| Task                          | AWS SNS ✅     | Azure Notification Hubs ❌ |\n|-------------------------------|----------------|-----------------------------|\n| List all devices              | ✅ Yes         | ❌ No                       |\n| Browse per-user endpoints     | ✅ Yes         | ❌ No                       |\n| Store/send custom metadata    | ✅ Yes         | ✅ Yes (via tags or payload) |\n| View registrations in UI      | ✅ Yes         | ❌ No                       |\n| Delete devices by user        | ✅ Yes         | ❌ (You must track them)    |\n| Send to user/group            | ✅ Yes (topic/endpoint) | ✅ Yes (tags)      |\n\nSNS is both:\n- A messaging bus\n- A device registry (platform endpoint management)\n\nAzure Notification Hubs:\n\n- Delegates token management to you\n- Is intentionally stateless and write-only\n- Does not provide introspection over installations\n\n\n## 📦 Install\n\n```sh\ngo get github.com/kataras/azurepush@latest\n```\n\n## 🛠 Configuration Setup\n\n### Option 1: Use Individual Fields\n\n```yaml\n# configuration.yml\nHubName: \"myhubname\"\nNamespace: \"mynamespace\"\nKeyName: \"DefaultFullSharedAccessSignature\"\nKeyValue: \"YOUR_SECRET_KEY\"\nTokenValidity: \"2h\"\n```\n\n### Option 2: Use `ConnectionString` (Recommended)\n\n```yaml\n# configuration.yml\nHubName: \"myhubname\"\nConnectionString: \"Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=YOUR_SECRET_KEY\"\nTokenValidity: \"2h\"\n```\n\nThe library will auto-extract `Namespace`, `KeyName`, and `KeyValue` from the connection string.\n\n## 📱 Mobile Device Tokens\n\nIn your mobile apps:\n\n- For **iOS** (APNs), get the APNs device token\n- For **Android** (FCM), get the FCM registration token\n\nThen send it to your backend for registration using this package.\n\n## 🚀 Example Usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/kataras/azurepush\"\n)\n\nfunc main() {\n\tcfg, _ := azurepush.LoadConfiguration(\"configuration.yml\")\n\tclient := azurepush.NewClient(*cfg)\n\n\tid, err := client.RegisterDevice(context.Background(), azurepush.Installation{\n\t\tPlatform:    \"fcm\", // or \"apns\"\n\t\tPushChannel: \"fcm-or-apns-token\",\n\t\tTags:        []string{\"user:42\"},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_ = client.SendNotification(context.Background(), azurepush.Notification{\n\t\tTitle: \"Welcome\",\n\t\tBody:  \"Hello from AzurePush!\",\n\t\tData: map[string]any{\"key\": \"value\"},\n\t}, \"user:42\")\n}\n```\n\n## 📖 License\n\nThis software is licensed under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkataras%2Fazurepush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkataras%2Fazurepush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkataras%2Fazurepush/lists"}