fix(HighLevel Node): Encode contact lookup query parameters (#31365)
Some checks are pending
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (22.22.3) (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (24.15.0) (push) Waiting to run
CI: Master (Build, Test, Lint) / Lint (push) Waiting to run
CI: Master (Build, Test, Lint) / Performance (push) Waiting to run
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Blocked by required conditions

Co-authored-by: Dawid Myslak <dawid.myslak@gmail.com>
This commit is contained in:
Raúl Gómez Morales 2026-05-30 10:58:50 +02:00 committed by GitHub
parent c4fc0447c0
commit 8635dcde23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 1 deletions

View File

@ -100,7 +100,7 @@ export const contactOperations: INodeProperties[] = [
routing: {
request: {
method: 'GET',
url: '=/contacts/lookup?email={{$parameter.email}}&phone={{$parameter.phone}}',
url: '/contacts/lookup',
},
output: {
postReceive: [
@ -830,6 +830,12 @@ const lookupProperties: INodeProperties[] = [
},
},
default: '',
routing: {
send: {
type: 'query',
property: 'email',
},
},
},
{
displayName: 'Phone',
@ -844,6 +850,12 @@ const lookupProperties: INodeProperties[] = [
},
},
default: '',
routing: {
send: {
type: 'query',
property: 'phone',
},
},
},
];

View File

@ -0,0 +1,36 @@
import type { INodeProperties, INodePropertyOptions } from 'n8n-workflow';
import { contactFields, contactOperations } from '../description/ContactDescription';
// Reach into the actual routing config so the test breaks if the lookup
// operation stops sending its inputs as discrete query parameters.
const lookupOperation = (contactOperations[0].options as INodePropertyOptions[]).find(
(option) => option.value === 'lookup',
);
const findLookupField = (name: string): INodeProperties => {
const field = contactFields.find(
(candidate) =>
candidate.name === name &&
((candidate.displayOptions?.show?.operation as string[] | undefined) ?? []).includes(
'lookup',
),
);
if (!field) {
throw new Error(`Expected to find lookup field "${name}"`);
}
return field;
};
describe('HighLevel V1 - Contact Lookup query parameters', () => {
it('builds the request from a static path, not by interpolating user input into the URL', () => {
expect(lookupOperation?.routing?.request?.url).toBe('/contacts/lookup');
});
it('sends email and phone as discrete query parameters', () => {
expect(findLookupField('email').routing?.send).toEqual({ type: 'query', property: 'email' });
expect(findLookupField('phone').routing?.send).toEqual({ type: 'query', property: 'phone' });
});
});