(subscribers.preferences)
- list - Get subscriber preferences
- update_global - Update subscriber global preferences
- retrieve_by_level - Get subscriber preferences by level
- update - Update subscriber preference
Get subscriber preferences
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)
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. |
models.SubscribersControllerListSubscriberPreferencesResponse
Error Type | Status Code | Content Type |
---|---|---|
models.ErrorDto | 400, 404, 409 | application/json |
models.ValidationErrorDto | 422 | application/json |
models.APIError | 4XX, 5XX | */* |
Update subscriber global preferences
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)
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. |
models.SubscribersControllerUpdateSubscriberGlobalPreferencesResponse
Error Type | Status Code | Content Type |
---|---|---|
models.ErrorDto | 400, 404, 409 | application/json |
models.ValidationErrorDto | 422 | application/json |
models.APIError | 4XX, 5XX | */* |
Get subscriber preferences by level
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)
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. |
models.SubscribersControllerGetSubscriberPreferenceByLevelResponse
Error Type | Status Code | Content Type |
---|---|---|
models.ErrorDto | 400, 404, 409 | application/json |
models.ValidationErrorDto | 422 | application/json |
models.APIError | 4XX, 5XX | */* |
Update subscriber preference
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)
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. |
models.SubscribersControllerUpdateSubscriberPreferenceResponse
Error Type | Status Code | Content Type |
---|---|---|
models.ErrorDto | 400, 404, 409 | application/json |
models.ValidationErrorDto | 422 | application/json |
models.APIError | 4XX, 5XX | */* |