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 • 3.47 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: 'Buying Trigger OId',
name: 'oId',
type: 'string',
required: true,
default: '',
description: 'OId of the buying trigger to update',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the buying trigger (optional)',
},
{
displayName: 'Internal Name',
name: 'internalName',
type: 'string',
default: '',
description: 'Internal name (optional)',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description (optional)',
typeOptions: { rows: 3 },
},
{
displayName: 'Why This Creates Urgency (JSON Array)',
name: 'whyThisCreatesUrgency',
type: 'json',
default: '[]',
typeOptions: { rows: 3 },
},
{
displayName: 'Who Feels This Most (JSON Array)',
name: 'whoFeelsThisMost',
type: 'json',
default: '[]',
typeOptions: { rows: 3 },
},
{
displayName: 'What\'s the Cost of Inaction (JSON Array)',
name: 'whatsTheCostOfInaction',
type: 'json',
default: '[]',
typeOptions: { rows: 3 },
},
{
displayName: 'How We Help in This Moment (JSON Array)',
name: 'howWeHelpInThisMoment',
type: 'json',
default: '[]',
typeOptions: { rows: 3 },
},
{
displayName: 'Custom Fields (JSON Array)',
name: 'customFields',
type: 'json',
default: '[]',
typeOptions: { rows: 3 },
},
];
const displayOptions = {
show: {
resource: ['buyingTrigger'],
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(), 'OId is required.', { itemIndex });
}
const name = this.getNodeParameter('name', itemIndex);
if (name)
body.name = name;
const internalName = this.getNodeParameter('internalName', itemIndex);
if (internalName)
body.internalName = internalName;
const description = this.getNodeParameter('description', itemIndex);
if (description)
body.description = description;
const arrFields = ['whyThisCreatesUrgency', 'whoFeelsThisMost', 'whatsTheCostOfInaction', 'howWeHelpInThisMoment', 'customFields'];
for (const f of arrFields) {
const v = utils_1.parseJsonParameter.call(this, f, itemIndex, '[]');
if (Array.isArray(v) && v.length > 0)
body[f] = v;
}
const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/buying-trigger/update', body);
return [this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } })];
}
//# sourceMappingURL=update.operation.js.map