We are pleased to announce that the OneSignal Go API Client Library is now available. This new Go client supports developers using OneSignal by facilitating integrating the OneSignal REST API with your backend events, data, and more. This release is part of our ongoing initiative to add server SDKs across various languages and technologies.

Go is an increasingly popular open-source programming language supported by Google. Its static typing, run-time efficiency, readability, high-performance networking, and multiprocessing characteristics make Go an excellent developer choice.

Getting Started

Installation

go get github.com/OneSignal/onesignal-go-api

Install the following dependencies:

go get golang.org/x/oauth2

Then import the OneSignal Go package:

import "onesignal"

Authorization

Use a OneSignal authentication context for each auth type:

  • AppAuth
  • UserAuth

app_key

appAuth := context.WithValue(context.Background(), onesignal.AppAuth, "APP_KEY_STRING")

user_key

userAuth := context.WithValue(context.Background(), onesignal.UserAuth, "USER_KEY_STRING")

Reference

Visit our REST API Reference documentation for a complete list of our supported endpoints.

Visit our Go API reference for a list of supported functions and view implementation examples in Go.

Share Your Feedback

If you’ve had a chance to use our new Go SDK and have any feedback or suggestions you’d like to share, please reach out to us on the GitHub repository or our Discord server.

If you encounter any bugs or technical issues while using our new Go SDK, we want to know so we can make things right. Please be sure to file a report on our GitHub repository.

If you’ve found the plugin helpful, we’d appreciate it if you left us a review on G2.