https://github.com/drewalth/notify
Push notifications with the AWS SNS Go SDK
https://github.com/drewalth/notify
aws aws-sns go golang ios push-notifications
Last synced: 2 months ago
JSON representation
Push notifications with the AWS SNS Go SDK
- Host: GitHub
- URL: https://github.com/drewalth/notify
- Owner: drewalth
- Created: 2022-12-10T06:03:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T17:33:36.000Z (over 3 years ago)
- Last Synced: 2025-01-08T19:20:49.994Z (over 1 year ago)
- Topics: aws, aws-sns, go, golang, ios, push-notifications
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# notify
Wrapper for the AWS SNS Go SDK.
- [x] Send push notification
- [x] Register user device with SNS
- [x] Remove user device/endpoint from SNS
---
```shell
# copy demo env file
cp ./examples/.env.example ./examples/.env
# replace values with your application ARN and device token
DEVICE_TOKEN=
PLATFORM_APP_ARN=
# send yourself a notification
go run examples/examples.go
```
```go
// examples/examples.go
client := notify.NewClient(appARN, &session.Options{
SharedConfigState: session.SharedConfigEnable,
})
alert := notify.Alert{
Body: aws.String("Alert body"),
Title: aws.String("Alert title"),
}
notificationSound := "default"
notificationBadge := 0
pushData := notify.Push{
Alert: &alert,
Sound: ¬ificationSound,
Badge: ¬ificationBadge,
}
endpointArn, err := client.GetTokenArn(deviceToken)
check(err)
result, err := client.Send(endpointArn, &pushData)
check(err)
fmt.Println(*result.MessageId)
```