mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
💄 create lead UI done
This commit is contained in:
@@ -9,6 +9,13 @@ import {
|
||||
ILoadOptionsFunctions,
|
||||
INodePropertyOptions,
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
leadOpeations,
|
||||
leadFields,
|
||||
} from './LeadDescription';
|
||||
import {
|
||||
intercomApiRequest,
|
||||
} from './GenericFunctions';
|
||||
|
||||
export class Intercom implements INodeType {
|
||||
|
||||
@@ -47,9 +54,37 @@ export class Intercom implements INodeType {
|
||||
default: '',
|
||||
description: 'Resource to consume.',
|
||||
},
|
||||
...leadOpeations,
|
||||
...leadFields,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the available companies to display them to user so that he can
|
||||
// select them easily
|
||||
async getCompanies(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
let companies, response;
|
||||
try {
|
||||
response = await intercomApiRequest.call(this, '/companies', 'GET');
|
||||
} catch (err) {
|
||||
throw new Error(`Intercom Error: ${err}`);
|
||||
}
|
||||
companies = response.companies;
|
||||
for (const company of companies) {
|
||||
const companyName = company.name;
|
||||
const companyId = company.id;
|
||||
returnData.push({
|
||||
name: companyName,
|
||||
value: companyId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> {
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user