From f6131b7f84fe6dcf07c16e7967e072dd9e16a0e3 Mon Sep 17 00:00:00 2001 From: OneSignal Date: Thu, 9 Apr 2026 21:33:15 +0000 Subject: [PATCH] docs: update README and DefaultApi.md snippets --- DefaultApi.md | 176 +++++++-------- README.md | 590 ++++---------------------------------------------- tsconfig.json | 1 + 3 files changed, 137 insertions(+), 630 deletions(-) diff --git a/DefaultApi.md b/DefaultApi.md index 21f7abd..62c560a 100644 --- a/DefaultApi.md +++ b/DefaultApi.md @@ -92,7 +92,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -108,7 +108,7 @@ Name | Type | Description | Notes **404** | Not Found | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **copyTemplateToApp** > TemplateResource copyTemplateToApp(copyTemplateRequest) @@ -157,7 +157,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -171,7 +171,7 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createAlias** > UserIdentityBody createAlias(userIdentityBody) @@ -225,7 +225,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -242,7 +242,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createAliasBySubscription** > UserIdentityBody createAliasBySubscription(userIdentityBody) @@ -293,7 +293,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -310,7 +310,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createApiKey** > CreateApiKeyResponse createApiKey(createApiKeyRequest) @@ -360,7 +360,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -374,7 +374,7 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createApp** > App createApp(app) @@ -437,7 +437,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -452,7 +452,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createCustomEvents** > object createCustomEvents(customEventsRequest) @@ -506,7 +506,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -522,7 +522,7 @@ Name | Type | Description | Notes **401** | Unauthorized | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createNotification** > CreateNotificationSuccessResponse createNotification(notification) @@ -563,7 +563,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -578,7 +578,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createSegment** > CreateSegmentSuccessResponse createSegment() @@ -628,7 +628,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -644,7 +644,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createSubscription** > SubscriptionBody createSubscription(subscriptionBody) @@ -714,7 +714,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -732,7 +732,7 @@ Name | Type | Description | Notes **409** | Operation is not permitted due to user having the maximum number of subscriptions assigned | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createTemplate** > TemplateResource createTemplate(createTemplateRequest) @@ -826,7 +826,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -841,7 +841,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **422** | Unprocessable Entity | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **createUser** > User createUser(user) @@ -930,7 +930,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -948,7 +948,7 @@ Name | Type | Description | Notes **409** | Multiple User Identity Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **deleteAlias** > UserIdentityBody deleteAlias() @@ -998,7 +998,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1015,7 +1015,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **deleteApiKey** > object deleteApiKey() @@ -1059,7 +1059,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1073,7 +1073,7 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **deleteSegment** > GenericSuccessBoolResponse deleteSegment() @@ -1117,7 +1117,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1133,7 +1133,7 @@ Name | Type | Description | Notes **404** | Not Found | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **deleteSubscription** > void deleteSubscription() @@ -1177,7 +1177,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1194,7 +1194,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **deleteTemplate** > GenericSuccessBoolResponse deleteTemplate() @@ -1238,7 +1238,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1253,7 +1253,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **404** | Not Found | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **deleteUser** > void deleteUser() @@ -1300,7 +1300,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1316,7 +1316,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **exportEvents** > ExportEventsSuccessResponse exportEvents() @@ -1360,7 +1360,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1376,7 +1376,7 @@ Name | Type | Description | Notes **404** | Not Found | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **exportSubscriptions** > ExportSubscriptionsSuccessResponse exportSubscriptions() @@ -1426,7 +1426,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1441,7 +1441,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getAliases** > UserIdentityBody getAliases() @@ -1488,7 +1488,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1504,7 +1504,7 @@ Name | Type | Description | Notes **404** | Not Found | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getAliasesBySubscription** > UserIdentityBody getAliasesBySubscription() @@ -1548,7 +1548,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1563,7 +1563,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **404** | Not Found | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getApp** > App getApp() @@ -1604,7 +1604,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1619,7 +1619,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getApps** > Array getApps() @@ -1652,7 +1652,7 @@ This endpoint does not need any parameter. ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1667,7 +1667,7 @@ This endpoint does not need any parameter. **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getNotification** > NotificationWithMeta getNotification() @@ -1711,7 +1711,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1727,7 +1727,7 @@ Name | Type | Description | Notes **404** | Not Found | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getNotificationHistory** > NotificationHistorySuccessResponse getNotificationHistory(getNotificationHistoryRequestBody) @@ -1775,7 +1775,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1791,7 +1791,7 @@ Name | Type | Description | Notes **404** | Not Found | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getNotifications** > NotificationSlice getNotifications() @@ -1841,7 +1841,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1856,7 +1856,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getOutcomes** > OutcomesData getOutcomes() @@ -1912,7 +1912,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1927,7 +1927,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getSegments** > GetSegmentsSuccessResponse getSegments() @@ -1974,7 +1974,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -1989,7 +1989,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **getUser** > User getUser() @@ -2036,7 +2036,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2052,7 +2052,7 @@ Name | Type | Description | Notes **404** | Not Found | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **rotateApiKey** > CreateApiKeyResponse rotateApiKey() @@ -2096,7 +2096,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2110,7 +2110,7 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **startLiveActivity** > StartLiveActivitySuccessResponse startLiveActivity(startLiveActivityRequest) @@ -2274,7 +2274,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2289,7 +2289,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **transferSubscription** > UserIdentityBody transferSubscription(transferSubscriptionRequestBody) @@ -2340,7 +2340,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2357,7 +2357,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **unsubscribeEmailWithToken** > GenericSuccessBoolResponse unsubscribeEmailWithToken() @@ -2404,7 +2404,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2419,7 +2419,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **updateApiKey** > object updateApiKey(updateApiKeyRequest) @@ -2472,7 +2472,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2486,7 +2486,7 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **updateApp** > App updateApp(app) @@ -2552,7 +2552,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2567,7 +2567,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **updateLiveActivity** > UpdateLiveActivitySuccessResponse updateLiveActivity(updateLiveActivityRequest) @@ -2712,7 +2712,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2727,7 +2727,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **updateSubscription** > void updateSubscription(subscriptionBody) @@ -2794,7 +2794,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2811,7 +2811,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **updateSubscriptionByToken** > object updateSubscriptionByToken(subscriptionBody) @@ -2881,7 +2881,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -2896,7 +2896,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **404** | Not Found | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **updateTemplate** > TemplateResource updateTemplate(updateTemplateRequest) @@ -2995,7 +2995,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -3009,7 +3009,7 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **updateUser** > PropertiesBody updateUser(updateUserRequest) @@ -3093,7 +3093,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -3109,7 +3109,7 @@ Name | Type | Description | Notes **409** | Conflict | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **viewApiKeys** > ApiKeyTokensListResponse viewApiKeys() @@ -3150,7 +3150,7 @@ Name | Type | Description | Notes ### Authorization -[organization_api_key](README.md#organization_api_key) +[organization_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -3164,7 +3164,7 @@ Name | Type | Description | Notes **200** | OK | - | **400** | Bad Request | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **viewTemplate** > TemplateResource viewTemplate() @@ -3208,7 +3208,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -3223,7 +3223,7 @@ Name | Type | Description | Notes **400** | Bad Request | - | **404** | Not Found | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) # **viewTemplates** > TemplatesListResponse viewTemplates() @@ -3273,7 +3273,7 @@ Name | Type | Description | Notes ### Authorization -[rest_api_key](README.md#rest_api_key) +[rest_api_key](https://github.com/OneSignal/node-onesignal#configuration) ### HTTP request headers @@ -3288,6 +3288,6 @@ Name | Type | Description | Notes **400** | Bad Request | - | **429** | Rate Limit Exceeded | - | -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/node-onesignal#full-api-reference) [[Back to README]](https://github.com/OneSignal/node-onesignal) diff --git a/README.md b/README.md index 2841560..4773929 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

