From 5993e6181b15b794e20c500354d63a59fab3902c Mon Sep 17 00:00:00 2001 From: dimitris-am Date: Mon, 27 Oct 2025 12:55:57 +0200 Subject: [PATCH 1/2] Extract secret key to credentials --- .claude/settings.local.json | 10 +++++++++ credentials/WpformsApi.credentials.ts | 29 +++++++++++++++++++++++++++ nodes/WPForms/WpformsTrigger.node.ts | 23 +++++++++------------ package.json | 4 +++- 4 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 .claude/settings.local.json create mode 100644 credentials/WpformsApi.credentials.ts diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..3b29cfe --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,10 @@ +{ + "permissions": { + "allow": [ + "Bash(npm run build:*)", + "Bash(npm run lint)" + ], + "deny": [], + "ask": [] + } +} diff --git a/credentials/WpformsApi.credentials.ts b/credentials/WpformsApi.credentials.ts new file mode 100644 index 0000000..6bd9443 --- /dev/null +++ b/credentials/WpformsApi.credentials.ts @@ -0,0 +1,29 @@ +import type { + ICredentialType, + INodeProperties, +} from 'n8n-workflow'; + +/** + * WPForms API credentials. + * + * @since 1.0 + */ +export class WpformsApi implements ICredentialType { + name = 'wpformsApi'; + displayName = 'WPForms API'; + documentationUrl = 'https://wpforms.com/docs/n8n-addon/?utm_source=n8n&utm_medium=referral&utm_campaign=n8n_integration&utm_content=wpforms_trigger_docs&utm_locale=en_US'; + properties: INodeProperties[] = [ + { + displayName: 'Secret Key', + name: 'secretKey', + type: 'string', + typeOptions: { + password: true, + }, + default: '', + required: true, + description: 'The secret key used to verify webhook requests', + hint: 'Copy the value from your WPForms n8n settings. Read more', + }, + ]; +} diff --git a/nodes/WPForms/WpformsTrigger.node.ts b/nodes/WPForms/WpformsTrigger.node.ts index 774082c..3aa7128 100644 --- a/nodes/WPForms/WpformsTrigger.node.ts +++ b/nodes/WPForms/WpformsTrigger.node.ts @@ -26,6 +26,12 @@ export class WpformsTrigger implements INodeType { }, inputs: [], // Trigger nodes have no inputs. outputs: [NodeConnectionType.Main], + credentials: [ + { + name: 'wpformsApi', + required: true, + }, + ], webhooks: [ { name: 'default', @@ -36,18 +42,6 @@ export class WpformsTrigger implements INodeType { }, ], properties: [ - { - displayName: 'Secret Key', - name: 'scrKey', - type: 'string', - typeOptions: { - password: true, - }, - default: '', - required: true, - description: 'The secret key used to verify the request', - hint: 'Copy the value from your WPForms n8n settings. Read more', - }, { displayName: 'Output Schema', name: 'outputSchema', @@ -88,8 +82,11 @@ export class WpformsTrigger implements INodeType { // Access the raw HTTP request from n8n's webhook context. const request = this.getRequestObject(); + // Get credentials + const credentials = await this.getCredentials('wpformsApi'); + const secretKey = credentials.secretKey as string; + // Node parameters configured by the user in the UI - const secretKey = this.getNodeParameter('scrKey') as string; const timestampSkew = this.getNodeParameter('timestampSkew') as number; const outputSchema = this.getNodeParameter('outputSchema') as string; diff --git a/package.json b/package.json index 7f2dcd4..a17cd28 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ ], "n8n": { "n8nNodesApiVersion": 1, - "credentials": [], + "credentials": [ + "dist/credentials/WpformsApi.credentials.js" + ], "nodes": [ "dist/nodes/WPForms/WpformsTrigger.node.js" ] From 8f35579823c0864a2cc79ac0d3d3be8937b471e9 Mon Sep 17 00:00:00 2001 From: dimitris-am <88329503+dimitris-am@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:35:31 +0200 Subject: [PATCH 2/2] Delete .claude/settings.local.json --- .claude/settings.local.json | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .claude/settings.local.json diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index 3b29cfe..0000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(npm run build:*)", - "Bash(npm run lint)" - ], - "deny": [], - "ask": [] - } -}