Skip to content

Latest commit

 

History

History
128 lines (95 loc) · 8.11 KB

File metadata and controls

128 lines (95 loc) · 8.11 KB

Workflows.Steps

Overview

Available Operations

generate_preview

Generates a preview for a specific workflow step by its unique identifier stepId

Example Usage

import novu_py
from novu_py import Novu


with Novu(
    secret_key="YOUR_SECRET_KEY_HERE",
) as novu:

    res = novu.workflows.steps.generate_preview(workflow_id="<id>", step_id="<id>", generate_preview_request_dto={
        "preview_payload": {
            "subscriber": {
                "channels": [
                    {
                        "provider_id": novu_py.ChatOrPushProviderEnum.NOVU_SLACK,
                        "credentials": {
                            "webhook_url": "https://example.com/webhook",
                            "channel": "general",
                            "device_tokens": [
                                "token1",
                                "token2",
                                "token3",
                            ],
                            "alert_uid": "12345-abcde",
                            "title": "Critical Alert",
                            "image_url": "https://example.com/image.png",
                            "state": "resolved",
                            "external_url": "https://example.com/details",
                        },
                        "integration_id": "<id>",
                    },
                ],
            },
            "context": {
                "key": "org-acme",
            },
        },
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_id str ✔️ N/A
step_id str ✔️ N/A
generate_preview_request_dto models.GeneratePreviewRequestDto ✔️ Preview generation details
idempotency_key Optional[str] A header for idempotency purposes
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowControllerGeneratePreviewResponse

Errors

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 */*

retrieve

Retrieves data for a specific step in a workflow

Example Usage

from novu_py import Novu


with Novu(
    secret_key="YOUR_SECRET_KEY_HERE",
) as novu:

    res = novu.workflows.steps.retrieve(workflow_id="<id>", step_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
workflow_id str ✔️ N/A
step_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.

Response

models.WorkflowControllerGetWorkflowStepDataResponse

Errors

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 */*