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-api
Install the following dependencies:
go get golang.org/x/oauth2
Then import the OneSignal Go package:
import "github.com/OneSignal/onesignal-go-api"
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
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | CancelNotification | Delete /notifications/{notification_id} | Stop a scheduled or currently outgoing notification |
DefaultApi | CreateApp | Post /apps | Create an app |
DefaultApi | CreateNotification | Post /notifications | Create notification |
DefaultApi | CreatePlayer | Post /players | Add a device |
DefaultApi | CreateSegments | Post /apps/{app_id}/segments | Create Segments |
DefaultApi | DeletePlayer | Delete /players/{player_id} | Delete a user record |
DefaultApi | DeleteSegments | Delete /apps/{app_id}/segments/{segment_id} | Delete Segments |
DefaultApi | ExportPlayers | Post /players/csv_export?app_id={app_id} | CSV export |
DefaultApi | GetApp | Get /apps/{app_id} | View an app |
DefaultApi | GetApps | Get /apps | View apps |
DefaultApi | GetNotification | Get /notifications/{notification_id} | View notification |
DefaultApi | GetNotificationHistory | Post /notifications/{notification_id}/history | Notification History |
DefaultApi | GetNotifications | Get /notifications | View notifications |
DefaultApi | GetOutcomes | Get /apps/{app_id}/outcomes | View Outcomes |
DefaultApi | GetPlayer | Get /players/{player_id} | View device |
DefaultApi | GetPlayers | Get /players | View devices |
DefaultApi | UpdateApp | Put /apps/{app_id} | Update an app |
DefaultApi | UpdatePlayer | Put /players/{player_id} | Edit device |
DefaultApi | UpdatePlayerTags | Put /apps/{app_id}/users/{external_user_id} | Edit tags with external user id |
Updated about 2 years ago