Welcome to @onesignal/node-onesignal 👋

+

Welcome to @onesignal/node-onesignal

Version @@ -9,581 +9,87 @@ Maintenance - - Twitter: onesignal -

-> OpenAPI client for node-onesignal - -### 🏠 [Homepage](https://github.com/OneSignal/node-onesignal#readme) -### 🖤 [npm](https://www.npmjs.com/package/@onesignal/node-onesignal) - -# Node Client SDK -The OneSignal Node client is a server OneSignal SDK for NodeJS. Integrate OneSignal with your backend events, data, and -more. +The OneSignal Node client is a server SDK for NodeJS. A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at [onesignal.com](https://onesignal.com). - -# Install +## Installation ```sh -# yarn -yarn add @onesignal/node-onesignal - # npm -npm install @onesignal/node-onesignal --save -``` - -# Usage -```js -const OneSignal = require('@onesignal/node-onesignal'); -``` -```js -import * as OneSignal from '@onesignal/node-onesignal'; -``` +npm install @onesignal/node-onesignal -## Creating a client -### Configuration -We can configure the client using the `createConfiguration` function. You can find more info on each configuration -parameter [here](https://github.com/OpenAPITools/openapi-generator/pull/10283/files). +# pnpm +pnpm add @onesignal/node-onesignal -```js -const configuration = OneSignal.createConfiguration(configParams); -``` +# bun +bun add @onesignal/node-onesignal -### Initializing the Client -```js -const client = new OneSignal.DefaultApi(configuration); +# yarn +yarn add @onesignal/node-onesignal ``` -### Authentication -You can configure auth parameters passing them like this: +## Configuration -```js -const configuration = OneSignal.createConfiguration({ - organizationApiKey: '', // Organization key is only required for creating new apps and other top-level endpoints - restApiKey: '', // App REST API key required for most endpoints -}); +Every SDK requires authentication via API keys. Two key types are available: -const client = new OneSignal.DefaultApi(configuration); -``` +- **REST API Key** — required for most endpoints (sending notifications, managing users, etc.). Found in your app's **Settings > Keys & IDs**. +- **Organization API Key** — only required for organization-level endpoints like creating or listing apps. Found in **Organization Settings**. -#### Advanced Usage: Creating a brand-new app -If creating a new app via the client, the response will return the app's API key via the `basic_auth_key` response -parameter. You can then use this to modify your configuration object and create a new client that will have both user-level and app-level authentication set up. +> **Warning:** Store your API keys in environment variables or a secrets manager. Never commit them to source control. -```js -const response = await client.createApp(newapp); +```javascript +const OneSignal = require('@onesignal/node-onesignal'); const configuration = OneSignal.createConfiguration({ - organizationApiKey: '', // Organization key is only required for creating new apps and other top-level endpoints - restApiKey: response.basic_auth_key, + restApiKey: 'YOUR_REST_API_KEY', + organizationApiKey: 'YOUR_ORGANIZATION_API_KEY', }); const client = new OneSignal.DefaultApi(configuration); ``` ---- -## API Reference - -> See the full list of [API Endpoints](DefaultApi.MD). - -To make stateful changes requests should take on the following pattern: -1. create or get an object -2. make changes to that object -3. pass the object to the request function to make the changes - -Examples of important OneSignal objects include `App`, `Notification`, `Player`, and `Segment`. - -For example, see the section below on creating an app. First an app object is created via the instantiation of the `App` -class. Then, the app instance is modified directly. Finally, we use the `client` to create the app via a remote request. - -### Creating an app -Creates a new OneSignal app. - -**Example** -```js -const app = new OneSignal.App(); - -// configure your application -app.name = 'app_name'; -app.gcm_key = ''; -app.android_gcm_sender_id = ''; - -const response = await client.createApp(app); -``` - -### Getting an app -View the details of a single OneSignal app. - -**Example** -```js -const app = await client.getApp(''); -``` - -### Getting multiple apps -View apps. - -**Example** -```js -const apps = await client.getApps(); -``` - -### Updating an app -Updates the name or configuration settings of an existing OneSignal app. - -**Example** -```js -const app = new OneSignal.App(); -app.name = 'modified_app_name'; - -const udpateAppResponse = await client.updateApp('', app); -``` +## Send a push notification -### Creating a notification -Sends a notification to your users. - -**Example** -```js -const notification = new OneSignal.Notification(); -notification.app_id = app.id; -// Name property may be required in some case, for instance when sending an SMS. -notification.name = "test_notification_name"; -notification.contents = { - en: "Gig'em Ags" -} - -// required for Huawei -notification.headings = { - en: "Gig'em Ags" -} -const notification = await client.createNotification(notification); -``` -### Creating a notification using Filters -Sends a notification to your users filtered by specific criteria. - -**Example** -```js +```javascript const notification = new OneSignal.Notification(); -notification.app_id = app.id; - -notification.contents = { - en: "Gig'em Ags" -} - -// required for Huawei -notification.headings = { - en: "Gig'em Ags" -} - -// Find all the users that have not spent any amount in USD on IAP. -// https://documentation.onesignal.com/reference/create-notification#send-to-users-based-on-filters -notification.filters = [ - { - field: 'amount_spent', - relation: '=', - value: "0" - }, -]; - -const notification = await client.createNotification(notification); -``` +notification.app_id = 'YOUR_APP_ID'; +notification.contents = { en: 'Hello from OneSignal!' }; +notification.headings = { en: 'Push Notification' }; +notification.included_segments = ['Subscribed Users']; -### Canceling a notification -Stop a scheduled or currently outgoing notification. - -**Example** - -```js -const cancelNotificationResponse = await client.cancelNotification('', ''); -``` - - -### Getting a notification -View the details of a single notification and outcomes associated with it. - -**Example** -```js -await client.getNotification('', ''); +const response = await client.createNotification(notification); +console.log('Notification ID:', response.id); ``` -### Getting notifications -View the details of multiple notifications. - -| Param | Type | Description | -|--------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| app_id | string | The OneSignal App ID for your app. Available in Keys & IDs. | -| limit | string | How many notifications to return. Max is 50. Default is 50. | -| offset | number | Page offset. Default is 0. Results are sorted by queued_at in descending order. `queued_at` is a representation of the time that the notification was queued at. | -| kind | number | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only | - - -**Example** -```js -const notifications = await client.getNotifications('', '50', 0, 1); -``` - -### Getting notification history -View the devices sent a message - **OneSignal Paid Plan Required** -This method will return all devices that were sent the given `notification_id` of an Email or Push Notification if used -within 7 days of the date sent. - -**Example** -```js -const notificationHistory = await client.getNotificationHistory(''); -``` - -### Creating a segment -Create segments visible and usable in the dashboard and API - **Required: OneSignal Paid Plan** - -**Example** -```js -const segment = new OneSignal.Segment(); - -segment.filters = [ - { field: 'session_count', relation: '>', value: '1' }, - { field: 'tag', key: 'my_tag', relation: 'exists' } -] - -const segment = await client.createSegments(app.id, segment); -``` - -### Deleting a segment -Delete segments (not user devices) - **Required: OneSignal Paid Plan** -You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header -that has admin access on the app. -The `segment_id` can be found in the URL of the segment when viewing it in the dashboard. - -**Example** -```js -const deleteSegmentsResponse = await client.deleteSegments('', ''); -``` - -### Creating a player -Add a device. - -**Example** -```js -const player = new OneSignal.Player(); -player.device_type = 1; -player.app_id = app_id; -player.identifier = ''; -const player = await client.createPlayer(player); -``` - -### Getting a player -View the details of an existing device in one of your OneSignal apps. -The email and the hash is **only required if you have enabled Identity Verification and `device_type` is email**. - -**Example** -```js -const player = await client.getPlayer('', '', ''); -``` - -### Getting players -View the details of multiple devices in one of your OneSignal apps. - -⚠️ Unavailable for Apps Over 80,000 Users. +## Send an email -| Param | Type | Description | -|--------|--------|------------------------------------------------------------------| -| app_id | string | The OneSignal App ID for your app. Available in Keys & IDs. | -| limit | string | How many devices to return. Max is 300. Default is 300 | -| offset | number | Result offset. Default is 0. Results are sorted by id; | - - -**Example** -```js -const players = await client.getPlayers('', '300', 0); -``` - -### Exporting a player -Generate a compressed CSV export of all of your current user data. This method can be used to generate a compressed CSV -export of all of your existing user data and is a better alternative to retrieving this data using the /players API endpoint. - -See [full CSV Export Reference](https://documentation.onesignal.com/reference/csv-export) - -**Example** -```js -const exportPlayerResponse = await client.exportPlayer('', { - extra_fields: ['location', 'external_user_id'], - last_active_since: 1469392779, - segment_name: "Subscribed Users" -}); -``` - - -### Updating a player -Update an existing device in one of your OneSignal apps. - -**Example** -```js -const updatePlayerResponse = await client.updatePlayer('', player); -``` - -### Updating player tags -Update an existing device's tags in one of your OneSignal apps using the External User ID. - -```js -const playerToUpdate = new OneSignal.Player(); - -player.app_id = APP_ID; -player.device_type = 1; - -playerToUpdate.external_user_id = 'your_player_external_id'; // setting the same external_user_id as before -const updatePlayerTagsRequestBody = new OneSignal.UpdatePlayerTagsRequestBody(); -updatePlayerTagsRequestBody.tags = {'typescript_test_tag': 1}; -const updatePlayerResponse = await api.updatePlayerTags(APP_ID, PLAYER_EXTERNAL_USER_ID, updatePlayerTagsRequestBody); -``` -#### Deleting Tags -To delete a tag, include its key and set its value to blank (""). Omitting a key/value will not delete it. - -For example, if you wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the -tags JSON would look like the following: - -**Example** -```json -"tags": { - "rank": "", - "category": "", - "class": "my_new_value" -} -``` - -### Deleting a player -Deletes a user record. - -**Example** -```js -const deletePlayerResponse = await client.deletePlayer(app.id, '') -``` - -### Getting outcomes -View the details of all the outcomes associated with your app. - -🚧 **Requires your OneSignal App's REST API Key, available in Keys & IDs** 🚧 - -Outcome data are accessible for 30 days before being deleted from our servers. You can export this data monthly if you need it for a more extended period. - -| Param | Type | Description | -|---------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| app_id | string | The OneSignal App ID for your app. Available in Keys & IDs. | -| outcome_names | string | Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum | -| outcome_names2 | string | If outcome names contain any commas, then please specify only one value at a time. Example: `outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count` where “Sales, Purchase” is the custom outcomes with a comma in the name. | -| outcome_time_range | string | Optional Time range for the returned data. The values can be `1h` (for the last 1 hour data), `1d` (for the last 1 day data), or `1mo` (for the last 1 month data). Default is 1h if the parameter is omitted. | -| outcome_platforms | string | Optional Platform id. Refer device's platform ids for values. **Example:** `outcome_platform=0` for iOS `outcome_platform=7`, `8` for Safari and Firefox Default is data from all platforms if the parameter is omitted. | -| outcome_attribution | string | Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. | - -**Example** -```js -const outcomes = await client.getOutcomes(app.id, 'os__click.count,os_session_duration.count,my_outcome.sum'); -``` - -### Begin Live Activity -Starts a Live Activity event -```js -// Create a player first -const player = new OneSignal.Player(); -player.device_type = 0; -player.app_id = ''; -const playerResponse = await api.createPlayer(player); - -// Prepare a request -const beginLiveActivityRequest: BeginLiveActivityRequest = { - push_token: '', - subscription_id: playerResponse.id!, -}; -const activityId = ''; // any string - -// Begin activity -await api.beginLiveActivity('', activityId, beginLiveActivityRequest); -``` - -### Update Live Activity -Updates a Live Activity event -```js -const updateLiveActivityRequest: UpdateLiveActivityRequest = { - event_updates: { - data: 'test' - }, - event: "update", - name: "contents" -}; - -await api.updateLiveActivity('', '', updateLiveActivityRequest); -``` - -### End Live Activity -Stops a Live Activity event -```js -const subscriptionId = ''; // player id -await api.endLiveActivity('', '', subscriptionId); -``` - -### Subscription types -* iOSPush -* AndroidPush -* FireOSPush -* ChromeExtensionPush -* ChromePush -* WindowsPush -* SafariLegacyPush -* FirefoxPush -* macOSPush -* HuaweiPush -* SafariPush -* Email -* SMS - -## Users -### Creating a OneSignal User -```js -const user = new OneSignal.User(); - -const aliasLabel = ''; -const aliasId = ''; -const subscriptionToken = ''; - -user.identity = { - [aliasLabel]: aliasId, -}; - -user.subscriptions = [ - { - type: "iOSPush", - token: subscriptionToken, - } -]; - -const createdUser = await api.createUser('', user); -assert(createdUser.identity!['onesignal_id'] != null); -``` - -### Getting a user by `onesignal_id` -```js -const oneisgnalAliasLabel = "onesignal_id"; -const onesignalAliasId = createdUser.identity!['onesignal_id']; - -const fetchedUser = await api.fetchUser('', oneisgnalAliasLabel, onesignalAliasId); -``` - -### Getting a user by an alias -```js -const fetchedUser = await api.fetchUser('', alias_label, alias_id); -``` - -### Updating a user -```js -const updateUserRequest: UpdateUserRequest = { - properties: { - language: 'fr' - } -}; - -const updatedUser = await api.updateUser('', aliasLabel, aliasId, updateUserRequest); -``` - -### Deleting a user -```js -await api.deleteUser('', aliasLabel, aliasId); -``` - -## Subscriptions -### Creating a subscription for existing user -```js -const createSubscriptionRequestBody: CreateSubscriptionRequestBody = { - subscription: { - type: "AndroidPush", - token: '', - } -}; - -const response = await api.createSubscription('', '', '', createSubscriptionRequestBody); -``` - -### Updating a subscription -```js -const updateSubscriptionRequestBody: UpdateSubscriptionRequestBody = { - subscription: { - type: "iOSPush", - token: '', - } -}; - -await api.updateSubscription('', '', updateSubscriptionRequestBody); -``` - -### Deleting a subscription -```js -await api.deleteSubscription('', ''); -``` - -### Transfer subscription ownership -Transfers the subscription from one user to another. -```js -// Setting the user for transfering the subscription to. User is identyfied by an IdentityObject. -const transferSubscriptionRequestBody: TransferSubscriptionRequestBody = { - identity: otherUserIdentityObject -}; - -const transferResponse = await api.transferSubscription('', '', transferSubscriptionRequestBody); -``` - -## Aliases -### Fetching aliases for a user -```js -const fetchResponse = await api.fetchAliases('', ''); -``` - -### Fetching user identity -```js -const fetchResponse = await api.fetchUserIdentity('', '', ''); -``` -### Identifying user by alias -```js -const userIdentityRequestBody: UserIdentityRequestBody = { - identity: { - ['']: '' - } -}; +```javascript +const notification = new OneSignal.Notification(); +notification.app_id = 'YOUR_APP_ID'; +notification.email_subject = 'Important Update'; +notification.email_body = '

