n8n-nodes-formbricks-new 1.0.2 → 1.0.3
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 +17 -13
- package/dist/credentials/FormbricksApi.credentials.js +1 -9
- package/dist/credentials/FormbricksApi.credentials.js.map +1 -1
- package/dist/nodes/Formbricks/Formbricks.node.d.ts +7 -1
- package/dist/nodes/Formbricks/Formbricks.node.js +20 -8
- package/dist/nodes/Formbricks/Formbricks.node.js.map +1 -1
- package/dist/nodes/Formbricks/GenericFunctions.d.ts +3 -2
- package/dist/nodes/Formbricks/GenericFunctions.js +13 -0
- package/dist/nodes/Formbricks/GenericFunctions.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ For an unpublished local build, create a tarball from this repository and instal
|
|
|
41
41
|
npm run build
|
|
42
42
|
npm pack
|
|
43
43
|
cd ~/.n8n/nodes
|
|
44
|
-
npm install /path/to/n8n-nodes-formbricks-new-1.0.
|
|
44
|
+
npm install /path/to/n8n-nodes-formbricks-new-1.0.3.tgz
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
Restart n8n after installing the local tarball.
|
|
@@ -51,29 +51,33 @@ Restart n8n after installing the local tarball.
|
|
|
51
51
|
Create Formbricks API credentials in n8n with:
|
|
52
52
|
|
|
53
53
|
- **Host**: your Formbricks base URL, for example `https://form.example.com`
|
|
54
|
-
- **API Key**: your Formbricks API key
|
|
55
|
-
- **Workspace ID**: the workspace ID returned by Formbricks
|
|
54
|
+
- **API Key**: your Formbricks organization API key
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
The credential test calls:
|
|
58
57
|
|
|
59
|
-
```
|
|
60
|
-
|
|
58
|
+
```text
|
|
59
|
+
GET /api/v2/me
|
|
61
60
|
```
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
## Workspace Selection
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
Workspace is selected in the **Formbricks** trigger node, not in the credential.
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
The node loads available workspaces from the current Formbricks API v2:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
curl -H "x-api-key: <API_KEY>" https://form.example.com/api/v2/me
|
|
69
70
|
```
|
|
70
71
|
|
|
72
|
+
It uses the returned `workspaces[]` array. The option label is based on `projectName`, and the option value is `workspaceId`.
|
|
73
|
+
|
|
71
74
|
## Usage
|
|
72
75
|
|
|
73
76
|
1. Add the **Formbricks** trigger node to an n8n workflow.
|
|
74
|
-
2. Select
|
|
75
|
-
3.
|
|
76
|
-
4.
|
|
77
|
+
2. Select the workspace that should receive the webhook.
|
|
78
|
+
3. Select one or more events, for example **Response Finished**.
|
|
79
|
+
4. Optionally enter comma-separated Survey IDs. Leave the field empty to trigger for all surveys in the workspace.
|
|
80
|
+
5. Save and activate the workflow.
|
|
77
81
|
|
|
78
82
|
When the workflow is activated, n8n creates a production webhook URL and the node registers it in Formbricks with:
|
|
79
83
|
|
|
@@ -16,19 +16,11 @@ class FormbricksApi {
|
|
|
16
16
|
{
|
|
17
17
|
displayName: "API Key",
|
|
18
18
|
name: "apiKey",
|
|
19
|
-
description: 'Your Formbricks API-Key. You can create a new API-Key in the
|
|
19
|
+
description: 'Your Formbricks organization API-Key. You can create a new API-Key in the Organization Settings. Please read our <a href="https://formbricks.com/docs/api/api-key-setup">API Key Docs</a> for more details.',
|
|
20
20
|
type: "string",
|
|
21
21
|
typeOptions: { password: true },
|
|
22
22
|
default: "",
|
|
23
23
|
},
|
|
24
|
-
{
|
|
25
|
-
displayName: "Workspace ID",
|
|
26
|
-
name: "workspaceId",
|
|
27
|
-
type: "string",
|
|
28
|
-
default: "",
|
|
29
|
-
required: true,
|
|
30
|
-
description: "可通过 GET /api/v2/me 的 workspaces[].workspaceId 获取。",
|
|
31
|
-
},
|
|
32
24
|
];
|
|
33
25
|
this.authenticate = {
|
|
34
26
|
type: "generic",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormbricksApi.credentials.js","sourceRoot":"","sources":["../../credentials/FormbricksApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAA1B;QACE,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,MAAM;gBACnB,IAAI,EAAE,MAAM;gBACZ,WAAW,EACT,kMAAkM;gBACpM,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,4BAA4B;aACtC;YACD;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"FormbricksApi.credentials.js","sourceRoot":"","sources":["../../credentials/FormbricksApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAA1B;QACE,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,MAAM;gBACnB,IAAI,EAAE,MAAM;gBACZ,WAAW,EACT,kMAAkM;gBACpM,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,4BAA4B;aACtC;YACD;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,6MAA6M;gBAC/M,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACZ;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,WAAW,EAAE,0BAA0B;iBACxC;aACF;SACF,CAAC;QACF,SAAI,GAAuC;YACzC,OAAO,EAAE;gBACP,OAAO,EAAE,+BAA+B;gBACxC,GAAG,EAAE,MAAM;aACZ;SACF,CAAC;IACJ,CAAC;CAAA;AArCD,sCAqCC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData
|
|
1
|
+
import { IHookFunctions, INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData } from "n8n-workflow";
|
|
2
|
+
import { getWorkspaces } from "./GenericFunctions";
|
|
2
3
|
export declare class Formbricks implements INodeType {
|
|
3
4
|
description: INodeTypeDescription;
|
|
5
|
+
methods: {
|
|
6
|
+
loadOptions: {
|
|
7
|
+
getWorkspaces: typeof getWorkspaces;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
4
10
|
webhookMethods: {
|
|
5
11
|
default: {
|
|
6
12
|
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
@@ -42,6 +42,17 @@ class Formbricks {
|
|
|
42
42
|
},
|
|
43
43
|
],
|
|
44
44
|
properties: [
|
|
45
|
+
{
|
|
46
|
+
displayName: "Workspace Name or ID",
|
|
47
|
+
name: "workspaceId",
|
|
48
|
+
description: 'Workspace where the webhook should be registered. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
49
|
+
type: "options",
|
|
50
|
+
typeOptions: {
|
|
51
|
+
loadOptionsMethod: "getWorkspaces",
|
|
52
|
+
},
|
|
53
|
+
default: "",
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
45
56
|
{
|
|
46
57
|
displayName: "Events",
|
|
47
58
|
name: "events",
|
|
@@ -75,17 +86,20 @@ class Formbricks {
|
|
|
75
86
|
},
|
|
76
87
|
],
|
|
77
88
|
};
|
|
89
|
+
this.methods = {
|
|
90
|
+
loadOptions: {
|
|
91
|
+
getWorkspaces: GenericFunctions_1.getWorkspaces,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
78
94
|
this.webhookMethods = {
|
|
79
95
|
default: {
|
|
80
96
|
async checkExists() {
|
|
81
|
-
var _a;
|
|
82
97
|
const webhookData = this.getWorkflowStaticData("node");
|
|
83
98
|
const webhookUrl = this.getNodeWebhookUrl("default");
|
|
99
|
+
const workspaceId = this.getNodeParameter("workspaceId").trim();
|
|
84
100
|
const surveyIds = parseSurveyIds(this.getNodeParameter("surveyIds"));
|
|
85
|
-
const credentials = await this.getCredentials("formbricksApi");
|
|
86
|
-
const workspaceId = (_a = credentials.workspaceId) === null || _a === void 0 ? void 0 : _a.trim();
|
|
87
101
|
if (!workspaceId) {
|
|
88
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "
|
|
102
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Select a Formbricks workspace before activating this trigger.");
|
|
89
103
|
}
|
|
90
104
|
const endpoint = "/management/webhooks";
|
|
91
105
|
const response = await GenericFunctions_1.apiRequest.call(this, "GET", endpoint, {}, { limit: 250 });
|
|
@@ -103,18 +117,16 @@ class Formbricks {
|
|
|
103
117
|
return false;
|
|
104
118
|
},
|
|
105
119
|
async create() {
|
|
106
|
-
var _a;
|
|
107
120
|
const webhookData = this.getWorkflowStaticData("node");
|
|
108
121
|
const webhookUrl = this.getNodeWebhookUrl("default");
|
|
122
|
+
const workspaceId = this.getNodeParameter("workspaceId").trim();
|
|
109
123
|
const surveyIds = parseSurveyIds(this.getNodeParameter("surveyIds"));
|
|
110
124
|
const events = this.getNodeParameter("events");
|
|
111
|
-
const credentials = await this.getCredentials("formbricksApi");
|
|
112
|
-
const workspaceId = (_a = credentials.workspaceId) === null || _a === void 0 ? void 0 : _a.trim();
|
|
113
125
|
if (!Array.isArray(events) || events.length === 0) {
|
|
114
126
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Select at least one Formbricks event before activating this trigger.");
|
|
115
127
|
}
|
|
116
128
|
if (!workspaceId) {
|
|
117
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "
|
|
129
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Select a Formbricks workspace before activating this trigger.");
|
|
118
130
|
}
|
|
119
131
|
const body = {
|
|
120
132
|
name: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Formbricks.node.js","sourceRoot":"","sources":["../../../nodes/Formbricks/Formbricks.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,
|
|
1
|
+
{"version":3,"file":"Formbricks.node.js","sourceRoot":"","sources":["../../../nodes/Formbricks/Formbricks.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,yDAA+D;AAE/D,SAAS,cAAc,CAAC,SAA4B;IAClD,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,SAAS;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,MAAa,UAAU;IAAvB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,YAAY;YACzB,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,uCAAuC;YACjD,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE;gBACR,IAAI,EAAE,YAAY;aACnB;YAED,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,eAAe;oBACrB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;oBAC1B,IAAI,EAAE,SAAS;iBAChB;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,sBAAsB;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IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;oBAGpD,OAAO,WAAW,CAAC,SAAS,CAAC;oBAC7B,OAAO,IAAI,CAAC;gBACd,CAAC;aACF;SACF,CAAC;IASJ,CAAC;IAPC,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAEpC,OAAO;YACL,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;SACvD,CAAC;IACJ,CAAC;CACF;AAjLD,gCAiLC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods } from "n8n-workflow";
|
|
2
|
-
export declare function apiRequest(this: IHookFunctions | IExecuteFunctions, method: IHttpRequestMethods, resource: string, body: object, query?: IDataObject, option?: IDataObject): Promise<any>;
|
|
1
|
+
import { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions, INodePropertyOptions } from "n8n-workflow";
|
|
2
|
+
export declare function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, resource: string, body: object, query?: IDataObject, option?: IDataObject): Promise<any>;
|
|
3
|
+
export declare function getWorkspaces(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.apiRequest = apiRequest;
|
|
4
|
+
exports.getWorkspaces = getWorkspaces;
|
|
4
5
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
6
|
async function apiRequest(method, resource, body, query = {}, option = {}) {
|
|
6
7
|
const credentials = await this.getCredentials("formbricksApi");
|
|
@@ -25,4 +26,16 @@ async function apiRequest(method, resource, body, query = {}, option = {}) {
|
|
|
25
26
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
29
|
+
async function getWorkspaces() {
|
|
30
|
+
var _a;
|
|
31
|
+
const responseData = await apiRequest.call(this, "GET", "/me", {});
|
|
32
|
+
const workspaces = responseData.workspaces || ((_a = responseData.data) === null || _a === void 0 ? void 0 : _a.workspaces);
|
|
33
|
+
if (!Array.isArray(workspaces)) {
|
|
34
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "No workspaces got returned");
|
|
35
|
+
}
|
|
36
|
+
return workspaces.map((workspace) => ({
|
|
37
|
+
name: workspace.projectName || workspace.workspaceName || workspace.workspaceId,
|
|
38
|
+
value: workspace.workspaceId,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
28
41
|
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Formbricks/GenericFunctions.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Formbricks/GenericFunctions.ts"],"names":[],"mappings":";;AAgBA,gCAmCC;AAKD,sCAYC;AApED,+CAWsB;AAKf,KAAK,UAAU,UAAU,CAE9B,MAA2B,EAC3B,QAAgB,EAChB,IAAY,EACZ,QAAqB,EAAE,EACvB,SAAsB,EAAE;IAExB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IAE/D,IAAI,OAAO,GAAwB;QACjC,OAAO,EAAE,GAAG,WAAW,CAAC,IAAI,SAAS;QACrC,MAAM;QACN,IAAI;QACJ,EAAE,EAAE,KAAK;QACT,GAAG,EAAE,QAAQ;QACb,OAAO,EAAE;YACP,WAAW,EAAE,WAAW,CAAC,MAAM;SAChC;KACF,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAC/B,OAAO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