All notifications are sent via a workflow. Each workflow acts as a container for the logic and blueprint that are associated with a type of notification in your system. https://docs.novu.co/workflows
- create - Create a workflow
- list - List all workflows
- update - Update a workflow
- get - Retrieve a workflow
- delete - Delete a workflow
- patch - Update a workflow
- sync - Sync a workflow
Creates a new workflow in the Novu Cloud environment
import novu_py
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.workflows.create(create_workflow_dto=novu_py.CreateWorkflowDto(
name="<value>",
workflow_id="<id>",
steps=[],
preferences=novu_py.PreferencesRequestDto(
user=novu_py.UserWorkflowPreferencesDto(
all=novu_py.WorkflowPreferenceDto(
enabled=True,
read_only=False,
),
channels={
"email": novu_py.ChannelPreferenceDto(
enabled=True,
),
"sms": novu_py.ChannelPreferenceDto(
enabled=False,
),
},
),
workflow=novu_py.PreferencesRequestDtoWorkflow(
all=novu_py.WorkflowPreferenceDto(
enabled=True,
read_only=False,
),
channels={
"email": novu_py.ChannelPreferenceDto(),
"sms": novu_py.ChannelPreferenceDto(
enabled=False,
),
},
),
),
))
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
create_workflow_dto |
models.CreateWorkflowDto | ✔️ | Workflow creation details |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.WorkflowControllerCreateResponse
| 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 | */* |
Retrieves a list of workflows with optional filtering and pagination
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.workflows.list(request={
"limit": 10,
"offset": 0,
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.WorkflowControllerSearchWorkflowsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.WorkflowControllerSearchWorkflowsResponse
| 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 | */* |
Updates the details of an existing workflow, here workflowId is the identifier of the workflow
import novu_py
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.workflows.update(workflow_id="<id>", update_workflow_dto=novu_py.UpdateWorkflowDto(
name="<value>",
steps=[],
preferences=novu_py.PreferencesRequestDto(
user=novu_py.UserWorkflowPreferencesDto(
all=novu_py.WorkflowPreferenceDto(
enabled=True,
read_only=False,
),
channels={
"email": novu_py.ChannelPreferenceDto(
enabled=True,
),
"sms": novu_py.ChannelPreferenceDto(
enabled=False,
),
},
),
workflow=novu_py.PreferencesRequestDtoWorkflow(
all=novu_py.WorkflowPreferenceDto(
enabled=True,
read_only=False,
),
channels={
"email": novu_py.ChannelPreferenceDto(),
"sms": novu_py.ChannelPreferenceDto(
enabled=False,
),
},
),
),
origin=novu_py.ResourceOriginEnum.EXTERNAL,
))
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id |
str | ✔️ | N/A |
update_workflow_dto |
models.UpdateWorkflowDto | ✔️ | Workflow update details |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.WorkflowControllerUpdateResponse
| 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 | */* |
Fetches details of a specific workflow by its unique identifier workflowId
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.workflows.get(workflow_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id |
str | ✔️ | N/A |
environment_id |
Optional[str] | ➖ | 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.WorkflowControllerGetWorkflowResponse
| 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 | */* |
Removes a specific workflow by its unique identifier workflowId
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.workflows.delete(workflow_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id |
str | ✔️ | 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.WorkflowControllerRemoveWorkflowResponse
| 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 | */* |
Partially updates a workflow by its unique identifier workflowId
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.workflows.patch(workflow_id="<id>", patch_workflow_dto={})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id |
str | ✔️ | N/A |
patch_workflow_dto |
models.PatchWorkflowDto | ✔️ | Workflow patch details |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.WorkflowControllerPatchWorkflowResponse
| 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 | */* |
Synchronizes a workflow to the target environment
from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.workflows.sync(workflow_id="<id>", sync_workflow_dto={
"target_environment_id": "<id>",
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id |
str | ✔️ | N/A |
sync_workflow_dto |
models.SyncWorkflowDto | ✔️ | Sync workflow details |
idempotency_key |
Optional[str] | ➖ | A header for idempotency purposes |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.WorkflowControllerSyncResponse
| 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 | */* |