https://github.com/gootsolution/pushbell
pushbell is a Go library for sending web push notifications with support for the VAPID (Voluntary Application Server Identification) specification.
https://github.com/gootsolution/pushbell
go vapid webpush
Last synced: 29 days ago
JSON representation
pushbell is a Go library for sending web push notifications with support for the VAPID (Voluntary Application Server Identification) specification.
- Host: GitHub
- URL: https://github.com/gootsolution/pushbell
- Owner: gootsolution
- License: mit
- Created: 2024-04-18T12:31:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-01T10:42:18.000Z (11 months ago)
- Last Synced: 2025-04-01T11:32:26.453Z (11 months ago)
- Topics: go, vapid, webpush
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pushbell



[](https://github.com/gootsolution/pushbell/actions/workflows/lint-and-test.yml)
pushbell is a Go library for sending web push notifications with support
for the VAPID (Voluntary Application Server Identification) specification.
## Features
- Full implementation of the [encryption](https://datatracker.ietf.org/doc/html/rfc8291)
and [Web Push](https://datatracker.ietf.org/doc/html/rfc8030) specification,
including [VAPID](https://datatracker.ietf.org/doc/html/rfc8292).
- Support for multiple push services (Firefox, Chrome, etc.).
- Use [fasthttp](https://github.com/valyala/fasthttp) client.
- Simple and intuitive API.
## Installation
```shell
go get -u github.com/gootsolution/pushbell
```
## Example
```go
package main
import (
"github.com/gootsolution/pushbell"
)
func main() {
applicationServerPrivateKey := "QxfAyO5dMMrSvDT2_xHxW5aktYPWGE_hT42RKlHilpQ"
applicationServerPublicKey := "BIRM67G3W1fva-ephDo220BbiaOOy-SBk2uzHsmlqMXp_OmkKxYW96cOK5EWnKdkLg2i7N4FYfuxIwm7JWThVSY"
opts := pushbell.NewOptions().ApplyKeys(applicationServerPublicKey, applicationServerPrivateKey)
pb, err := pushbell.NewService(opts)
if err != nil {
panic(err)
}
subscriptionEndpoint := "https://fcm.googleapis.com/fcm/send/e2CN0r8ft38:APA91bES3NaBHe_GgsRp_3Ir7f18L38wA5XYRoqZCbjMPEWnkKa07uxheWE5MGZncsPOr0_34zLaFljVqmNqW76KhPSrjdy_pdInnHPEIYAZpdcIYk8oIfo1F_84uKMSqIDXRhngL76S"
subscriptionAuth := "rm_owGF0xliyVXsrZk1LzQ"
subscriptionP256DH := "BKm5pKbGwkTxu7dJuuLyTCBOCuCi1Fs01ukzjUL5SEX1-b-filqeYASY6gy_QpPHGErGqAyQDYAtprNWYdcsM3Y"
message := []byte("{\"title\": \"My first message\"}")
err = pb.Send(&pushbell.Push{
Endpoint: subscriptionEndpoint,
Auth: subscriptionAuth,
P256DH: subscriptionP256DH,
Plaintext: message,
})
if err != nil {
panic(err)
}
}
```
**NOTE:** You can use [this](https://gootsolution.github.io/pushbell/) to play around and make tests without your
service workers.
## Documentation
Detailed API documentation is available on [pkg.go.dev](https://pkg.go.dev/github.com/gootsolution/pushbell).
## License
This project is distributed under the MIT License.
## Support and Contributing
If you have any questions, issues, or suggestions, please create an issue in this repository. Pull requests with fixes
and improvements are also welcome.