Skip to content

Commit

Permalink
fix(HubSpot Node): Fix issue with contact lists not working (#5582)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joffcom authored Sep 12, 2023
1 parent 915cfa0 commit 6e5a4f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
11 changes: 6 additions & 5 deletions packages/nodes-base/credentials/HubspotOAuth2Api.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import type { ICredentialType, INodeProperties } from 'n8n-workflow';

const scopes = [
'crm.schemas.deals.read',
'crm.objects.owners.read',
'crm.lists.write',
'crm.objects.contacts.read',
'crm.objects.contacts.write',
'crm.objects.companies.write',
'crm.objects.companies.read',
'crm.objects.companies.write',
'crm.objects.deals.read',
'crm.schemas.contacts.read',
'crm.objects.deals.write',
'crm.objects.contacts.read',
'crm.objects.owners.read',
'crm.schemas.companies.read',
'crm.schemas.contacts.read',
'crm.schemas.deals.read',
'forms',
'tickets',
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const contactListFields: INodeProperties[] = [
default: '',
},
{
displayName: 'List to Add From',
displayName: 'List to Add To',
name: 'listId',
type: 'number',
required: true,
Expand Down
7 changes: 5 additions & 2 deletions packages/nodes-base/nodes/Hubspot/V2/HubspotV2.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,6 @@ export class HubspotV2 implements INodeType {
`/contacts/v1/lists/${listId}/add`,
body,
);
returnData.push.apply(returnData, responseData as INodeExecutionData[]);
}
//https://legacydocs.hubspot.com/docs/methods/lists/remove_contact_from_list
if (operation === 'remove') {
Expand All @@ -1168,8 +1167,12 @@ export class HubspotV2 implements INodeType {
`/contacts/v1/lists/${listId}/remove`,
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) {
if (this.continueOnFail()) {
returnData.push({ json: { error: (error as JsonObject).message } });
Expand Down

0 comments on commit 6e5a4f6

Please sign in to comment.