Go Client SDK

The OneSignal Go client is a server OneSignal SDK for Golang. Integrate OneSignal with your backend events, data, and more.

Installation

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

Install the following dependencies:

go get golang.org/x/oauth2

Put the package under your project folder and add the following in import:

go get golang.org/x/oauth2

Authorization

Use a OneSignal authentication context for each auth type:

  • AppAuth
  • UserAuth

app_key

  • Type: HTTP Bearer token authentication

Example

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

user_key

  • Type: HTTP Bearer token authentication

Example

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

Documentation for API Endpoints

All URIs are relative to https://onesignal.com/api/v1

ClassMethodHTTP requestDescription
DefaultApiCancelNotificationDelete /notifications/{notification_id}Stop a scheduled or currently outgoing notification
DefaultApiCreateAppPost /appsCreate an app
DefaultApiCreateNotificationPost /notificationsCreate notification
DefaultApiCreatePlayerPost /playersAdd a device
DefaultApiCreateSegmentsPost /apps/{app_id}/segmentsCreate Segments
DefaultApiDeletePlayerDelete /players/{player_id}Delete a user record
DefaultApiDeleteSegmentsDelete /apps/{app_id}/segments/{segment_id}Delete Segments
DefaultApiExportPlayersPost /players/csv_export?app_id={app_id}CSV export
DefaultApiGetAppGet /apps/{app_id}View an app
DefaultApiGetAppsGet /appsView apps
DefaultApiGetNotificationGet /notifications/{notification_id}View notification
DefaultApiGetNotificationHistoryPost /notifications/{notification_id}/historyNotification History
DefaultApiGetNotificationsGet /notificationsView notifications
DefaultApiGetOutcomesGet /apps/{app_id}/outcomesView Outcomes
DefaultApiGetPlayerGet /players/{player_id}View device
DefaultApiGetPlayersGet /playersView devices
DefaultApiUpdateAppPut /apps/{app_id}Update an app
DefaultApiUpdatePlayerPut /players/{player_id}Edit device
DefaultApiUpdatePlayerTagsPut /apps/{app_id}/users/{external_user_id}Edit tags with external user id

Did this page help you?