n8n-nodes-octavehq
Version:
Octave is the AI-powered messaging brain for B2B go-to-market teams, helping articulate product value, synthesize customer interaction data, and deploy consistent, effective messaging across all channels.
106 lines • 4.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.exportedProperties = void 0;
exports.execute = execute;
const n8n_workflow_1 = require("n8n-workflow");
const OctaveApiRequest_1 = require("../../transport/OctaveApiRequest");
const utils_1 = require("../utils");
const properties = [
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
default: '',
description: 'The name/title of the brand voice',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
required: true,
default: '',
description: 'High-level description of this brand voice',
typeOptions: { rows: 3 },
},
{
displayName: 'Essence',
name: 'essence',
type: 'string',
default: '',
description: 'The core essence or soul of the brand voice (optional)',
typeOptions: { rows: 2 },
},
{
displayName: 'Personality (JSON)',
name: 'personality',
type: 'json',
required: true,
default: '{\n "coreTraits": [],\n "guidingPrinciples": []\n}',
description: 'Brand personality definition with coreTraits and guidingPrinciples (string arrays)',
typeOptions: { rows: 5 },
},
{
displayName: 'Tonality (JSON)',
name: 'tonality',
type: 'json',
required: true,
default: '{\n "soundLike": [],\n "neverSoundLike": []\n}',
description: 'Brand tonality with soundLike and neverSoundLike (string arrays)',
typeOptions: { rows: 5 },
},
{
displayName: 'Vocabulary (JSON)',
name: 'vocabulary',
type: 'json',
required: true,
default: '{\n "keyCompanyTerms": [],\n "keySubstitutions": []\n}',
description: 'Vocabulary with keyCompanyTerms and keySubstitutions (string arrays)',
typeOptions: { rows: 5 },
},
{
displayName: 'Writing Rules (JSON)',
name: 'writingRules',
type: 'json',
required: true,
default: '{\n "languageRules": [],\n "formattingFundamentals": []\n}',
description: 'Writing rules with languageRules and formattingFundamentals (string arrays)',
typeOptions: { rows: 5 },
},
{
displayName: 'Audience Considerations (JSON)',
name: 'audienceConsiderations',
type: 'json',
required: true,
default: '{\n "qualitiesAndCharacteristics": [],\n "aspirationsAndBoundaries": []\n}',
description: 'Audience qualitiesAndCharacteristics and aspirationsAndBoundaries (string arrays)',
typeOptions: { rows: 5 },
},
];
const displayOptions = {
show: {
resource: ['brandVoice'],
operation: ['create'],
},
};
exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties);
async function execute(itemIndex) {
const body = {
title: this.getNodeParameter('title', itemIndex),
description: this.getNodeParameter('description', itemIndex),
personality: utils_1.parseJsonParameter.call(this, 'personality', itemIndex, '{}'),
tonality: utils_1.parseJsonParameter.call(this, 'tonality', itemIndex, '{}'),
vocabulary: utils_1.parseJsonParameter.call(this, 'vocabulary', itemIndex, '{}'),
writingRules: utils_1.parseJsonParameter.call(this, 'writingRules', itemIndex, '{}'),
audienceConsiderations: utils_1.parseJsonParameter.call(this, 'audienceConsiderations', itemIndex, '{}'),
};
const essence = this.getNodeParameter('essence', itemIndex);
if (essence)
body.essence = essence;
if (!body.title || !body.description) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Title and Description are required.', { itemIndex });
}
const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/brand-voice/create', body);
return [this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } })];
}
//# sourceMappingURL=create.operation.js.map