https://github.com/9ssi7/exponent
Send push notifications to Expo apps using Golang
https://github.com/9ssi7/exponent
expo expo-push-notifications exponent golang
Last synced: 4 months ago
JSON representation
Send push notifications to Expo apps using Golang
- Host: GitHub
- URL: https://github.com/9ssi7/exponent
- Owner: 9ssi7
- License: apache-2.0
- Created: 2024-12-08T11:47:16.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-01-23T10:34:22.000Z (10 months ago)
- Last Synced: 2025-07-30T06:10:50.473Z (4 months ago)
- Topics: expo, expo-push-notifications, exponent, golang
- Language: Go
- Homepage: https://docs.expo.dev/push-notifications/sending-notifications
- Size: 17.6 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# exponent
Send push notifications to Expo apps using Golang
revised version of: https://github.com/oliveroneill/exponent-server-sdk-golang/tree/master
## Documentation
[](https://pkg.go.dev/github.com/9ssi7/exponent)
## Installation
```
go get github.com/9ssi7/exponent
```
## Usage
```go
package main
import (
"context"
"time"
"github.com/9ssi7/exponent"
)
func main() {
c := exponent.NewClient(exponent.WithAccessToken("your-access-token"))
tkn := exponent.MustParseToken("ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]")
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
res, err := c.PublishSingle(ctx, &exponent.Message{
To: []*exponent.Token{tkn},
Body: "This is a test notification",
Data: exponent.Data{"withSome": "data"},
Sound: "default",
Title: "Notification Title",
Priority: exponent.DefaultPriority,
})
if err != nil {
panic(err)
}
for _, receipt := range res {
if receipt.IsOk() {
println("Notification sent successfully")
} else {
println("Notification failed")
}
}
}
```
## Contributing
We welcome contributions! Please see our [Contribution Guidelines](CONTRIBUTING.md) for details.
## License
This project is licensed under the Apache License. See [LICENSE](LICENSE) for more details.