Skip to content

Commit

Permalink
fix(Calendly Trigger Node): Fix issue with webhook url matching (#10378)
Browse files Browse the repository at this point in the history
  • Loading branch information
thewizarodofoz authored Aug 21, 2024
1 parent 4a6ca63 commit 09c3a8b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/nodes-base/nodes/Calendly/CalendlyTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class CalendlyTrigger implements INodeType {
async checkExists(this: IHookFunctions): Promise<boolean> {
const webhookUrl = this.getNodeWebhookUrl('default');
const webhookData = this.getWorkflowStaticData('node');
const events = this.getNodeParameter('events') as string;
const events = this.getNodeParameter('events') as string[];

const authenticationType = await getAuthenticationType.call(this);

Expand Down Expand Up @@ -160,16 +160,14 @@ export class CalendlyTrigger implements INodeType {
const { collection } = await calendlyApiRequest.call(this, 'GET', endpoint, {}, qs);

for (const webhook of collection) {
if (webhook.callback_url === webhookUrl) {
for (const event of events) {
if (!webhook.events.includes(event)) {
return false;
}
}
if (
webhook.callback_url === webhookUrl &&
events.length === webhook.events.length &&
events.every((event: string) => webhook.events.includes(event))
) {
webhookData.webhookURI = webhook.uri;
return true;
}

webhookData.webhookURI = webhook.uri;
return true;
}
}

Expand All @@ -178,7 +176,7 @@ export class CalendlyTrigger implements INodeType {
async create(this: IHookFunctions): Promise<boolean> {
const webhookData = this.getWorkflowStaticData('node');
const webhookUrl = this.getNodeWebhookUrl('default');
const events = this.getNodeParameter('events') as string;
const events = this.getNodeParameter('events') as string[];

const authenticationType = await getAuthenticationType.call(this);

Expand Down

0 comments on commit 09c3a8b

Please sign in to comment.