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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

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

- API version: 5.16.0
- Package version: 5.16.0
- API version: 5.17.0
- Package version: 5.17.0

## Requirements

Expand Down
208 changes: 202 additions & 6 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Method | HTTP request | Description
[**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} |
[**duplicate_journey**](DefaultApi.md#duplicate_journey) | **POST** /apps/{app_id}/journeys/{journey_id}/duplicate | Duplicate journey
[**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
Expand Down Expand Up @@ -1832,7 +1833,7 @@ with onesignal.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
app_id = "YOUR_APP_ID" # The OneSignal App ID for your app. Available in Keys & IDs.
segment_id = "d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e" # The segment_id can be found in the URL of the segment when viewing it in the dashboard.
segment_id = "d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e" # The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard.

try:
# Delete Segment
Expand All @@ -1850,7 +1851,7 @@ with onesignal.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**app_id** | **str**| The OneSignal App ID for your app. Available in Keys & IDs. |
**segment_id** | **str**| The segment_id can be found in the URL of the segment when viewing it in the dashboard. |
**segment_id** | **str**| The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard. |

### Return type

Expand Down Expand Up @@ -2107,6 +2108,201 @@ void (empty response body)

[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api)

# **duplicate_journey**
> Journey duplicate_journey(app_id, journey_id)

Duplicate journey

The Journeys API is in beta. Endpoints and response fields can still change. Copy an existing journey into a new draft. The source does not change. The copy is always a draft, and started_at and archived_at are null. If you omit the body, or omit overrides, the copy keeps the source description, audience, nodes, early_exit, and reentry_rules. The copy takes the source name plus \" (Copy)\". The copy does not keep schedule. Send schedule under overrides to set it. Server-controlled fields are rejected with 400. The authenticated App API key must have permission to create journeys.

### Example

* Bearer Authentication (rest_api_key):

```python
import onesignal
from onesignal.api import default_api
from onesignal.models import *
from pprint import pprint

# See configuration.py for a list of all supported configuration parameters.
# Some of the OneSignal endpoints require ORGANIZATION_API_KEY token for authorization, while others require REST_API_KEY.
# We recommend adding both of them in the configuration page so that you will not need to figure it out yourself.
configuration = onesignal.Configuration(
rest_api_key = "YOUR_REST_API_KEY", # App REST API key required for most endpoints
organization_api_key = "YOUR_ORGANIZATION_API_KEY" # Organization key is only required for creating new apps and other top-level endpoints
)


# Enter a context with an instance of the API client
with onesignal.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
app_id = "YOUR_APP_ID" # Your OneSignal App ID in UUID v4 format.
journey_id = "YOUR_JOURNEY_ID" # UUID of the journey to copy.
duplicate_journey_request = DuplicateJourneyRequest(
overrides=DuplicateJourneyOverrides(
name="name_example",
description="description_example",
audience=JourneyAudience(
kind="segment",
included_segment_ids=[
"included_segment_ids_example",
],
excluded_segment_ids=[
"excluded_segment_ids_example",
],
future_additions_only=True,
name="name_example",
attributes=JourneyEventTriggerAttributes([
[
JourneyEventAttribute(
key="key_example",
operator="equal",
value="value_example",
),
],
]),
),
early_exit=JourneyEarlyExit(
rules=JourneyEarlyExitRules(
on_segment=JourneyEarlyExitRulesOnSegment(
included_segment_ids=[
"included_segment_ids_example",
],
),
when_not_in_audience=True,
on_session=True,
on_event=JourneyEarlyExitRulesOnEvent(
name="name_example",
),
),
tag_on_early_exit={
"key": "key_example",
},
),
reentry_rules=JourneyReentryRules(
duration_seconds=600,
),
schedule=JourneySchedule(
start_at="start_at_example",
stop_at="stop_at_example",
error="error_example",
),
nodes=[
JourneyNode(
id="id_example",
kind="wait",
client_node_id="client_node_id_example",
annotation="annotation_example",
duration_seconds=60,
relative_to="schedule_in_timezone",
windows=[
JourneyTimeWindow(
start=None,
end=None,
day_of_week=1,
),
],
time_zone="time_zone_example",
use_user_time_zone=True,
template_id="template_id_example",
iam_id="iam_id_example",
user_ttl_seconds=1,
webhook_id="webhook_id_example",
assignments={
"key": "key_example",
},
randomize_on_entry=True,
branches=[
JourneyBranch(
id="id_example",
condition=JourneyCondition(
kind="segment_membership",
included_segment_ids=[
"included_segment_ids_example",
],
excluded_segment_ids=[
"excluded_segment_ids_example",
],
action="received",
sending_node_id="sending_node_id_example",
client_node_id="client_node_id_example",
name="name_example",
attributes=JourneyEventTriggerAttributes([
[
JourneyEventAttribute(
key="key_example",
operator="equal",
value="value_example",
),
],
]),
entry_event_match_attributes=[
{},
],
),
weight=3.14,
nodes=[
JourneyNode(),
],
),
],
expiration=JourneyWaitUntilExpiration(
duration_seconds=60,
exits=True,
),
),
],
),
)

try:
# Duplicate journey
api_response = api_instance.duplicate_journey(app_id, journey_id, duplicate_journey_request=duplicate_journey_request)
pprint(api_response)
except onesignal.ApiException as e:
print("Exception when calling DefaultApi->duplicate_journey: %s\n" % e)
print("Status Code: %s" % e.status)
print("Response Body: %s" % e.body)
```


### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**app_id** | **str**| Your OneSignal App ID in UUID v4 format. |
**journey_id** | **str**| UUID of the journey to copy. |
**duplicate_journey_request** | [**DuplicateJourneyRequest**](DuplicateJourneyRequest.md)| | [optional]

### Return type

[**Journey**](Journey.md)

### Authorization

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

### HTTP request headers

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


### HTTP response details

| Status code | Description | Response headers |
|-------------|-------------|------------------|
**201** | Created | - |
**400** | Bad Request | - |
**403** | Forbidden | - |
**404** | Not Found | - |
**429** | Rate Limit Exceeded | - |
**0** | Unexpected error | - |

[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api)

# **estimate_notification_recipients**
> EstimateNotificationRecipientsSuccessResponse estimate_notification_recipients(estimate_notification_recipients_request)

Expand Down Expand Up @@ -3068,7 +3264,7 @@ with onesignal.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
app_id = "YOUR_APP_ID" # The OneSignal App ID for your app. Available in Keys & IDs.
segment_id = "d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e" # The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
segment_id = "d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e" # The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard.
include_segment_detail = True # Set to true to include segment metadata and filters in the response. (optional)

try:
Expand All @@ -3087,7 +3283,7 @@ with onesignal.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**app_id** | **str**| The OneSignal App ID for your app. Available in Keys & IDs. |
**segment_id** | **str**| The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. |
**segment_id** | **str**| The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard. |
**include_segment_detail** | **bool**| Set to true to include segment metadata and filters in the response. | [optional]

### Return type
Expand Down Expand Up @@ -4585,7 +4781,7 @@ with onesignal.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
app_id = "YOUR_APP_ID" # The OneSignal App ID for your app. Available in Keys & IDs.
segment_id = "d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e" # The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
segment_id = "d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e" # The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard.
update_segment_request = UpdateSegmentRequest(
name="name_example",
description="description_example",
Expand Down Expand Up @@ -4619,7 +4815,7 @@ with onesignal.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**app_id** | **str**| The OneSignal App ID for your app. Available in Keys & IDs. |
**segment_id** | **str**| The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. |
**segment_id** | **str**| The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard. |
**update_segment_request** | [**UpdateSegmentRequest**](UpdateSegmentRequest.md)| | [optional]

### Return type
Expand Down
19 changes: 19 additions & 0 deletions docs/DuplicateJourneyOverrides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# DuplicateJourneyOverrides

Journey fields to apply over the copy as a JSON Merge Patch (RFC 7396). Accepts the same writable fields as Create journey, and none of them are required. The patch merges into the copy, not the source. The copy starts without a schedule, so an omitted schedule leaves the copy unscheduled. An object merges key by key. A null value clears a nullable field. An array such as nodes replaces the copied array. Server-controlled fields such as id or state are rejected.

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | Name for the copy, up to 300 characters. If you omit it, the copy takes the name of the source plus \" (Copy)\". | [optional]
**description** | **str, none_type** | Optional journey description, up to 1024 characters. If you omit it, the copy takes the description of the source. Send null to clear it. | [optional]
**audience** | [**JourneyAudience**](JourneyAudience.md) | | [optional]
**early_exit** | [**JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional]
**reentry_rules** | [**JourneyReentryRules**](JourneyReentryRules.md) | | [optional]
**schedule** | [**JourneySchedule**](JourneySchedule.md) | | [optional]
**nodes** | [**[JourneyNode]**](JourneyNode.md) | Full ordered list of nodes. Replaces the copied graph. Server-assigned id fields are rejected. | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api)


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

Optional body for Duplicate journey. Only overrides is applied. A journey field sent at the top level is ignored.

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**overrides** | [**DuplicateJourneyOverrides**](DuplicateJourneyOverrides.md) | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

[[Back to API list]](https://github.com/OneSignal/onesignal-python-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-python-api)


2 changes: 1 addition & 1 deletion docs/Journey.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Journey

Full journey representation returned by the detail, create, and update endpoints.
Full journey representation returned by the detail, create, update, and duplicate endpoints.

## Properties
Name | Type | Description | Notes
Expand Down
4 changes: 2 additions & 2 deletions docs/JourneyNode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Name | Type | Description | Notes
**kind** | **str** | Node kind. Selects which other fields apply. |
**id** | **str** | Server-assigned node UUID. Returned on reads. Required on update to keep an existing node. Rejected on create with a 400 validation error. | [optional]
**client_node_id** | **str** | Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. | [optional]
**annotation** | **str** | Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. | [optional]
**annotation** | **str** | Optional free-text label, up to 1024 characters. Stored and returned as-is with no effect on journey behavior. | [optional]
**duration_seconds** | **int, none_type** | wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). | [optional]
**relative_to** | **str** | time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. | [optional]
**windows** | [**[JourneyTimeWindow]**](JourneyTimeWindow.md) | time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. | [optional]
Expand All @@ -20,7 +20,7 @@ Name | Type | Description | Notes
**webhook_id** | **str** | send_webhook nodes: UUID of the webhook to send. | [optional]
**assignments** | **{str: (str,)}** | tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. | [optional]
**randomize_on_entry** | **bool, none_type** | split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. | [optional]
**branches** | [**[JourneyBranch]**](JourneyBranch.md) | Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. | [optional]
**branches** | [**[JourneyBranch]**](JourneyBranch.md) | Branching nodes: nested branches. split_range requires 2-25 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-25 condition branches. | [optional]
**expiration** | [**JourneyWaitUntilExpiration**](JourneyWaitUntilExpiration.md) | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

Expand Down
Loading
Loading