Workflows
Update a workflow
Updates the details of an existing workflow, here workflowId is the identifier of the workflow
PUT
/
v2
/
workflows
/
{workflowId}
Go
package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Workflows.Update(ctx, "<id>", components.UpdateWorkflowDto{
Name: "<value>",
Steps: []components.UpdateWorkflowDtoSteps{},
Preferences: components.PreferencesRequestDto{
User: v3.Pointer(components.CreateUserUserWorkflowPreferencesDto(
components.UserWorkflowPreferencesDto{
All: components.CreateUserAllWorkflowPreferenceDto(
components.WorkflowPreferenceDto{},
),
Channels: map[string]components.ChannelPreferenceDto{
"email": components.ChannelPreferenceDto{},
"sms": components.ChannelPreferenceDto{
Enabled: v3.Pointer(false),
},
},
},
)),
Workflow: &components.PreferencesRequestDtoWorkflow{
All: components.CreatePreferencesRequestDtoAllWorkflowPreferenceDto(
components.WorkflowPreferenceDto{},
),
Channels: map[string]components.ChannelPreferenceDto{
"email": components.ChannelPreferenceDto{},
"sms": components.ChannelPreferenceDto{
Enabled: v3.Pointer(false),
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.WorkflowResponseDto != nil {
// handle response
}
}import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.workflows.update({
name: "<value>",
steps: [],
preferences: {
user: {
all: {
enabled: true,
readOnly: false,
},
channels: {
"email": {
enabled: true,
},
"sms": {
enabled: false,
},
},
},
workflow: {
all: {
enabled: true,
readOnly: false,
},
channels: {
"email": {},
"sms": {
enabled: false,
},
},
},
},
}, "<id>");
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Workflows.UpdateAsync(
workflowId: "<id>",
updateWorkflowDto: new UpdateWorkflowDto() {
Name = "<value>",
Steps = new List<UpdateWorkflowDtoSteps>() {},
Preferences = new PreferencesRequestDto() {
User = User.CreateUserWorkflowPreferencesDto(
new UserWorkflowPreferencesDto() {
All = UserAll.CreateWorkflowPreferenceDto(
new WorkflowPreferenceDto() {}
),
Channels = new Dictionary<string, ChannelPreferenceDto>() {
{ "email", new ChannelPreferenceDto() {} },
{ "sms", new ChannelPreferenceDto() {
Enabled = false,
} },
},
}
),
Workflow = new PreferencesRequestDtoWorkflow() {
All = PreferencesRequestDtoAll.CreateWorkflowPreferenceDto(
new WorkflowPreferenceDto() {}
),
Channels = new Dictionary<string, ChannelPreferenceDto>() {
{ "email", new ChannelPreferenceDto() {} },
{ "sms", new ChannelPreferenceDto() {
Enabled = false,
} },
},
},
},
}
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$updateWorkflowDto = new Components\UpdateWorkflowDto(
name: '<value>',
steps: [],
preferences: new Components\PreferencesRequestDto(
user: new Components\UserWorkflowPreferencesDto(
all: new Components\WorkflowPreferenceDto(),
channels: [
'email' => new Components\ChannelPreferenceDto(),
'sms' => new Components\ChannelPreferenceDto(
enabled: false,
),
],
),
workflow: new Components\PreferencesRequestDtoWorkflow(
all: new Components\WorkflowPreferenceDto(),
channels: [
'email' => new Components\ChannelPreferenceDto(),
'sms' => new Components\ChannelPreferenceDto(
enabled: false,
),
],
),
),
);
$response = $sdk->workflows->update(
workflowId: '<id>',
updateWorkflowDto: $updateWorkflowDto
);
if ($response->workflowResponseDto !== null) {
// handle response
}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,
),
},
),
),
))
# Handle response
print(res)curl --request PUT \
--url https://api.novu.co/v2/workflows/{workflowId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"steps": [
{
"name": "<string>",
"_id": "<string>",
"stepId": "<string>",
"controlValues": {
"skip": {
"and": [
{
"==": [
{
"var": "payload.tier"
},
"pro"
]
},
{
"==": [
{
"var": "subscriber.data.role"
},
"admin"
]
},
{
">": [
{
"var": "payload.amount"
},
"4"
]
}
]
},
"body": "<string>",
"subject": "<string>",
"avatar": "<string>",
"primaryAction": {
"label": "<string>"
},
"secondaryAction": {
"label": "<string>"
},
"disableOutputSanitization": false,
"data": {}
}
}
],
"preferences": {
"user": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
},
"workflow": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
}
},
"description": "<string>",
"tags": [
"<string>"
],
"active": false,
"validatePayload": true,
"payloadSchema": {},
"isTranslationEnabled": false,
"agent": {
"identifier": "<string>",
"providers": {}
},
"workflowId": "<string>"
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
steps: [
{
name: '<string>',
_id: '<string>',
stepId: '<string>',
controlValues: {
skip: {
and: [
{'==': [{var: 'payload.tier'}, 'pro']},
{'==': [{var: 'subscriber.data.role'}, 'admin']},
{'>': [{var: 'payload.amount'}, '4']}
]
},
body: JSON.stringify('<string>'),
subject: '<string>',
avatar: '<string>',
primaryAction: {label: '<string>'},
secondaryAction: {label: '<string>'},
disableOutputSanitization: false,
data: {}
}
}
],
preferences: {
user: {
all: {enabled: true, readOnly: false},
channels: {email: {enabled: true}, sms: {enabled: false}}
},
workflow: {
all: {enabled: true, readOnly: false},
channels: {email: {enabled: true}, sms: {enabled: false}}
}
},
description: '<string>',
tags: ['<string>'],
active: false,
validatePayload: true,
payloadSchema: {},
isTranslationEnabled: false,
agent: {identifier: '<string>', providers: {}},
workflowId: '<string>'
})
};
fetch('https://api.novu.co/v2/workflows/{workflowId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.put("https://api.novu.co/v2/workflows/{workflowId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"name\": \"<string>\",\n \"_id\": \"<string>\",\n \"stepId\": \"<string>\",\n \"controlValues\": {\n \"skip\": {\n \"and\": [\n {\n \"==\": [\n {\n \"var\": \"payload.tier\"\n },\n \"pro\"\n ]\n },\n {\n \"==\": [\n {\n \"var\": \"subscriber.data.role\"\n },\n \"admin\"\n ]\n },\n {\n \">\": [\n {\n \"var\": \"payload.amount\"\n },\n \"4\"\n ]\n }\n ]\n },\n \"body\": \"<string>\",\n \"subject\": \"<string>\",\n \"avatar\": \"<string>\",\n \"primaryAction\": {\n \"label\": \"<string>\"\n },\n \"secondaryAction\": {\n \"label\": \"<string>\"\n },\n \"disableOutputSanitization\": false,\n \"data\": {}\n }\n }\n ],\n \"preferences\": {\n \"user\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n },\n \"workflow\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"active\": false,\n \"validatePayload\": true,\n \"payloadSchema\": {},\n \"isTranslationEnabled\": false,\n \"agent\": {\n \"identifier\": \"<string>\",\n \"providers\": {}\n },\n \"workflowId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v2/workflows/{workflowId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"name\": \"<string>\",\n \"_id\": \"<string>\",\n \"stepId\": \"<string>\",\n \"controlValues\": {\n \"skip\": {\n \"and\": [\n {\n \"==\": [\n {\n \"var\": \"payload.tier\"\n },\n \"pro\"\n ]\n },\n {\n \"==\": [\n {\n \"var\": \"subscriber.data.role\"\n },\n \"admin\"\n ]\n },\n {\n \">\": [\n {\n \"var\": \"payload.amount\"\n },\n \"4\"\n ]\n }\n ]\n },\n \"body\": \"<string>\",\n \"subject\": \"<string>\",\n \"avatar\": \"<string>\",\n \"primaryAction\": {\n \"label\": \"<string>\"\n },\n \"secondaryAction\": {\n \"label\": \"<string>\"\n },\n \"disableOutputSanitization\": false,\n \"data\": {}\n }\n }\n ],\n \"preferences\": {\n \"user\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n },\n \"workflow\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"active\": false,\n \"validatePayload\": true,\n \"payloadSchema\": {},\n \"isTranslationEnabled\": false,\n \"agent\": {\n \"identifier\": \"<string>\",\n \"providers\": {}\n },\n \"workflowId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"_id": "<string>",
"workflowId": "<string>",
"slug": "<string>",
"updatedAt": "<string>",
"createdAt": "<string>",
"steps": [
{
"controls": {
"values": {
"skip": {
"and": [
{
"==": [
{
"var": "payload.tier"
},
"pro"
]
},
{
"==": [
{
"var": "subscriber.data.role"
},
"admin"
]
},
{
">": [
{
"var": "payload.amount"
},
"4"
]
}
]
},
"body": "<string>",
"subject": "<string>",
"avatar": "<string>",
"primaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"redirect": {
"url": "<string>",
"target": "_self"
},
"disableOutputSanitization": false,
"data": {}
},
"dataSchema": {},
"uiSchema": {
"group": "IN_APP",
"properties": {}
}
},
"variables": {},
"stepId": "<string>",
"_id": "<string>",
"name": "<string>",
"slug": "<string>",
"type": "in_app",
"origin": "novu-cloud",
"workflowId": "<string>",
"workflowDatabaseId": "<string>",
"controlValues": {
"skip": {
"and": [
{
"==": [
{
"var": "payload.tier"
},
"pro"
]
},
{
"==": [
{
"var": "subscriber.data.role"
},
"admin"
]
},
{
">": [
{
"var": "payload.amount"
},
"4"
]
}
]
},
"body": "<string>",
"subject": "<string>",
"avatar": "<string>",
"primaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"redirect": {
"url": "<string>",
"target": "_self"
},
"disableOutputSanitization": false,
"data": {}
},
"providerOverrides": {
"slack": {
"text": "{{payload.title}}",
"blocks": [
{
"type": "divider"
}
]
},
"whatsapp-business": {
"type": "text",
"text": {
"body": "{{payload.title}}"
}
},
"pagerduty": {
"severity": "warning",
"source": "novu",
"summary": "{{payload.title}}"
}
},
"issues": {
"controls": {},
"integration": {}
},
"stepResolverHash": "<string>"
}
],
"origin": "novu-cloud",
"preferences": {
"default": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
},
"user": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
}
},
"status": "ACTIVE",
"severity": "high",
"description": "<string>",
"tags": [
"<string>"
],
"active": false,
"validatePayload": true,
"payloadSchema": {},
"isTranslationEnabled": false,
"agent": {
"identifier": "<string>",
"providers": {}
},
"updatedBy": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"externalId": "<string>"
},
"lastPublishedAt": "<string>",
"lastPublishedBy": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"externalId": "<string>"
},
"issues": {},
"lastTriggeredAt": "<string>",
"payloadExample": {}
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."Authorizations
Body
application/json
Workflow update details
Response
OK
Was this page helpful?
⌘I
Go
package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Workflows.Update(ctx, "<id>", components.UpdateWorkflowDto{
Name: "<value>",
Steps: []components.UpdateWorkflowDtoSteps{},
Preferences: components.PreferencesRequestDto{
User: v3.Pointer(components.CreateUserUserWorkflowPreferencesDto(
components.UserWorkflowPreferencesDto{
All: components.CreateUserAllWorkflowPreferenceDto(
components.WorkflowPreferenceDto{},
),
Channels: map[string]components.ChannelPreferenceDto{
"email": components.ChannelPreferenceDto{},
"sms": components.ChannelPreferenceDto{
Enabled: v3.Pointer(false),
},
},
},
)),
Workflow: &components.PreferencesRequestDtoWorkflow{
All: components.CreatePreferencesRequestDtoAllWorkflowPreferenceDto(
components.WorkflowPreferenceDto{},
),
Channels: map[string]components.ChannelPreferenceDto{
"email": components.ChannelPreferenceDto{},
"sms": components.ChannelPreferenceDto{
Enabled: v3.Pointer(false),
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.WorkflowResponseDto != nil {
// handle response
}
}import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.workflows.update({
name: "<value>",
steps: [],
preferences: {
user: {
all: {
enabled: true,
readOnly: false,
},
channels: {
"email": {
enabled: true,
},
"sms": {
enabled: false,
},
},
},
workflow: {
all: {
enabled: true,
readOnly: false,
},
channels: {
"email": {},
"sms": {
enabled: false,
},
},
},
},
}, "<id>");
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Workflows.UpdateAsync(
workflowId: "<id>",
updateWorkflowDto: new UpdateWorkflowDto() {
Name = "<value>",
Steps = new List<UpdateWorkflowDtoSteps>() {},
Preferences = new PreferencesRequestDto() {
User = User.CreateUserWorkflowPreferencesDto(
new UserWorkflowPreferencesDto() {
All = UserAll.CreateWorkflowPreferenceDto(
new WorkflowPreferenceDto() {}
),
Channels = new Dictionary<string, ChannelPreferenceDto>() {
{ "email", new ChannelPreferenceDto() {} },
{ "sms", new ChannelPreferenceDto() {
Enabled = false,
} },
},
}
),
Workflow = new PreferencesRequestDtoWorkflow() {
All = PreferencesRequestDtoAll.CreateWorkflowPreferenceDto(
new WorkflowPreferenceDto() {}
),
Channels = new Dictionary<string, ChannelPreferenceDto>() {
{ "email", new ChannelPreferenceDto() {} },
{ "sms", new ChannelPreferenceDto() {
Enabled = false,
} },
},
},
},
}
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$updateWorkflowDto = new Components\UpdateWorkflowDto(
name: '<value>',
steps: [],
preferences: new Components\PreferencesRequestDto(
user: new Components\UserWorkflowPreferencesDto(
all: new Components\WorkflowPreferenceDto(),
channels: [
'email' => new Components\ChannelPreferenceDto(),
'sms' => new Components\ChannelPreferenceDto(
enabled: false,
),
],
),
workflow: new Components\PreferencesRequestDtoWorkflow(
all: new Components\WorkflowPreferenceDto(),
channels: [
'email' => new Components\ChannelPreferenceDto(),
'sms' => new Components\ChannelPreferenceDto(
enabled: false,
),
],
),
),
);
$response = $sdk->workflows->update(
workflowId: '<id>',
updateWorkflowDto: $updateWorkflowDto
);
if ($response->workflowResponseDto !== null) {
// handle response
}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,
),
},
),
),
))
# Handle response
print(res)curl --request PUT \
--url https://api.novu.co/v2/workflows/{workflowId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"steps": [
{
"name": "<string>",
"_id": "<string>",
"stepId": "<string>",
"controlValues": {
"skip": {
"and": [
{
"==": [
{
"var": "payload.tier"
},
"pro"
]
},
{
"==": [
{
"var": "subscriber.data.role"
},
"admin"
]
},
{
">": [
{
"var": "payload.amount"
},
"4"
]
}
]
},
"body": "<string>",
"subject": "<string>",
"avatar": "<string>",
"primaryAction": {
"label": "<string>"
},
"secondaryAction": {
"label": "<string>"
},
"disableOutputSanitization": false,
"data": {}
}
}
],
"preferences": {
"user": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
},
"workflow": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
}
},
"description": "<string>",
"tags": [
"<string>"
],
"active": false,
"validatePayload": true,
"payloadSchema": {},
"isTranslationEnabled": false,
"agent": {
"identifier": "<string>",
"providers": {}
},
"workflowId": "<string>"
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
steps: [
{
name: '<string>',
_id: '<string>',
stepId: '<string>',
controlValues: {
skip: {
and: [
{'==': [{var: 'payload.tier'}, 'pro']},
{'==': [{var: 'subscriber.data.role'}, 'admin']},
{'>': [{var: 'payload.amount'}, '4']}
]
},
body: JSON.stringify('<string>'),
subject: '<string>',
avatar: '<string>',
primaryAction: {label: '<string>'},
secondaryAction: {label: '<string>'},
disableOutputSanitization: false,
data: {}
}
}
],
preferences: {
user: {
all: {enabled: true, readOnly: false},
channels: {email: {enabled: true}, sms: {enabled: false}}
},
workflow: {
all: {enabled: true, readOnly: false},
channels: {email: {enabled: true}, sms: {enabled: false}}
}
},
description: '<string>',
tags: ['<string>'],
active: false,
validatePayload: true,
payloadSchema: {},
isTranslationEnabled: false,
agent: {identifier: '<string>', providers: {}},
workflowId: '<string>'
})
};
fetch('https://api.novu.co/v2/workflows/{workflowId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.put("https://api.novu.co/v2/workflows/{workflowId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"name\": \"<string>\",\n \"_id\": \"<string>\",\n \"stepId\": \"<string>\",\n \"controlValues\": {\n \"skip\": {\n \"and\": [\n {\n \"==\": [\n {\n \"var\": \"payload.tier\"\n },\n \"pro\"\n ]\n },\n {\n \"==\": [\n {\n \"var\": \"subscriber.data.role\"\n },\n \"admin\"\n ]\n },\n {\n \">\": [\n {\n \"var\": \"payload.amount\"\n },\n \"4\"\n ]\n }\n ]\n },\n \"body\": \"<string>\",\n \"subject\": \"<string>\",\n \"avatar\": \"<string>\",\n \"primaryAction\": {\n \"label\": \"<string>\"\n },\n \"secondaryAction\": {\n \"label\": \"<string>\"\n },\n \"disableOutputSanitization\": false,\n \"data\": {}\n }\n }\n ],\n \"preferences\": {\n \"user\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n },\n \"workflow\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"active\": false,\n \"validatePayload\": true,\n \"payloadSchema\": {},\n \"isTranslationEnabled\": false,\n \"agent\": {\n \"identifier\": \"<string>\",\n \"providers\": {}\n },\n \"workflowId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v2/workflows/{workflowId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"name\": \"<string>\",\n \"_id\": \"<string>\",\n \"stepId\": \"<string>\",\n \"controlValues\": {\n \"skip\": {\n \"and\": [\n {\n \"==\": [\n {\n \"var\": \"payload.tier\"\n },\n \"pro\"\n ]\n },\n {\n \"==\": [\n {\n \"var\": \"subscriber.data.role\"\n },\n \"admin\"\n ]\n },\n {\n \">\": [\n {\n \"var\": \"payload.amount\"\n },\n \"4\"\n ]\n }\n ]\n },\n \"body\": \"<string>\",\n \"subject\": \"<string>\",\n \"avatar\": \"<string>\",\n \"primaryAction\": {\n \"label\": \"<string>\"\n },\n \"secondaryAction\": {\n \"label\": \"<string>\"\n },\n \"disableOutputSanitization\": false,\n \"data\": {}\n }\n }\n ],\n \"preferences\": {\n \"user\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n },\n \"workflow\": {\n \"all\": {\n \"enabled\": true,\n \"readOnly\": false\n },\n \"channels\": {\n \"email\": {\n \"enabled\": true\n },\n \"sms\": {\n \"enabled\": false\n }\n }\n }\n },\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"active\": false,\n \"validatePayload\": true,\n \"payloadSchema\": {},\n \"isTranslationEnabled\": false,\n \"agent\": {\n \"identifier\": \"<string>\",\n \"providers\": {}\n },\n \"workflowId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"_id": "<string>",
"workflowId": "<string>",
"slug": "<string>",
"updatedAt": "<string>",
"createdAt": "<string>",
"steps": [
{
"controls": {
"values": {
"skip": {
"and": [
{
"==": [
{
"var": "payload.tier"
},
"pro"
]
},
{
"==": [
{
"var": "subscriber.data.role"
},
"admin"
]
},
{
">": [
{
"var": "payload.amount"
},
"4"
]
}
]
},
"body": "<string>",
"subject": "<string>",
"avatar": "<string>",
"primaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"redirect": {
"url": "<string>",
"target": "_self"
},
"disableOutputSanitization": false,
"data": {}
},
"dataSchema": {},
"uiSchema": {
"group": "IN_APP",
"properties": {}
}
},
"variables": {},
"stepId": "<string>",
"_id": "<string>",
"name": "<string>",
"slug": "<string>",
"type": "in_app",
"origin": "novu-cloud",
"workflowId": "<string>",
"workflowDatabaseId": "<string>",
"controlValues": {
"skip": {
"and": [
{
"==": [
{
"var": "payload.tier"
},
"pro"
]
},
{
"==": [
{
"var": "subscriber.data.role"
},
"admin"
]
},
{
">": [
{
"var": "payload.amount"
},
"4"
]
}
]
},
"body": "<string>",
"subject": "<string>",
"avatar": "<string>",
"primaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>",
"target": "_self"
}
},
"redirect": {
"url": "<string>",
"target": "_self"
},
"disableOutputSanitization": false,
"data": {}
},
"providerOverrides": {
"slack": {
"text": "{{payload.title}}",
"blocks": [
{
"type": "divider"
}
]
},
"whatsapp-business": {
"type": "text",
"text": {
"body": "{{payload.title}}"
}
},
"pagerduty": {
"severity": "warning",
"source": "novu",
"summary": "{{payload.title}}"
}
},
"issues": {
"controls": {},
"integration": {}
},
"stepResolverHash": "<string>"
}
],
"origin": "novu-cloud",
"preferences": {
"default": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
},
"user": {
"all": {
"enabled": true,
"readOnly": false
},
"channels": {
"email": {
"enabled": true
},
"sms": {
"enabled": false
}
}
}
},
"status": "ACTIVE",
"severity": "high",
"description": "<string>",
"tags": [
"<string>"
],
"active": false,
"validatePayload": true,
"payloadSchema": {},
"isTranslationEnabled": false,
"agent": {
"identifier": "<string>",
"providers": {}
},
"updatedBy": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"externalId": "<string>"
},
"lastPublishedAt": "<string>",
"lastPublishedBy": {
"_id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"externalId": "<string>"
},
"issues": {},
"lastTriggeredAt": "<string>",
"payloadExample": {}
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."