Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ OneSignal - the Ruby gem for OneSignal

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

- API version: 5.14.0
- Package version: 5.14.0
- API version: 5.15.0
- Package version: 5.15.0

## Installation

Add to your `Gemfile`:

```ruby
gem 'onesignal', '~> 5.14.0'
gem 'onesignal', '~> 5.15.0'
```

Then run `bundle install`.
Expand Down
2 changes: 1 addition & 1 deletion docs/BasicNotification.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **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] |
| **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] |
| **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] |
| **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] |
| **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] |
Expand Down
77 changes: 77 additions & 0 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All URIs are relative to *https://api.onesignal.com*
| [**delete_subscription**](DefaultApi.md#delete_subscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | |
| [**delete_template**](DefaultApi.md#delete_template) | **DELETE** /templates/{template_id} | Delete template |
| [**delete_user**](DefaultApi.md#delete_user) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
| [**estimate_notification_recipients**](DefaultApi.md#estimate_notification_recipients) | **POST** /notifications/count-unsaved | Estimate notification recipients |
| [**export_events**](DefaultApi.md#export_events) | **POST** /notifications/{notification_id}/export_events | Export CSV of Events |
| [**export_subscriptions**](DefaultApi.md#export_subscriptions) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Subscriptions |
| [**get_aliases**](DefaultApi.md#get_aliases) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
Expand Down Expand Up @@ -1737,6 +1738,82 @@ nil (empty response body)
- **Accept**: application/json


## estimate_notification_recipients

> <EstimateNotificationRecipientsSuccessResponse> estimate_notification_recipients(estimate_notification_recipients_request)

Estimate notification recipients

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.

### Examples

```ruby
require 'onesignal'
# setup authorization
OneSignal.configure do |config|
# Configure Bearer authorization: rest_api_key
config.rest_api_key = 'YOUR_REST_API_KEY'

end

api_instance = OneSignal::DefaultApi.new
estimate_notification_recipients_request = OneSignal::EstimateNotificationRecipientsRequest.new({app_id: 'app_id_example'}) # EstimateNotificationRecipientsRequest |

begin
# Estimate notification recipients
result = api_instance.estimate_notification_recipients(estimate_notification_recipients_request)
p result
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->estimate_notification_recipients: #{e}"
puts "Status Code: #{e.code}"
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
# the raw body remains on `e.response_body`.
puts "Error Messages: #{e.error_messages}"
puts "Response Body: #{e.response_body}"
end
```

#### Using the estimate_notification_recipients_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<EstimateNotificationRecipientsSuccessResponse>, Integer, Hash)> estimate_notification_recipients_with_http_info(estimate_notification_recipients_request)

```ruby
begin
# Estimate notification recipients
data, status_code, headers = api_instance.estimate_notification_recipients_with_http_info(estimate_notification_recipients_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <EstimateNotificationRecipientsSuccessResponse>
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->estimate_notification_recipients_with_http_info: #{e}"
puts "Status Code: #{e.code}"
puts "Response Body: #{e.response_body}"
end
```

### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **estimate_notification_recipients_request** | [**EstimateNotificationRecipientsRequest**](EstimateNotificationRecipientsRequest.md) | | |

### Return type

[**EstimateNotificationRecipientsSuccessResponse**](EstimateNotificationRecipientsSuccessResponse.md)

### Authorization

[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json


## export_events

> <ExportEventsSuccessResponse> export_events(notification_id, app_id)
Expand Down
28 changes: 28 additions & 0 deletions docs/EstimateNotificationRecipientsRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# OneSignal::EstimateNotificationRecipientsRequest

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] &#x60;\&quot;All\&quot;&#x60; is a shorthand for every subscribed user: if the array includes the string &#x60;\&quot;All\&quot;&#x60; and the app has no segment actually named &#x60;All&#x60;, it targets all subscribers instead of a literal segment lookup. | [optional] |
| **excluded_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **app_id** | **String** | The OneSignal App ID for your app, which can be found in Keys &amp; IDs. | |
| **filters** | [**Array&lt;FilterExpression&gt;**](FilterExpression.md) | | [optional] |
| **include_aliases** | **Hash&lt;String, Array&lt;String&gt;&gt;** | 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: { \&quot;external_id\&quot;: [\&quot;exId1\&quot;, \&quot;extId2\&quot;], \&quot;internal_label\&quot;: [\&quot;id1\&quot;, \&quot;id2\&quot;] } Keys must match API spellings exactly (for example the label for External ID is the string &#x60;external_id&#x60;; 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] |
| **target_channel** | **String** | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (&#x60;isIos&#x60;, &#x60;isAndroid&#x60;, etc.) are not supported by this endpoint. | [optional] |

## Example

```ruby
require 'onesignal'

instance = OneSignal::EstimateNotificationRecipientsRequest.new(
included_segments: nil,
excluded_segments: nil,
app_id: nil,
filters: nil,
include_aliases: nil,
target_channel: nil
)
```

24 changes: 24 additions & 0 deletions docs/EstimateNotificationRecipientsRequestAllOf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# OneSignal::EstimateNotificationRecipientsRequestAllOf

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **app_id** | **String** | The OneSignal App ID for your app, which can be found in Keys &amp; IDs. | [optional] |
| **filters** | [**Array&lt;FilterExpression&gt;**](FilterExpression.md) | | [optional] |
| **include_aliases** | **Hash&lt;String, Array&lt;String&gt;&gt;** | 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: { \&quot;external_id\&quot;: [\&quot;exId1\&quot;, \&quot;extId2\&quot;], \&quot;internal_label\&quot;: [\&quot;id1\&quot;, \&quot;id2\&quot;] } Keys must match API spellings exactly (for example the label for External ID is the string &#x60;external_id&#x60;; 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] |
| **target_channel** | **String** | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (&#x60;isIos&#x60;, &#x60;isAndroid&#x60;, etc.) are not supported by this endpoint. | [optional] |

## Example

```ruby
require 'onesignal'

instance = OneSignal::EstimateNotificationRecipientsRequestAllOf.new(
app_id: nil,
filters: nil,
include_aliases: nil,
target_channel: nil
)
```

26 changes: 26 additions & 0 deletions docs/EstimateNotificationRecipientsSuccessResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# OneSignal::EstimateNotificationRecipientsSuccessResponse

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **count** | **Integer** | The estimated audience size based on the user targeting method you&#39;ve set on the message, and the specific platforms the message is targeted to send to. | [optional] |
| **uncapped_count** | **Integer** | The estimated audience size before the plan&#39;s web push subscriber cap is applied. Present only when &#x60;cap_applied&#x60; is &#x60;true&#x60;; &#x60;null&#x60; otherwise. | [optional] |
| **cap_applied** | **Boolean** | Whether &#x60;count&#x60; was reduced because the app is on a plan that caps the number of web push subscribers it can send to. | [optional] |
| **mobile_suppressed** | **Boolean** | The mobile equivalent of &#x60;cap_applied&#x60;. Whether mobile push deliveries will be dropped for this send because the org is over its plan&#39;s mobile push subscriber cap. &#x60;false&#x60; when the notification doesn&#39;t target any mobile push platforms. | [optional] |
| **mobile_excluded_count** | **Integer** | How many mobile push recipients the &#x60;count&#x60; excludes due to the plan&#39;s mobile push subscriber cap. &#x60;0&#x60; when &#x60;mobile_suppressed&#x60; is &#x60;false&#x60;. | [optional] |

## Example

```ruby
require 'onesignal'

instance = OneSignal::EstimateNotificationRecipientsSuccessResponse.new(
count: nil,
uncapped_count: nil,
cap_applied: nil,
mobile_suppressed: nil,
mobile_excluded_count: nil
)
```

2 changes: 1 addition & 1 deletion docs/Notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] &#x60;\&quot;All\&quot;&#x60; is a shorthand for every subscribed user: if the array includes the string &#x60;\&quot;All\&quot;&#x60; and the app has no segment actually named &#x60;All&#x60;, it targets all subscribers instead of a literal segment lookup. | [optional] |
| **excluded_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **include_subscription_ids** | **Array&lt;String&gt;** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\&quot;1dd608f2-c6a1-11e3-851d-000c2940e62c\&quot;] Limit of 2,000 entries per REST API call | [optional] |
| **include_email_tokens** | **Array&lt;String&gt;** | Deprecated alias for &#x60;email_to&#x60;. 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 &#x60;email_to&#x60; in new integrations. | [optional] |
Expand Down
2 changes: 1 addition & 1 deletion docs/NotificationTarget.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] &#x60;\&quot;All\&quot;&#x60; is a shorthand for every subscribed user: if the array includes the string &#x60;\&quot;All\&quot;&#x60; and the app has no segment actually named &#x60;All&#x60;, it targets all subscribers instead of a literal segment lookup. | [optional] |
| **excluded_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **include_subscription_ids** | **Array&lt;String&gt;** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\&quot;1dd608f2-c6a1-11e3-851d-000c2940e62c\&quot;] Limit of 2,000 entries per REST API call | [optional] |
| **include_email_tokens** | **Array&lt;String&gt;** | Deprecated alias for &#x60;email_to&#x60;. 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 &#x60;email_to&#x60; in new integrations. | [optional] |
Expand Down
2 changes: 1 addition & 1 deletion docs/NotificationWithMeta.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] &#x60;\&quot;All\&quot;&#x60; is a shorthand for every subscribed user: if the array includes the string &#x60;\&quot;All\&quot;&#x60; and the app has no segment actually named &#x60;All&#x60;, it targets all subscribers instead of a literal segment lookup. | [optional] |
| **excluded_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **include_subscription_ids** | **Array&lt;String&gt;** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\&quot;1dd608f2-c6a1-11e3-851d-000c2940e62c\&quot;] Limit of 2,000 entries per REST API call | [optional] |
| **include_email_tokens** | **Array&lt;String&gt;** | Deprecated alias for &#x60;email_to&#x60;. 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 &#x60;email_to&#x60; in new integrations. | [optional] |
Expand Down
2 changes: 1 addition & 1 deletion docs/SegmentNotificationTarget.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
| **included_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] &#x60;\&quot;All\&quot;&#x60; is a shorthand for every subscribed user: if the array includes the string &#x60;\&quot;All\&quot;&#x60; and the app has no segment actually named &#x60;All&#x60;, it targets all subscribers instead of a literal segment lookup. | [optional] |
| **excluded_segments** | **Array&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |

## Example
Expand Down
Loading