n8n-nodes-formbase 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/dist/nodes/Formbase/FormbaseTrigger.node.js +43 -3
- package/dist/nodes/Formbase/FormbaseTrigger.node.js.map +1 -1
- package/dist/nodes/Formbase/constants.d.ts +15 -0
- package/dist/nodes/Formbase/constants.js +12 -1
- package/dist/nodes/Formbase/constants.js.map +1 -1
- package/dist/package.json +1 -1
- package/examples/formbase-submission.json +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Community node for [n8n](https://n8n.io) that starts workflows when a [formbase]
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Trigger on completed submissions.
|
|
8
|
-
- Trigger on abandoned submissions
|
|
8
|
+
- Trigger on abandoned submissions after a selected 12-hour, 1-day, 3-day, or 1-week idle window.
|
|
9
9
|
- Load forms dynamically from every workspace available to the credential.
|
|
10
10
|
- Register and remove formbase webhook subscriptions with the n8n workflow lifecycle.
|
|
11
11
|
- Verify every webhook with HMAC-SHA256 and reject stale or forged requests.
|
|
@@ -37,7 +37,7 @@ Self-hosted n8n must use configured HTTPS public URL for OAuth callback. Loopbac
|
|
|
37
37
|
## Use trigger
|
|
38
38
|
|
|
39
39
|
1. Add **formbase Trigger** to a workflow.
|
|
40
|
-
2. Select form and event.
|
|
40
|
+
2. Select form and event. For an abandoned-submission event, select how long the response must remain unchanged.
|
|
41
41
|
3. For a test execution, select **Listen for Test Event**, then submit the selected form.
|
|
42
42
|
4. Activate the workflow. n8n registers its production webhook with formbase and removes it when the workflow is deactivated or deleted.
|
|
43
43
|
|
|
@@ -45,9 +45,11 @@ n8n webhook URL must be publicly reachable over HTTPS. For reverse-proxy or tunn
|
|
|
45
45
|
|
|
46
46
|
n8n generates a separate 256-bit signing secret for each registration. Incoming requests must contain a valid `X-formbase-Signature` header with a timestamp no more than five minutes old. Missing, stale, or invalid signatures receive `401 Unauthorized` and do not start the workflow.
|
|
47
47
|
|
|
48
|
+
Abandoned-submission timing is enforced by formbase, not n8n. formbase checks incomplete responses hourly and calls the registered n8n webhook after the selected idle window, so delivery can occur up to about one hour after the threshold.
|
|
49
|
+
|
|
48
50
|
## Example workflow
|
|
49
51
|
|
|
50
|
-
Import [`examples/formbase-submission.json`](examples/formbase-submission.json), connect formbase credential, select form, then activate workflow. Example maps event ID, submission ID, respondent email, and form name into stable output fields.
|
|
52
|
+
Import [`examples/formbase-submission.json`](examples/formbase-submission.json), connect formbase credential, select form, then activate workflow. Example maps event ID, event type, submission ID, respondent email, and form name into stable output fields.
|
|
51
53
|
|
|
52
54
|
## Output
|
|
53
55
|
|
|
@@ -83,7 +85,15 @@ Each webhook produces one n8n item containing formbase payload:
|
|
|
83
85
|
}
|
|
84
86
|
```
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
Delivered payloads use these `eventType` values:
|
|
89
|
+
|
|
90
|
+
| `eventType` | Meaning |
|
|
91
|
+
| ------------------ | ---------------------------------------------------------- |
|
|
92
|
+
| `SUBMIT_RESPONSE` | A respondent completed a new response. |
|
|
93
|
+
| `UPDATE_RESPONSE` | An existing completed response changed. |
|
|
94
|
+
| `ABANDON_RESPONSE` | An incomplete response reached the configured idle window. |
|
|
95
|
+
|
|
96
|
+
Webhook registration events (`submission_created` and `submission_abandoned`) select which deliveries trigger the workflow. Payload `eventType` identifies what happened to the response. Use `eventId` to deduplicate retries.
|
|
87
97
|
|
|
88
98
|
Full contracts: [formbase API methods](https://docs.formbase.so/developers/rest-api) and [webhook reference](https://docs.formbase.so/developers/webhooks-reference).
|
|
89
99
|
|
|
@@ -25,8 +25,25 @@ async function listWorkspaceForms(context, workspace) {
|
|
|
25
25
|
} while (cursor);
|
|
26
26
|
return forms;
|
|
27
27
|
}
|
|
28
|
-
function findWebhookSubscription(subscriptions, targetUrl, eventType) {
|
|
29
|
-
return subscriptions.find((subscription) => subscription.targetUrl === targetUrl &&
|
|
28
|
+
function findWebhookSubscription(subscriptions, targetUrl, eventType, idleWindow) {
|
|
29
|
+
return subscriptions.find((subscription) => subscription.targetUrl === targetUrl &&
|
|
30
|
+
subscription.provider === 'n8n' &&
|
|
31
|
+
subscription.eventType === eventType &&
|
|
32
|
+
subscription.idleWindow === idleWindow);
|
|
33
|
+
}
|
|
34
|
+
function findWebhookSubscriptionsByIdentity(subscriptions, targetUrl, eventType) {
|
|
35
|
+
return subscriptions.filter((subscription) => subscription.targetUrl === targetUrl && subscription.provider === 'n8n' && subscription.eventType === eventType);
|
|
36
|
+
}
|
|
37
|
+
function getIdleWindow(context, eventType) {
|
|
38
|
+
if (eventType === constants_1.FORMBASE_WEBHOOK_EVENTS.submissionCreated)
|
|
39
|
+
return undefined;
|
|
40
|
+
const idleWindow = context.getNodeParameter('idleWindow');
|
|
41
|
+
if (!(0, constants_1.isFormbaseIdleWindow)(idleWindow)) {
|
|
42
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), {
|
|
43
|
+
message: `Idle window must be one of: ${constants_1.FORMBASE_IDLE_WINDOW_OPTIONS.map((option) => option.value).join(', ')}`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return idleWindow;
|
|
30
47
|
}
|
|
31
48
|
function clearWebhookRegistration(webhookData) {
|
|
32
49
|
delete webhookData.subscriptionId;
|
|
@@ -102,6 +119,20 @@ class FormbaseTrigger {
|
|
|
102
119
|
default: 'submission_created',
|
|
103
120
|
description: 'Event to subscribe to. Abandoned submissions require partial submission tracking.',
|
|
104
121
|
},
|
|
122
|
+
{
|
|
123
|
+
displayName: 'Consider Abandoned After',
|
|
124
|
+
name: 'idleWindow',
|
|
125
|
+
type: 'options',
|
|
126
|
+
displayOptions: {
|
|
127
|
+
show: {
|
|
128
|
+
event: [constants_1.FORMBASE_WEBHOOK_EVENTS.submissionAbandoned],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
options: [...constants_1.FORMBASE_IDLE_WINDOW_OPTIONS],
|
|
132
|
+
default: '12h',
|
|
133
|
+
required: true,
|
|
134
|
+
description: 'Runs after the response has no saved changes for this long. The hourly sweep can add up to about one hour.',
|
|
135
|
+
},
|
|
105
136
|
],
|
|
106
137
|
};
|
|
107
138
|
this.methods = {
|
|
@@ -130,11 +161,18 @@ class FormbaseTrigger {
|
|
|
130
161
|
if (!formId)
|
|
131
162
|
return false;
|
|
132
163
|
const eventType = this.getNodeParameter('event');
|
|
164
|
+
const idleWindow = getIdleWindow(this, eventType);
|
|
133
165
|
const webhookData = this.getWorkflowStaticData('node');
|
|
134
166
|
const result = (await GenericFunctions_1.formbaseApiRequest.call(this, 'webhooks.list', {
|
|
135
167
|
formId,
|
|
136
168
|
}));
|
|
137
|
-
const match = findWebhookSubscription(result.items, webhookUrl, eventType);
|
|
169
|
+
const match = findWebhookSubscription(result.items, webhookUrl, eventType, idleWindow);
|
|
170
|
+
const staleMatches = findWebhookSubscriptionsByIdentity(result.items, webhookUrl, eventType).filter((subscription) => subscription.subscriptionId !== (match === null || match === void 0 ? void 0 : match.subscriptionId));
|
|
171
|
+
for (const staleMatch of staleMatches) {
|
|
172
|
+
await GenericFunctions_1.formbaseApiRequest.call(this, 'webhooks.delete', {
|
|
173
|
+
subscriptionId: staleMatch.subscriptionId,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
138
176
|
if (!match) {
|
|
139
177
|
clearWebhookRegistration(webhookData);
|
|
140
178
|
return false;
|
|
@@ -154,12 +192,14 @@ class FormbaseTrigger {
|
|
|
154
192
|
return false;
|
|
155
193
|
const formId = this.getNodeParameter('formId');
|
|
156
194
|
const eventType = this.getNodeParameter('event');
|
|
195
|
+
const idleWindow = getIdleWindow(this, eventType);
|
|
157
196
|
const webhookSecret = (0, FormbaseWebhookSignature_1.createFormbaseWebhookSecret)();
|
|
158
197
|
const created = (await GenericFunctions_1.formbaseApiRequest.call(this, 'webhooks.create', {
|
|
159
198
|
formId,
|
|
160
199
|
targetUrl: webhookUrl,
|
|
161
200
|
provider: 'n8n',
|
|
162
201
|
eventType,
|
|
202
|
+
...(idleWindow !== undefined ? { idleWindow } : {}),
|
|
163
203
|
signingSecret: webhookSecret,
|
|
164
204
|
}));
|
|
165
205
|
const webhookData = this.getWorkflowStaticData('node');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormbaseTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Formbase/FormbaseTrigger.node.ts"],"names":[],"mappings":";;;AAUA,+CAAgE;AAEhE,
|
|
1
|
+
{"version":3,"file":"FormbaseTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Formbase/FormbaseTrigger.node.ts"],"names":[],"mappings":";;;AAUA,+CAAgE;AAEhE,2CAOoB;AACpB,yEAAwG;AACxG,yDAAuD;AA+BvD,MAAM,eAAe,GAAG,GAAG,CAAA;AAE3B,KAAK,UAAU,kBAAkB,CAAC,OAA8B,EAAE,SAA2B;IAC3F,MAAM,KAAK,GAAkB,EAAE,CAAA;IAC/B,IAAI,MAA0B,CAAA;IAE9B,GAAG,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,MAAM,qCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE;YACnE,WAAW,EAAE,SAAS,CAAC,EAAE;YACzB,KAAK,EAAE,eAAe;YACtB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9B,CAAC,CAA8B,CAAA;QAEhC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAK;QAC1B,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,IAAI,2BAAY,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,4CAA4C,EAAE,CAAC,CAAA;QACtG,CAAC;QACD,MAAM,GAAG,MAAM,CA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E,CAAA;YAC/D,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAA;QACpC,CAAC;QAED,MAAM,IAAI,GAAgB,IAAI,CAAC,WAAW,EAAE,CAAA;QAC5C,OAAO;YACL,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACnD,CAAA;IACH,CAAC;CACF;AApND,0CAoNC"}
|
|
@@ -7,3 +7,18 @@ export declare const FORMBASE_WEBHOOK_EVENTS: {
|
|
|
7
7
|
readonly submissionAbandoned: "submission_abandoned";
|
|
8
8
|
};
|
|
9
9
|
export type FormbaseWebhookEvent = (typeof FORMBASE_WEBHOOK_EVENTS)[keyof typeof FORMBASE_WEBHOOK_EVENTS];
|
|
10
|
+
export declare const FORMBASE_IDLE_WINDOW_OPTIONS: readonly [{
|
|
11
|
+
readonly name: "1 Day";
|
|
12
|
+
readonly value: "1d";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "1 Week";
|
|
15
|
+
readonly value: "1w";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "12 Hours";
|
|
18
|
+
readonly value: "12h";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "3 Days";
|
|
21
|
+
readonly value: "3d";
|
|
22
|
+
}];
|
|
23
|
+
export type FormbaseIdleWindow = (typeof FORMBASE_IDLE_WINDOW_OPTIONS)[number]['value'];
|
|
24
|
+
export declare function isFormbaseIdleWindow(value: unknown): value is FormbaseIdleWindow;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FORMBASE_WEBHOOK_EVENTS = exports.FORMBASE_OAUTH2_CREDENTIAL_NAME = exports.FORMBASE_API_RESOURCE_URL = exports.FORMBASE_API_PATH = exports.DEFAULT_FORMBASE_API_URL = void 0;
|
|
3
|
+
exports.FORMBASE_IDLE_WINDOW_OPTIONS = exports.FORMBASE_WEBHOOK_EVENTS = exports.FORMBASE_OAUTH2_CREDENTIAL_NAME = exports.FORMBASE_API_RESOURCE_URL = exports.FORMBASE_API_PATH = exports.DEFAULT_FORMBASE_API_URL = void 0;
|
|
4
|
+
exports.isFormbaseIdleWindow = isFormbaseIdleWindow;
|
|
4
5
|
exports.DEFAULT_FORMBASE_API_URL = 'https://api.formbase.so';
|
|
5
6
|
exports.FORMBASE_API_PATH = '/api/v1';
|
|
6
7
|
exports.FORMBASE_API_RESOURCE_URL = `${exports.DEFAULT_FORMBASE_API_URL}${exports.FORMBASE_API_PATH}`;
|
|
@@ -9,4 +10,14 @@ exports.FORMBASE_WEBHOOK_EVENTS = {
|
|
|
9
10
|
submissionCreated: 'submission_created',
|
|
10
11
|
submissionAbandoned: 'submission_abandoned',
|
|
11
12
|
};
|
|
13
|
+
exports.FORMBASE_IDLE_WINDOW_OPTIONS = [
|
|
14
|
+
{ name: '1 Day', value: '1d' },
|
|
15
|
+
{ name: '1 Week', value: '1w' },
|
|
16
|
+
{ name: '12 Hours', value: '12h' },
|
|
17
|
+
{ name: '3 Days', value: '3d' },
|
|
18
|
+
];
|
|
19
|
+
const FORMBASE_IDLE_WINDOW_VALUES = new Set(exports.FORMBASE_IDLE_WINDOW_OPTIONS.map((option) => option.value));
|
|
20
|
+
function isFormbaseIdleWindow(value) {
|
|
21
|
+
return typeof value === 'string' && FORMBASE_IDLE_WINDOW_VALUES.has(value);
|
|
22
|
+
}
|
|
12
23
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../nodes/Formbase/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../nodes/Formbase/constants.ts"],"names":[],"mappings":";;;AA4BA,oDAEC;AA9BY,QAAA,wBAAwB,GAAG,yBAAyB,CAAA;AAEpD,QAAA,iBAAiB,GAAG,SAAS,CAAA;AAE7B,QAAA,yBAAyB,GAAG,GAAG,gCAAwB,GAAG,yBAAiB,EAAE,CAAA;AAE7E,QAAA,+BAA+B,GAAG,mBAAmB,CAAA;AAErD,QAAA,uBAAuB,GAAG;IACrC,iBAAiB,EAAE,oBAAoB;IACvC,mBAAmB,EAAE,sBAAsB;CACnC,CAAA;AAIG,QAAA,4BAA4B,GAAG;IAC1C,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE;IAC9B,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;IAC/B,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE;IAClC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;CACvB,CAAA;AAIV,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAC9D,oCAA4B,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAC3D,CAAA;AAED,SAAgB,oBAAoB,CAAC,KAAc;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,2BAA2B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAC5E,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
"value": "={{ $json.eventId }}",
|
|
23
23
|
"type": "string"
|
|
24
24
|
},
|
|
25
|
+
{
|
|
26
|
+
"id": "9da94c68-fcf8-4f79-b78e-5bb78c043aec",
|
|
27
|
+
"name": "eventType",
|
|
28
|
+
"value": "={{ $json.eventType }}",
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
25
31
|
{
|
|
26
32
|
"id": "b27b42be-fc5d-491f-a93b-02a7fa4e63f8",
|
|
27
33
|
"name": "submissionId",
|