/onesignal-go-sample

Onesignal reference integration sample for Go client.

Primary LanguageGo

Quickstart   •   Website   •   Docs   •   Examples

OneSignal

OneSignal Go Client Sample

OneSignal makes engaging customers simple and is the fastest, most reliable service to send push notifications, in-app messages, SMS, and emails.

This project demonstrates sending push notifications using the onesignal-go-api Go package. You can use this project as a boilerplate or reference to start your project.

🚦 Getting started

This project assumes that you already have a OneSignal app created with push notifications setup. If you don't yet have a OneSignal app, create one first, then follow the steps below to integrate the OneSignal SDK into your Android or iOS app.

  1. Rename .env.example to .env, mv .env.example .env
  2. Set environment variables
  3. Run the app, go run .

Running this example will result in a notification being sent to all subscribed users of your OneSignal app and the following output:

╭─iamwill@kronos ~/code/@onesignalDevelopers/onesignal-go-sample ‹main●›
╰─$ go run .
Response from `CreateNotification`: &{fa7b2782-3ef7-4f44-b8f3-bba3721797a5 5 <nil> <nil> map[]}
Notification ID: fa7b2782-3ef7-4f44-b8f3-bba3721797a5

Environment variables

Name Where to find it
APP_ID URL in app dashboard -> https://app.onesignal.com/apps/<APP_ID>
USER_AUTH_KEY OneSignal profile page
REST_API_KEY App settings -> https://app.onesignal.com/apps/<APP_ID>/settings/keys_and_ids

Support

Ask a question about OneSignal

You can ask questions about the OneSignal Go API client and related topics in the onesignal-go-api repository.

🙋‍♂️ Ask a question

Create a bug report

If you receive an error message or get blocked by an issue, please create a bug report!

🪳 Create bug report

❤️ Developer Community

For additional resources, please join the OneSignal Developer Community.

Get in touch with us or learn more about OneSignal through the channels below.

Show your support

Give a ⭐️ if this project helped you, and watch this repo to stay up to date.