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.
134 lines • 4.94 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: 'Product OId',
name: 'productOId',
type: 'string',
required: true,
default: '',
description: 'Product OId to associate with this playbook',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
required: true,
default: '',
description: 'Description of the playbook',
},
{
displayName: 'Key Insight',
name: 'keyInsight',
type: 'string',
required: true,
default: '',
description: 'Key insight of the playbook',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the playbook (optional)',
},
{
displayName: 'Type',
name: 'playbookTypeCreate',
type: 'options',
options: [
{ name: 'Account', value: 'ACCOUNT' },
{ name: 'Competitive', value: 'COMPETITIVE' },
{ name: 'Custom', value: 'CUSTOM' },
{ name: 'Milestone', value: 'MILESTONE' },
{ name: 'Practitioner', value: 'PRACTITIONER' },
{ name: 'Sector', value: 'SECTOR' },
{ name: 'Solution', value: 'SOLUTION' },
],
default: 'SOLUTION',
description: 'Type of the playbook (optional)',
},
{
displayName: 'Context',
name: 'context',
type: 'string',
default: '',
description: 'Context of the playbook (optional)',
},
{
displayName: 'Persona OIds (JSON Array)',
name: 'personaOIds',
type: 'json',
default: '[]',
description: 'JSON array of Persona OIds (e.g., ["p_123"]) (optional)',
},
{
displayName: 'Use Case OIds (JSON Array)',
name: 'useCaseOIds',
type: 'json',
default: '[]',
description: 'JSON array of Use Case OIds (e.g., ["uc_123"]) (optional)',
},
{
displayName: 'Create Templates',
name: 'createTemplates',
type: 'boolean',
default: false,
description: 'Whether to create templates for the playbook (optional)',
},
{
displayName: 'Model',
name: 'model',
type: 'options',
options: [
{ name: 'Echo', value: 'ECHO' },
{ name: 'Harmony', value: 'HARMONY' },
{ name: 'Pulse', value: 'PULSE' },
],
default: 'ECHO',
description: 'Model of the playbook (optional)',
},
{
displayName: 'Additional Context Sources (JSON)',
name: 'additionalContextSources',
type: 'json',
default: '[]',
description: 'E.g., [{\"type\":\"URL\",\"value\":\"https://example.com\"}] (optional)',
typeOptions: { rows: 5 }
},
];
const displayOptions = {
show: {
resource: ['playbook'],
operation: ['create'],
},
};
exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties);
async function execute(itemIndex) {
const body = {};
body.productOId = this.getNodeParameter('productOId', itemIndex);
if (!body.productOId) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Product OId is required to create a playbook.', { itemIndex });
}
body.description = this.getNodeParameter('description', itemIndex, '');
body.keyInsight = this.getNodeParameter('keyInsight', itemIndex, '');
body.name = this.getNodeParameter('name', itemIndex);
body.type = this.getNodeParameter('playbookTypeCreate', itemIndex);
body.context = this.getNodeParameter('context', itemIndex);
body.personaOIds = utils_1.parseJsonParameter.call(this, 'personaOIds', itemIndex, '[]');
body.useCaseOIds = utils_1.parseJsonParameter.call(this, 'useCaseOIds', itemIndex, '[]');
body.createTemplates = this.getNodeParameter('createTemplates', itemIndex, false);
body.model = this.getNodeParameter('model', itemIndex);
body.additionalContextSources = utils_1.parseJsonParameter.call(this, 'additionalContextSources', itemIndex, '[]');
Object.keys(body).forEach(key => (body[key] === undefined) && delete body[key]);
const responseDataOuter = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/playbook/create', body);
const responseDataInner = responseDataOuter;
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseDataInner || {}), { itemData: { item: itemIndex } });
return [executionData];
}
//# sourceMappingURL=create.operation.js.map