Update a workflow
Updates the details of an existing workflow, here workflowId is the identifier of the workflow
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,
},
},
},
},
origin: "external",
}, "<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,
} },
},
},
},
Origin = ResourceOriginEnum.External,
}
);
// 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,
),
],
),
),
origin: Components\ResourceOriginEnum::External,
);
$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,
),
},
),
),
origin=novu_py.ResourceOriginEnum.EXTERNAL,
))
# Handle response
print(res)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),
},
},
},
},
Origin: components.ResourceOriginEnumExternal,
}, nil)
if err != nil {
log.Fatal(err)
}
if res.WorkflowResponseDto != nil {
// handle response
}
}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,
"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,
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 \"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 \"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>"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>"
}
},
"redirect": {
"url": "<string>"
},
"disableOutputSanitization": false,
"data": {}
},
"dataSchema": {},
"uiSchema": {
"properties": {}
}
},
"variables": {},
"stepId": "<string>",
"_id": "<string>",
"name": "<string>",
"slug": "<string>",
"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>"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>"
}
},
"redirect": {
"url": "<string>"
},
"disableOutputSanitization": false,
"data": {}
},
"issues": {
"controls": {},
"integration": {}
},
"stepResolverHash": "<string>"
}
],
"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
}
}
}
},
"description": "<string>",
"tags": [
"<string>"
],
"active": false,
"validatePayload": true,
"payloadSchema": {},
"isTranslationEnabled": false,
"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
API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".
Headers
A header for idempotency purposes
Path Parameters
Body
Workflow update details
Name of the workflow
Steps of the workflow
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
Show child attributes
Show child attributes
Workflow preferences
Show child attributes
Show child attributes
Origin of the layout
novu-cloud, novu-cloud-v1, external Description of the workflow
Tags associated with the workflow
Whether the workflow is active
Enable or disable payload schema validation
The payload JSON Schema for the workflow
Enable or disable translations for this workflow
Workflow ID (allowed only for code-first workflows)
Severity of the workflow
high, medium, low, none Response
OK
Name of the workflow
Database identifier of the workflow
Workflow identifier
Slug of the workflow
Last updated timestamp
Creation timestamp
Steps of the workflow
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
Show child attributes
Show child attributes
Origin of the layout
novu-cloud, novu-cloud-v1, external Preferences for the workflow
Show child attributes
Show child attributes
Status of the workflow
ACTIVE, INACTIVE, ERROR Severity of the workflow
high, medium, low, none Description of the workflow
Tags associated with the workflow
Whether the workflow is active
Enable or disable payload schema validation
The payload JSON Schema for the workflow
Enable or disable translations for this workflow
User who last updated the workflow
Show child attributes
Show child attributes
Timestamp of the last workflow publication
User who last published the workflow
Show child attributes
Show child attributes
Runtime issues for workflow creation and update
Show child attributes
Show child attributes
Timestamp of the last workflow trigger
Generated payload example based on the payload schema
Was this page helpful?
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,
},
},
},
},
origin: "external",
}, "<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,
} },
},
},
},
Origin = ResourceOriginEnum.External,
}
);
// 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,
),
],
),
),
origin: Components\ResourceOriginEnum::External,
);
$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,
),
},
),
),
origin=novu_py.ResourceOriginEnum.EXTERNAL,
))
# Handle response
print(res)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),
},
},
},
},
Origin: components.ResourceOriginEnumExternal,
}, nil)
if err != nil {
log.Fatal(err)
}
if res.WorkflowResponseDto != nil {
// handle response
}
}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,
"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,
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 \"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 \"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>"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>"
}
},
"redirect": {
"url": "<string>"
},
"disableOutputSanitization": false,
"data": {}
},
"dataSchema": {},
"uiSchema": {
"properties": {}
}
},
"variables": {},
"stepId": "<string>",
"_id": "<string>",
"name": "<string>",
"slug": "<string>",
"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>"
}
},
"secondaryAction": {
"label": "<string>",
"redirect": {
"url": "<string>"
}
},
"redirect": {
"url": "<string>"
},
"disableOutputSanitization": false,
"data": {}
},
"issues": {
"controls": {},
"integration": {}
},
"stepResolverHash": "<string>"
}
],
"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
}
}
}
},
"description": "<string>",
"tags": [
"<string>"
],
"active": false,
"validatePayload": true,
"payloadSchema": {},
"isTranslationEnabled": false,
"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."