(topics.subscribers)
Add subscribers to a topic by key
from novu_py import Novu
import os
with Novu(
secret_key=os.getenv("NOVU_SECRET_KEY", ""),
) as novu:
res = novu.topics.subscribers.assign(topic_key="<value>", add_subscribers_request_dto={
"subscribers": [
"<value>",
"<value>",
"<value>",
],
})
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
topic_key |
str | ✔️ | The topic key |
add_subscribers_request_dto |
models.AddSubscribersRequestDto | ✔️ | N/A |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.TopicsControllerAssignResponse
Error Type | Status Code | Content Type |
---|---|---|
models.ErrorDto | 414 | application/json |
models.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
models.ValidationErrorDto | 422 | application/json |
models.ErrorDto | 500 | application/json |
models.APIError | 4XX, 5XX | */* |
Check if a subscriber belongs to a certain topic
from novu_py import Novu
import os
with Novu(
secret_key=os.getenv("NOVU_SECRET_KEY", ""),
) as novu:
res = novu.topics.subscribers.retrieve(external_subscriber_id="<id>", topic_key="<value>")
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
external_subscriber_id |
str | ✔️ | The external subscriber id |
topic_key |
str | ✔️ | The topic key |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.TopicsControllerGetTopicSubscriberResponse
Error Type | Status Code | Content Type |
---|---|---|
models.ErrorDto | 414 | application/json |
models.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
models.ValidationErrorDto | 422 | application/json |
models.ErrorDto | 500 | application/json |
models.APIError | 4XX, 5XX | */* |
Remove subscribers from a topic
from novu_py import Novu
import os
with Novu(
secret_key=os.getenv("NOVU_SECRET_KEY", ""),
) as novu:
res = novu.topics.subscribers.remove(topic_key="<value>", remove_subscribers_request_dto={
"subscribers": [
"<value>",
"<value>",
],
})
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
topic_key |
str | ✔️ | The topic key |
remove_subscribers_request_dto |
models.RemoveSubscribersRequestDto | ✔️ | N/A |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.TopicsControllerRemoveSubscribersResponse
Error Type | Status Code | Content Type |
---|---|---|
models.ErrorDto | 414 | application/json |
models.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
models.ValidationErrorDto | 422 | application/json |
models.ErrorDto | 500 | application/json |
models.APIError | 4XX, 5XX | */* |