Skip to content

Go (golang) library for sending push notifications using Amazon SNS (AWS SNS)

License

Notifications You must be signed in to change notification settings

Iwark/pushnotification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pushnotification

GoDoc License

Package pushnotification sends push notification via Amazon SNS

Example

package main

import (
	"log"
	"os"

	"github.com/Iwark/pushnotification"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/joho/godotenv"
)

func main() {
	if err := godotenv.Load(); err != nil {
		log.Fatal(err)
	}

	push := pushnotification.Service{
		AWSAccessKey:         os.Getenv("AWSAccessKey"),
		AWSAccessSecret:      os.Getenv("AWSAccessSecret"),
		AWSSNSApplicationARN: os.Getenv("AWSSNSApplicationARN"),
		AWSRegion:            os.Getenv("AWSRegion"),
	}

	err := push.Send(os.Getenv("DeviceToken"), &pushnotification.Data{
		Alert: aws.String("test message"),
		Sound: aws.String("default"),
		Badge: aws.Int(1),
	})
	if err != nil {
		log.Fatal(err)
	}
}

License

pushnotification is released under the MIT License.

About

Go (golang) library for sending push notifications using Amazon SNS (AWS SNS)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages