mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(HubSpot Node): Fix issue with contact lists not working (#5582)
This commit is contained in:
parent
915cfa0f6a
commit
6e5a4f6a58
|
@ -1,16 +1,17 @@
|
||||||
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
const scopes = [
|
const scopes = [
|
||||||
'crm.schemas.deals.read',
|
'crm.lists.write',
|
||||||
'crm.objects.owners.read',
|
|
||||||
'crm.objects.contacts.write',
|
|
||||||
'crm.objects.companies.write',
|
|
||||||
'crm.objects.companies.read',
|
|
||||||
'crm.objects.deals.read',
|
|
||||||
'crm.schemas.contacts.read',
|
|
||||||
'crm.objects.deals.write',
|
|
||||||
'crm.objects.contacts.read',
|
'crm.objects.contacts.read',
|
||||||
|
'crm.objects.contacts.write',
|
||||||
|
'crm.objects.companies.read',
|
||||||
|
'crm.objects.companies.write',
|
||||||
|
'crm.objects.deals.read',
|
||||||
|
'crm.objects.deals.write',
|
||||||
|
'crm.objects.owners.read',
|
||||||
'crm.schemas.companies.read',
|
'crm.schemas.companies.read',
|
||||||
|
'crm.schemas.contacts.read',
|
||||||
|
'crm.schemas.deals.read',
|
||||||
'forms',
|
'forms',
|
||||||
'tickets',
|
'tickets',
|
||||||
];
|
];
|
||||||
|
|
|
@ -86,7 +86,7 @@ export const contactListFields: INodeProperties[] = [
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'List to Add From',
|
displayName: 'List to Add To',
|
||||||
name: 'listId',
|
name: 'listId',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
|
|
|
@ -1152,7 +1152,6 @@ export class HubspotV2 implements INodeType {
|
||||||
`/contacts/v1/lists/${listId}/add`,
|
`/contacts/v1/lists/${listId}/add`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
returnData.push.apply(returnData, responseData as INodeExecutionData[]);
|
|
||||||
}
|
}
|
||||||
//https://legacydocs.hubspot.com/docs/methods/lists/remove_contact_from_list
|
//https://legacydocs.hubspot.com/docs/methods/lists/remove_contact_from_list
|
||||||
if (operation === 'remove') {
|
if (operation === 'remove') {
|
||||||
|
@ -1168,8 +1167,12 @@ export class HubspotV2 implements INodeType {
|
||||||
`/contacts/v1/lists/${listId}/remove`,
|
`/contacts/v1/lists/${listId}/remove`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
returnData.push.apply(returnData, responseData as INodeExecutionData[]);
|
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData: { item: 0 } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ json: { error: (error as JsonObject).message } });
|
returnData.push({ json: { error: (error as JsonObject).message } });
|
||||||
|
|
Loading…
Reference in a new issue