onesignal 5.14.0 → 5.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/docs/BasicNotification.md +1 -1
- data/docs/DefaultApi.md +77 -0
- data/docs/EstimateNotificationRecipientsRequest.md +28 -0
- data/docs/EstimateNotificationRecipientsRequestAllOf.md +24 -0
- data/docs/EstimateNotificationRecipientsSuccessResponse.md +26 -0
- data/docs/Notification.md +1 -1
- data/docs/NotificationTarget.md +1 -1
- data/docs/NotificationWithMeta.md +1 -1
- data/docs/SegmentNotificationTarget.md +1 -1
- data/lib/onesignal/api/default_api.rb +68 -0
- data/lib/onesignal/api_client.rb +1 -1
- data/lib/onesignal/models/basic_notification.rb +1 -1
- data/lib/onesignal/models/estimate_notification_recipients_request.rb +326 -0
- data/lib/onesignal/models/estimate_notification_recipients_request_all_of.rb +288 -0
- data/lib/onesignal/models/estimate_notification_recipients_success_response.rb +260 -0
- data/lib/onesignal/models/notification.rb +1 -1
- data/lib/onesignal/models/notification_target.rb +1 -1
- data/lib/onesignal/models/notification_with_meta.rb +1 -1
- data/lib/onesignal/models/segment_notification_target.rb +1 -1
- data/lib/onesignal/version.rb +1 -1
- data/lib/onesignal.rb +3 -0
- data/spec/api/default_api_spec.rb +12 -0
- data/spec/models/estimate_notification_recipients_request_all_of_spec.rb +55 -0
- data/spec/models/estimate_notification_recipients_request_spec.rb +67 -0
- data/spec/models/estimate_notification_recipients_success_response_spec.rb +57 -0
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b42ceaf3b0e632fc98ee99283fa94b807d0f50f90f77b33286030005ee274c7
|
|
4
|
+
data.tar.gz: e7cb4a761b751cfc90ad4d95daa1e87a7954878a669696572974a3471da5bfbf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8889f13555a918742eab686312061d53501d20e76d65d7e4f495cf41d009885ffc1b9d52158c6e557efc489317dfa93438d903142419f565779fbcd625089f64
|
|
7
|
+
data.tar.gz: b55524df6758ae04f50cc30f2b08fc723fa5fcf451d37d6326420603cb1f417912052c4bbd33b3421a182b7498c9c6de4a001d41448c468b911d92971645f347
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.14.0](https://github.com/OneSignal/onesignal-ruby-api/compare/v5.13.0...v5.14.0) (2026-08-28)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add v5.14.0 package updates ([f5bef49](https://github.com/OneSignal/onesignal-ruby-api/commit/f5bef49250856e178d685c0844c92b1f236dec09))
|
|
8
|
+
* add v5.14.0 package updates ([#126](https://github.com/OneSignal/onesignal-ruby-api/issues/126)) ([a65294e](https://github.com/OneSignal/onesignal-ruby-api/commit/a65294ef20e67e16116d27dadb87111ed2a33c1c)), closes [OneSignal/api-client-libraries#452](https://github.com/OneSignal/api-client-libraries/issues/452)
|
|
9
|
+
|
|
3
10
|
## [5.13.0](https://github.com/OneSignal/onesignal-ruby-api/compare/v5.12.0...v5.13.0) (2026-08-25)
|
|
4
11
|
|
|
5
12
|
### Features
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -6,15 +6,15 @@ OneSignal - the Ruby gem for OneSignal
|
|
|
6
6
|
|
|
7
7
|
A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
8
8
|
|
|
9
|
-
- API version: 5.
|
|
10
|
-
- Package version: 5.
|
|
9
|
+
- API version: 5.15.0
|
|
10
|
+
- Package version: 5.15.0
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
Add to your `Gemfile`:
|
|
15
15
|
|
|
16
16
|
```ruby
|
|
17
|
-
gem 'onesignal', '~> 5.
|
|
17
|
+
gem 'onesignal', '~> 5.15.0'
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Then run `bundle install`.
|
data/docs/BasicNotification.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
7
|
+
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] |
|
|
8
8
|
| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
9
9
|
| **include_subscription_ids** | **Array<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] |
|
|
10
10
|
| **include_email_tokens** | **Array<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] |
|
data/docs/DefaultApi.md
CHANGED
|
@@ -24,6 +24,7 @@ All URIs are relative to *https://api.onesignal.com*
|
|
|
24
24
|
| [**delete_subscription**](DefaultApi.md#delete_subscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | |
|
|
25
25
|
| [**delete_template**](DefaultApi.md#delete_template) | **DELETE** /templates/{template_id} | Delete template |
|
|
26
26
|
| [**delete_user**](DefaultApi.md#delete_user) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
|
|
27
|
+
| [**estimate_notification_recipients**](DefaultApi.md#estimate_notification_recipients) | **POST** /notifications/count-unsaved | Estimate notification recipients |
|
|
27
28
|
| [**export_events**](DefaultApi.md#export_events) | **POST** /notifications/{notification_id}/export_events | Export CSV of Events |
|
|
28
29
|
| [**export_subscriptions**](DefaultApi.md#export_subscriptions) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Subscriptions |
|
|
29
30
|
| [**get_aliases**](DefaultApi.md#get_aliases) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
|
|
@@ -1737,6 +1738,82 @@ nil (empty response body)
|
|
|
1737
1738
|
- **Accept**: application/json
|
|
1738
1739
|
|
|
1739
1740
|
|
|
1741
|
+
## estimate_notification_recipients
|
|
1742
|
+
|
|
1743
|
+
> <EstimateNotificationRecipientsSuccessResponse> estimate_notification_recipients(estimate_notification_recipients_request)
|
|
1744
|
+
|
|
1745
|
+
Estimate notification recipients
|
|
1746
|
+
|
|
1747
|
+
Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored.
|
|
1748
|
+
|
|
1749
|
+
### Examples
|
|
1750
|
+
|
|
1751
|
+
```ruby
|
|
1752
|
+
require 'onesignal'
|
|
1753
|
+
# setup authorization
|
|
1754
|
+
OneSignal.configure do |config|
|
|
1755
|
+
# Configure Bearer authorization: rest_api_key
|
|
1756
|
+
config.rest_api_key = 'YOUR_REST_API_KEY'
|
|
1757
|
+
|
|
1758
|
+
end
|
|
1759
|
+
|
|
1760
|
+
api_instance = OneSignal::DefaultApi.new
|
|
1761
|
+
estimate_notification_recipients_request = OneSignal::EstimateNotificationRecipientsRequest.new({app_id: 'app_id_example'}) # EstimateNotificationRecipientsRequest |
|
|
1762
|
+
|
|
1763
|
+
begin
|
|
1764
|
+
# Estimate notification recipients
|
|
1765
|
+
result = api_instance.estimate_notification_recipients(estimate_notification_recipients_request)
|
|
1766
|
+
p result
|
|
1767
|
+
rescue OneSignal::ApiError => e
|
|
1768
|
+
puts "Error when calling DefaultApi->estimate_notification_recipients: #{e}"
|
|
1769
|
+
puts "Status Code: #{e.code}"
|
|
1770
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1771
|
+
# the raw body remains on `e.response_body`.
|
|
1772
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1773
|
+
puts "Response Body: #{e.response_body}"
|
|
1774
|
+
end
|
|
1775
|
+
```
|
|
1776
|
+
|
|
1777
|
+
#### Using the estimate_notification_recipients_with_http_info variant
|
|
1778
|
+
|
|
1779
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1780
|
+
|
|
1781
|
+
> <Array(<EstimateNotificationRecipientsSuccessResponse>, Integer, Hash)> estimate_notification_recipients_with_http_info(estimate_notification_recipients_request)
|
|
1782
|
+
|
|
1783
|
+
```ruby
|
|
1784
|
+
begin
|
|
1785
|
+
# Estimate notification recipients
|
|
1786
|
+
data, status_code, headers = api_instance.estimate_notification_recipients_with_http_info(estimate_notification_recipients_request)
|
|
1787
|
+
p status_code # => 2xx
|
|
1788
|
+
p headers # => { ... }
|
|
1789
|
+
p data # => <EstimateNotificationRecipientsSuccessResponse>
|
|
1790
|
+
rescue OneSignal::ApiError => e
|
|
1791
|
+
puts "Error when calling DefaultApi->estimate_notification_recipients_with_http_info: #{e}"
|
|
1792
|
+
puts "Status Code: #{e.code}"
|
|
1793
|
+
puts "Response Body: #{e.response_body}"
|
|
1794
|
+
end
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
### Parameters
|
|
1798
|
+
|
|
1799
|
+
| Name | Type | Description | Notes |
|
|
1800
|
+
| ---- | ---- | ----------- | ----- |
|
|
1801
|
+
| **estimate_notification_recipients_request** | [**EstimateNotificationRecipientsRequest**](EstimateNotificationRecipientsRequest.md) | | |
|
|
1802
|
+
|
|
1803
|
+
### Return type
|
|
1804
|
+
|
|
1805
|
+
[**EstimateNotificationRecipientsSuccessResponse**](EstimateNotificationRecipientsSuccessResponse.md)
|
|
1806
|
+
|
|
1807
|
+
### Authorization
|
|
1808
|
+
|
|
1809
|
+
[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration)
|
|
1810
|
+
|
|
1811
|
+
### HTTP request headers
|
|
1812
|
+
|
|
1813
|
+
- **Content-Type**: application/json
|
|
1814
|
+
- **Accept**: application/json
|
|
1815
|
+
|
|
1816
|
+
|
|
1740
1817
|
## export_events
|
|
1741
1818
|
|
|
1742
1819
|
> <ExportEventsSuccessResponse> export_events(notification_id, app_id)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# OneSignal::EstimateNotificationRecipientsRequest
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] |
|
|
8
|
+
| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
9
|
+
| **app_id** | **String** | The OneSignal App ID for your app, which can be found in Keys & IDs. | |
|
|
10
|
+
| **filters** | [**Array<FilterExpression>**](FilterExpression.md) | | [optional] |
|
|
11
|
+
| **include_aliases** | **Hash<String, Array<String>>** | Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms. | [optional] |
|
|
12
|
+
| **target_channel** | **String** | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. | [optional] |
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
require 'onesignal'
|
|
18
|
+
|
|
19
|
+
instance = OneSignal::EstimateNotificationRecipientsRequest.new(
|
|
20
|
+
included_segments: nil,
|
|
21
|
+
excluded_segments: nil,
|
|
22
|
+
app_id: nil,
|
|
23
|
+
filters: nil,
|
|
24
|
+
include_aliases: nil,
|
|
25
|
+
target_channel: nil
|
|
26
|
+
)
|
|
27
|
+
```
|
|
28
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# OneSignal::EstimateNotificationRecipientsRequestAllOf
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **app_id** | **String** | The OneSignal App ID for your app, which can be found in Keys & IDs. | [optional] |
|
|
8
|
+
| **filters** | [**Array<FilterExpression>**](FilterExpression.md) | | [optional] |
|
|
9
|
+
| **include_aliases** | **Hash<String, Array<String>>** | Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms. | [optional] |
|
|
10
|
+
| **target_channel** | **String** | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. | [optional] |
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
require 'onesignal'
|
|
16
|
+
|
|
17
|
+
instance = OneSignal::EstimateNotificationRecipientsRequestAllOf.new(
|
|
18
|
+
app_id: nil,
|
|
19
|
+
filters: nil,
|
|
20
|
+
include_aliases: nil,
|
|
21
|
+
target_channel: nil
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# OneSignal::EstimateNotificationRecipientsSuccessResponse
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **count** | **Integer** | The estimated audience size based on the user targeting method you've set on the message, and the specific platforms the message is targeted to send to. | [optional] |
|
|
8
|
+
| **uncapped_count** | **Integer** | The estimated audience size before the plan's web push subscriber cap is applied. Present only when `cap_applied` is `true`; `null` otherwise. | [optional] |
|
|
9
|
+
| **cap_applied** | **Boolean** | Whether `count` was reduced because the app is on a plan that caps the number of web push subscribers it can send to. | [optional] |
|
|
10
|
+
| **mobile_suppressed** | **Boolean** | The mobile equivalent of `cap_applied`. Whether mobile push deliveries will be dropped for this send because the org is over its plan's mobile push subscriber cap. `false` when the notification doesn't target any mobile push platforms. | [optional] |
|
|
11
|
+
| **mobile_excluded_count** | **Integer** | How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`. | [optional] |
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require 'onesignal'
|
|
17
|
+
|
|
18
|
+
instance = OneSignal::EstimateNotificationRecipientsSuccessResponse.new(
|
|
19
|
+
count: nil,
|
|
20
|
+
uncapped_count: nil,
|
|
21
|
+
cap_applied: nil,
|
|
22
|
+
mobile_suppressed: nil,
|
|
23
|
+
mobile_excluded_count: nil
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
data/docs/Notification.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
7
|
+
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] |
|
|
8
8
|
| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
9
9
|
| **include_subscription_ids** | **Array<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] |
|
|
10
10
|
| **include_email_tokens** | **Array<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] |
|
data/docs/NotificationTarget.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
7
|
+
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] |
|
|
8
8
|
| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
9
9
|
| **include_subscription_ids** | **Array<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] |
|
|
10
10
|
| **include_email_tokens** | **Array<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
7
|
+
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] |
|
|
8
8
|
| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
9
9
|
| **include_subscription_ids** | **Array<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] |
|
|
10
10
|
| **include_email_tokens** | **Array<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
7
|
+
| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] |
|
|
8
8
|
| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] |
|
|
9
9
|
|
|
10
10
|
## Example
|
|
@@ -1479,6 +1479,74 @@ module OneSignal
|
|
|
1479
1479
|
return data, status_code, headers
|
|
1480
1480
|
end
|
|
1481
1481
|
|
|
1482
|
+
# Estimate notification recipients
|
|
1483
|
+
# Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored.
|
|
1484
|
+
# @param estimate_notification_recipients_request [EstimateNotificationRecipientsRequest]
|
|
1485
|
+
# @param [Hash] opts the optional parameters
|
|
1486
|
+
# @return [EstimateNotificationRecipientsSuccessResponse]
|
|
1487
|
+
def estimate_notification_recipients(estimate_notification_recipients_request, opts = {})
|
|
1488
|
+
data, _status_code, _headers = estimate_notification_recipients_with_http_info(estimate_notification_recipients_request, opts)
|
|
1489
|
+
data
|
|
1490
|
+
end
|
|
1491
|
+
|
|
1492
|
+
# Estimate notification recipients
|
|
1493
|
+
# Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored.
|
|
1494
|
+
# @param estimate_notification_recipients_request [EstimateNotificationRecipientsRequest]
|
|
1495
|
+
# @param [Hash] opts the optional parameters
|
|
1496
|
+
# @return [Array<(EstimateNotificationRecipientsSuccessResponse, Integer, Hash)>] EstimateNotificationRecipientsSuccessResponse data, response status code and response headers
|
|
1497
|
+
def estimate_notification_recipients_with_http_info(estimate_notification_recipients_request, opts = {})
|
|
1498
|
+
if @api_client.config.debugging
|
|
1499
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.estimate_notification_recipients ...'
|
|
1500
|
+
end
|
|
1501
|
+
# verify the required parameter 'estimate_notification_recipients_request' is set
|
|
1502
|
+
if @api_client.config.client_side_validation && estimate_notification_recipients_request.nil?
|
|
1503
|
+
fail ArgumentError, "Missing the required parameter 'estimate_notification_recipients_request' when calling DefaultApi.estimate_notification_recipients"
|
|
1504
|
+
end
|
|
1505
|
+
# resource path
|
|
1506
|
+
local_var_path = '/notifications/count-unsaved'
|
|
1507
|
+
|
|
1508
|
+
# query parameters
|
|
1509
|
+
query_params = opts[:query_params] || {}
|
|
1510
|
+
|
|
1511
|
+
# header parameters
|
|
1512
|
+
header_params = opts[:header_params] || {}
|
|
1513
|
+
# HTTP header 'Accept' (if needed)
|
|
1514
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
1515
|
+
# HTTP header 'Content-Type'
|
|
1516
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
1517
|
+
if !content_type.nil?
|
|
1518
|
+
header_params['Content-Type'] = content_type
|
|
1519
|
+
end
|
|
1520
|
+
|
|
1521
|
+
# form parameters
|
|
1522
|
+
form_params = opts[:form_params] || {}
|
|
1523
|
+
|
|
1524
|
+
# http body (model)
|
|
1525
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(estimate_notification_recipients_request)
|
|
1526
|
+
|
|
1527
|
+
# return_type
|
|
1528
|
+
return_type = opts[:debug_return_type] || 'EstimateNotificationRecipientsSuccessResponse'
|
|
1529
|
+
|
|
1530
|
+
# auth_names
|
|
1531
|
+
auth_names = opts[:debug_auth_names] || ['rest_api_key']
|
|
1532
|
+
|
|
1533
|
+
new_options = opts.merge(
|
|
1534
|
+
:operation => :"DefaultApi.estimate_notification_recipients",
|
|
1535
|
+
:header_params => header_params,
|
|
1536
|
+
:query_params => query_params,
|
|
1537
|
+
:form_params => form_params,
|
|
1538
|
+
:body => post_body,
|
|
1539
|
+
:auth_names => auth_names,
|
|
1540
|
+
:return_type => return_type
|
|
1541
|
+
)
|
|
1542
|
+
|
|
1543
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
1544
|
+
if @api_client.config.debugging
|
|
1545
|
+
@api_client.config.logger.debug "API called: DefaultApi#estimate_notification_recipients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1546
|
+
end
|
|
1547
|
+
return data, status_code, headers
|
|
1548
|
+
end
|
|
1549
|
+
|
|
1482
1550
|
# Export CSV of Events
|
|
1483
1551
|
# Generate a compressed CSV report of all of the events data for a notification. This will return a URL immediately upon success but it may take several minutes for the CSV to become available at that URL depending on the volume of data. Only one export can be in-progress per OneSignal account at any given time.
|
|
1484
1552
|
# @param notification_id [String] The ID of the notification to export events from.
|
data/lib/onesignal/api_client.rb
CHANGED
|
@@ -89,7 +89,7 @@ module OneSignal
|
|
|
89
89
|
url = build_request_url(path, opts)
|
|
90
90
|
http_method = http_method.to_sym.downcase
|
|
91
91
|
|
|
92
|
-
opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.
|
|
92
|
+
opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.15.0'
|
|
93
93
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
|
94
94
|
query_params = opts[:query_params] || {}
|
|
95
95
|
form_params = opts[:form_params] || {}
|
|
@@ -14,7 +14,7 @@ require 'time'
|
|
|
14
14
|
|
|
15
15
|
module OneSignal
|
|
16
16
|
class BasicNotification
|
|
17
|
-
# The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"]
|
|
17
|
+
# The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup.
|
|
18
18
|
attr_accessor :included_segments
|
|
19
19
|
|
|
20
20
|
# Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"]
|