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.
105 lines • 4.22 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: 'Agent OId Name or ID',
name: 'agentOId',
type: 'options',
required: true,
typeOptions: {
loadOptionsMethod: 'getAgents',
},
default: '',
description: 'The OId of the agent to run. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'LinkedIn Profile URL',
name: 'linkedInProfile',
type: 'string',
default: '',
description: 'LinkedIn profile URL of the person to build sales call prep materials for',
hint: 'LinkedIn profile is the preferred input method over email for better enrichment results'
},
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
default: '',
description: 'First name of the person to build sales call prep materials for',
},
{
displayName: 'Job Title',
name: 'jobTitle',
type: 'string',
default: '',
description: 'Job title of the person to build sales call prep materials for',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
description: 'Email address of the person to build sales call prep materials for',
},
{
displayName: 'Company Name',
name: 'companyName',
type: 'string',
default: '',
description: 'The name of the company to build call prep materials for',
},
{
displayName: 'Company Domain',
name: 'companyDomain',
type: 'string',
default: '',
description: 'The domain of the company to build call prep materials for',
},
{
displayName: 'Runtime Context',
name: 'runtimeContext',
type: 'string',
default: '',
description: 'Additional context as a string (optional)',
},
];
const displayOptions = {
show: {
resource: ['agent'],
operation: ['callPrep'],
},
};
exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties);
async function execute(itemIndex) {
const body = {};
const agentOId = this.getNodeParameter('agentOId', itemIndex);
if (!agentOId) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Agent OId is required for this operation.', { itemIndex });
}
body.agentOId = agentOId;
const runtimeContext = this.getNodeParameter('runtimeContext', itemIndex, '');
if (runtimeContext && runtimeContext.trim() !== '') {
body.runtimeContext = runtimeContext;
}
body.email = this.getNodeParameter('email', itemIndex);
body.firstName = this.getNodeParameter('firstName', itemIndex);
body.jobTitle = this.getNodeParameter('jobTitle', itemIndex);
body.companyName = this.getNodeParameter('companyName', itemIndex);
body.companyDomain = this.getNodeParameter('companyDomain', itemIndex);
body.linkedInProfile = this.getNodeParameter('linkedInProfile', itemIndex);
Object.keys(body).forEach(key => (body[key] === undefined) && delete body[key]);
const responseDataOuter = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/agents/call-prep/run', body);
const responseWithMetadata = {
data: (responseDataOuter === null || responseDataOuter === void 0 ? void 0 : responseDataOuter.data) !== undefined ? responseDataOuter.data : responseDataOuter,
_metadata: responseDataOuter === null || responseDataOuter === void 0 ? void 0 : responseDataOuter._metadata
};
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseWithMetadata), { itemData: { item: itemIndex } });
return [executionData];
}
//# sourceMappingURL=callPrep.operation.js.map