import { Novu } from '@novu/node';
const novu = new Novu('<NOVU_API_KEY>');
const payload = {
content: "<h1>Layout Start</h1>{{{body}}}<h1>Layout End</h1>",
description: "Organisation's first layout",
name: "First Layout",
identifier: "firstlayout",
variables: [
{
type: "String",
name: "body"
required: true
defValue: ""
}
]
isDefault: "false"
}
await novu.layouts.create(payload);
require 'novu'
client = Novu::Client.new('<NOVU_API_KEY>')
payload = {
'name' => 'New layout',
'content' => '{{{body}}}',
'variables' => ['<list-variables-here>'], # optional
'description' => 'This is a description for the new layout', # optional
'isDefault' => true # optional
}
client.create_layout(payload)
from novu.api import LayoutApi
url = "https://api.novu.co"
api_key = "<NOVU_API_KEY>"
novu = LayoutApi(url, api_key).create(
layout="<The instance of the layout to create>",
)
import co.novu.sdk.Novu;
public class Main {
public static void main(String[] args) {
String apiKey = "<NOVU_API_KEY>";
Novu novu = new Novu(apiKey);
novu.createLayout(body);
}
}
{
"data": {
"_id": "Layout identifier"
}
}
Layouts
Layout creation
Create a layout
POST
/
v1
/
layouts
import { Novu } from '@novu/node';
const novu = new Novu('<NOVU_API_KEY>');
const payload = {
content: "<h1>Layout Start</h1>{{{body}}}<h1>Layout End</h1>",
description: "Organisation's first layout",
name: "First Layout",
identifier: "firstlayout",
variables: [
{
type: "String",
name: "body"
required: true
defValue: ""
}
]
isDefault: "false"
}
await novu.layouts.create(payload);
require 'novu'
client = Novu::Client.new('<NOVU_API_KEY>')
payload = {
'name' => 'New layout',
'content' => '{{{body}}}',
'variables' => ['<list-variables-here>'], # optional
'description' => 'This is a description for the new layout', # optional
'isDefault' => true # optional
}
client.create_layout(payload)
from novu.api import LayoutApi
url = "https://api.novu.co"
api_key = "<NOVU_API_KEY>"
novu = LayoutApi(url, api_key).create(
layout="<The instance of the layout to create>",
)
import co.novu.sdk.Novu;
public class Main {
public static void main(String[] args) {
String apiKey = "<NOVU_API_KEY>";
Novu novu = new Novu(apiKey);
novu.createLayout(body);
}
}
{
"data": {
"_id": "Layout identifier"
}
}
Enter your API key in the
Authorization field like the example shown below:E.g ApiKey 18d2e625f05d80eimport { Novu } from '@novu/node';
const novu = new Novu('<NOVU_API_KEY>');
const payload = {
content: "<h1>Layout Start</h1>{{{body}}}<h1>Layout End</h1>",
description: "Organisation's first layout",
name: "First Layout",
identifier: "firstlayout",
variables: [
{
type: "String",
name: "body"
required: true
defValue: ""
}
]
isDefault: "false"
}
await novu.layouts.create(payload);
require 'novu'
client = Novu::Client.new('<NOVU_API_KEY>')
payload = {
'name' => 'New layout',
'content' => '{{{body}}}',
'variables' => ['<list-variables-here>'], # optional
'description' => 'This is a description for the new layout', # optional
'isDefault' => true # optional
}
client.create_layout(payload)
from novu.api import LayoutApi
url = "https://api.novu.co"
api_key = "<NOVU_API_KEY>"
novu = LayoutApi(url, api_key).create(
layout="<The instance of the layout to create>",
)
import co.novu.sdk.Novu;
public class Main {
public static void main(String[] args) {
String apiKey = "<NOVU_API_KEY>";
Novu novu = new Novu(apiKey);
novu.createLayout(body);
}
}
{
"data": {
"_id": "Layout identifier"
}
}
Was this page helpful?
⌘I