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.
55 lines • 2.01 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: 'Brand Voice OId',
name: 'oId',
type: 'string',
required: true,
default: '',
description: 'OId of the brand voice to update',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Brand voice name (optional)',
},
{
displayName: 'Data (JSON)',
name: 'data',
type: 'json',
default: '{}',
description: 'Brand voice data object (title, description, essence, personality, tonality, vocabulary, writingRules, audienceConsiderations, customFields)',
typeOptions: { rows: 10 },
},
];
const displayOptions = {
show: {
resource: ['brandVoice'],
operation: ['update'],
},
};
exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties);
async function execute(itemIndex) {
const body = {};
body.oId = this.getNodeParameter('oId', itemIndex);
if (!body.oId) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Brand Voice OId is required.', { itemIndex });
}
const name = this.getNodeParameter('name', itemIndex);
if (name)
body.name = name;
const data = utils_1.parseJsonParameter.call(this, 'data', itemIndex, '{}');
if (data && Object.keys(data).length > 0)
body.data = data;
const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/brand-voice/update', body);
return [this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } })];
}
//# sourceMappingURL=update.operation.js.map