Skip to content

Latest commit

 

History

History
178 lines (119 loc) · 14.1 KB

README.md

File metadata and controls

178 lines (119 loc) · 14.1 KB

Preferences

(subscribers.preferences)

Overview

Available Operations

list

Get subscriber preferences

Example Usage

from novu_py import Novu
import os

with Novu(
    api_key=os.getenv("NOVU_API_KEY", ""),
) as novu:

    res = novu.subscribers.preferences.list(subscriber_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
subscriber_id str ✔️ N/A
include_inactive_channels Optional[bool] A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SubscribersControllerListSubscriberPreferencesResponse

Errors

Error Type Status Code Content Type
models.ErrorDto 400, 404, 409 application/json
models.ValidationErrorDto 422 application/json
models.APIError 4XX, 5XX */*

update_global

Update subscriber global preferences

Example Usage

from novu_py import Novu
import os

with Novu(
    api_key=os.getenv("NOVU_API_KEY", ""),
) as novu:

    res = novu.subscribers.preferences.update_global(subscriber_id="<id>", update_subscriber_global_preferences_request_dto={})

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
subscriber_id str ✔️ N/A
update_subscriber_global_preferences_request_dto models.UpdateSubscriberGlobalPreferencesRequestDto ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SubscribersControllerUpdateSubscriberGlobalPreferencesResponse

Errors

Error Type Status Code Content Type
models.ErrorDto 400, 404, 409 application/json
models.ValidationErrorDto 422 application/json
models.APIError 4XX, 5XX */*

retrieve_by_level

Get subscriber preferences by level

Example Usage

import novu_py
from novu_py import Novu
import os

with Novu(
    api_key=os.getenv("NOVU_API_KEY", ""),
) as novu:

    res = novu.subscribers.preferences.retrieve_by_level(preference_level=novu_py.Parameter.TEMPLATE, subscriber_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
preference_level models.Parameter ✔️ the preferences level to be retrieved (template / global)
subscriber_id str ✔️ N/A
include_inactive_channels Optional[bool] A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SubscribersControllerGetSubscriberPreferenceByLevelResponse

Errors

Error Type Status Code Content Type
models.ErrorDto 400, 404, 409 application/json
models.ValidationErrorDto 422 application/json
models.APIError 4XX, 5XX */*

update

Update subscriber preference

Example Usage

from novu_py import Novu
import os

with Novu(
    api_key=os.getenv("NOVU_API_KEY", ""),
) as novu:

    res = novu.subscribers.preferences.update(subscriber_id="<id>", workflow_id="<id>", update_subscriber_preference_request_dto={})

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
subscriber_id str ✔️ N/A
workflow_id str ✔️ N/A
update_subscriber_preference_request_dto models.UpdateSubscriberPreferenceRequestDto ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SubscribersControllerUpdateSubscriberPreferenceResponse

Errors

Error Type Status Code Content Type
models.ErrorDto 400, 404, 409 application/json
models.ValidationErrorDto 422 application/json
models.APIError 4XX, 5XX */*