mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
⚡ Minor JotForm improvements
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
|||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
INodeType,
|
INodeType,
|
||||||
IWebhookResponseData,
|
IWebhookResponseData,
|
||||||
IBinaryData,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -89,12 +88,19 @@ export class JotFormTrigger implements INodeType {
|
|||||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||||
const webhookData = this.getWorkflowStaticData('node');
|
const webhookData = this.getWorkflowStaticData('node');
|
||||||
const formId = this.getNodeParameter('form') as string;
|
const formId = this.getNodeParameter('form') as string;
|
||||||
if (webhookData.webhookId === undefined) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const endpoint = `/form/${formId}/webhooks`;
|
const endpoint = `/form/${formId}/webhooks`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await jotformApiRequest.call(this, 'GET', endpoint);
|
const responseData = await jotformApiRequest.call(this, 'GET', endpoint);
|
||||||
|
|
||||||
|
const webhookUrls = Object.values(responseData.content);
|
||||||
|
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||||
|
if (!webhookUrls.includes(webhookUrl)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const webhookIds = Object.keys(responseData.content);
|
||||||
|
webhookData.webhookId = webhookIds[webhookUrls.indexOf(webhookUrl)];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -135,7 +141,6 @@ export class JotFormTrigger implements INodeType {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||||
const req = this.getRequestObject();
|
const req = this.getRequestObject();
|
||||||
const headers = this.getHeaderData();
|
|
||||||
return {
|
return {
|
||||||
workflowData: [
|
workflowData: [
|
||||||
this.helpers.returnJsonArray(req.body)
|
this.helpers.returnJsonArray(req.body)
|
||||||
|
|||||||
Reference in New Issue
Block a user