Hello!

This is an HTML email.

'; +notification.included_segments = ['Subscribed Users']; +notification.channel_for_external_user_ids = 'email'; -const identifyResponse = await api.identifyUserByAlias('', - '', - '', - userIdentityRequestBody); +const response = await client.createNotification(notification); ``` -### Identifying user by subscription id -```js -const userIdentityRequestBody: UserIdentityRequestBody = { - identity: { - ['']: '' - } -}; +## Send an SMS -const identifyResponse = await api.identifyUserBySubscriptionId('', '', userIdentityRequestBody); -``` +```javascript +const notification = new OneSignal.Notification(); +notification.app_id = 'YOUR_APP_ID'; +notification.contents = { en: 'Your SMS message content here' }; +notification.included_segments = ['Subscribed Users']; +notification.channel_for_external_user_ids = 'sms'; +notification.sms_from = '+15551234567'; -### Deleting an alias -```js -await api.deleteAlias('', '', '', ''); +const response = await client.createNotification(notification); ``` -## Author - -* Website: https://onesignal.com -* Twitter: [@onesignal](https://twitter.com/onesignal) -* Github: [@OneSignal](https://github.com/OneSignal) - -## 🤝 Contributing - -Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/OneSignal/node-onesignal/issues). - -## Show your support - -Give a ⭐️ if this project helped you! -## 📝 License +## Full API reference -Copyright © 2023 [OneSignal](https://github.com/OneSignal). +The complete list of API endpoints and their parameters is available in the [DefaultApi documentation](https://github.com/OneSignal/node-onesignal/blob/main/DefaultApi.md). -This project is [MIT](https://github.com/OneSignal/node-onesignal/blob/main/LICENSE) licensed. +For the underlying REST API, see the [OneSignal API reference](https://documentation.onesignal.com/reference). diff --git a/tsconfig.json b/tsconfig.json index 4a8d5cb..0675956 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "strict": true, + "ignoreDeprecations": "6.0", /* Basic Options */ "target": "es5", "moduleResolution": "node",