n8n-nodes-formbricks-new 1.0.2

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/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2022 Formbricks GmbH
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # n8n-nodes-formbricks-new
2
+
3
+ This is an n8n community trigger node for Formbricks survey events.
4
+
5
+ It registers Formbricks webhooks for selected surveys and emits incoming survey webhook payloads into an n8n workflow.
6
+
7
+ ## Package
8
+
9
+ Published package name:
10
+
11
+ ```sh
12
+ n8n-nodes-formbricks-new
13
+ ```
14
+
15
+ This name follows the n8n community node package requirements: unscoped community node packages must start with `n8n-nodes-`, and the package includes the `n8n-community-node-package` keyword.
16
+
17
+ This package uses a new npm name because `n8n-nodes-formbricks` already exists on npm.
18
+
19
+ ## Installation
20
+
21
+ After publishing to npm, install the package in a self-hosted n8n instance:
22
+
23
+ 1. Go to **Settings > Community Nodes**.
24
+ 2. Select **Install**.
25
+ 3. Enter the npm package name: `n8n-nodes-formbricks-new`.
26
+ 4. Accept the community node warning and install.
27
+
28
+ Manual installation is also possible from the n8n custom nodes directory:
29
+
30
+ ```sh
31
+ mkdir -p ~/.n8n/nodes
32
+ cd ~/.n8n/nodes
33
+ npm install n8n-nodes-formbricks-new
34
+ ```
35
+
36
+ Restart n8n after manual installation.
37
+
38
+ For an unpublished local build, create a tarball from this repository and install that file:
39
+
40
+ ```sh
41
+ npm run build
42
+ npm pack
43
+ cd ~/.n8n/nodes
44
+ npm install /path/to/n8n-nodes-formbricks-new-1.0.2.tgz
45
+ ```
46
+
47
+ Restart n8n after installing the local tarball.
48
+
49
+ ## Credentials
50
+
51
+ Create Formbricks API credentials in n8n with:
52
+
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
56
+
57
+ To get the Workspace ID from the current Formbricks API v2:
58
+
59
+ ```sh
60
+ curl -H "x-api-key: <API_KEY>" https://form.example.com/api/v2/me
61
+ ```
62
+
63
+ Use the `workspaceId` value from the returned `workspaces` array.
64
+
65
+ The credential test still calls:
66
+
67
+ ```text
68
+ GET /api/v2/me
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ 1. Add the **Formbricks** trigger node to an n8n workflow.
74
+ 2. Select one or more events, for example **Response Finished**.
75
+ 3. Optionally enter comma-separated Survey IDs. Leave the field empty to trigger for all surveys in the workspace.
76
+ 4. Save and activate the workflow.
77
+
78
+ When the workflow is activated, n8n creates a production webhook URL and the node registers it in Formbricks with:
79
+
80
+ ```json
81
+ {
82
+ "name": null,
83
+ "workspaceId": "<WORKSPACE_ID>",
84
+ "url": "https://n8n.example.com/webhook/...",
85
+ "source": "n8n",
86
+ "triggers": ["responseFinished"],
87
+ "surveyIds": ["<SURVEY_ID>"]
88
+ }
89
+ ```
90
+
91
+ For production delivery, activate the workflow and use the **Production Webhook URL**. Production URLs use `/webhook/...`.
92
+
93
+ The `/webhook-test/...` URL is only for temporary test listening in the n8n editor. After test listening stops, Formbricks deliveries to `/webhook-test/...` will return 404.
94
+
95
+ If n8n is behind a reverse proxy, configure n8n's public webhook base URL, for example:
96
+
97
+ ```sh
98
+ WEBHOOK_URL=https://n8n.example.com/
99
+ ```
100
+
101
+ ## Development
102
+
103
+ Install dependencies:
104
+
105
+ ```sh
106
+ npm install
107
+ ```
108
+
109
+ Build:
110
+
111
+ ```sh
112
+ npm run build
113
+ ```
114
+
115
+ Run lint if available:
116
+
117
+ ```sh
118
+ npm run lint
119
+ ```
120
+
121
+ Check package contents:
122
+
123
+ ```sh
124
+ npm pack --dry-run
125
+ ```
126
+
127
+ Publish:
128
+
129
+ ```sh
130
+ npm adduser
131
+ npm login
132
+ npm version patch
133
+ npm publish
134
+ ```
135
+
136
+ Publishing is optional for local use. It requires an npm account logged in on the publishing machine.
137
+
138
+ ## Compatibility
139
+
140
+ This package is based on the upstream Formbricks n8n node and was updated to register webhooks through the Formbricks API v2 management webhook endpoints.
141
+
142
+ Formbricks API v2 currently exposes webhook management under `/api/v2/management/webhooks`. A v2 management survey list endpoint is not exposed in the current public docs/source, so Survey IDs are entered manually.
143
+
144
+ ## Resources
145
+
146
+ - [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
147
+ - [Formbricks API v2 reference](https://formbricks.com/docs/api-v2-reference/introduction)
148
+ - [Formbricks API v2 Me](https://formbricks.com/docs/api-v2-reference/me/me)
149
+ - [Formbricks API v2 webhook API](https://formbricks.com/docs/api-v2-reference/management-api--webhooks/create-a-webhook)
@@ -0,0 +1,8 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from "n8n-workflow";
2
+ export declare class FormbricksApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ properties: INodeProperties[];
6
+ authenticate: IAuthenticateGeneric;
7
+ test: ICredentialTestRequest | undefined;
8
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormbricksApi = void 0;
4
+ class FormbricksApi {
5
+ constructor() {
6
+ this.name = "formbricksApi";
7
+ this.displayName = "Formbricks API";
8
+ this.properties = [
9
+ {
10
+ displayName: "Host",
11
+ name: "host",
12
+ description: 'The address of your Formbricks instance. For Formbricks Cloud this is "https://app.formbricks.com". If you are hosting Formbricks yourself, it\'s the address where you can reach your instance.',
13
+ type: "string",
14
+ default: "https://app.formbricks.com",
15
+ },
16
+ {
17
+ displayName: "API Key",
18
+ name: "apiKey",
19
+ description: 'Your Formbricks API-Key. You can create a new API-Key in the Product Settings. Please read our <a href="https://formbricks.com/docs/api/api-key-setup">API Key Docs</a> for more details.',
20
+ type: "string",
21
+ typeOptions: { password: true },
22
+ default: "",
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
+ ];
33
+ this.authenticate = {
34
+ type: "generic",
35
+ properties: {
36
+ headers: {
37
+ "x-api-key": "={{$credentials.apiKey}}",
38
+ },
39
+ },
40
+ };
41
+ this.test = {
42
+ request: {
43
+ baseURL: "={{$credentials.host}}/api/v2",
44
+ url: "=/me",
45
+ },
46
+ };
47
+ }
48
+ }
49
+ exports.FormbricksApi = FormbricksApi;
50
+ //# sourceMappingURL=FormbricksApi.credentials.js.map
@@ -0,0 +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,2LAA2L;gBAC7L,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACZ;YACD;gBACE,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,mDAAmD;aACjE;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;AA7CD,sCA6CC"}
@@ -0,0 +1,12 @@
1
+ import { INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData, IHookFunctions } from "n8n-workflow";
2
+ export declare class Formbricks implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhookMethods: {
5
+ default: {
6
+ checkExists(this: IHookFunctions): Promise<boolean>;
7
+ create(this: IHookFunctions): Promise<boolean>;
8
+ delete(this: IHookFunctions): Promise<boolean>;
9
+ };
10
+ };
11
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
12
+ }
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formbricks = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const GenericFunctions_1 = require("./GenericFunctions");
6
+ function parseSurveyIds(surveyIds) {
7
+ if (Array.isArray(surveyIds)) {
8
+ return surveyIds;
9
+ }
10
+ return surveyIds
11
+ .split(",")
12
+ .map((surveyId) => surveyId.trim())
13
+ .filter((surveyId) => surveyId !== "");
14
+ }
15
+ class Formbricks {
16
+ constructor() {
17
+ this.description = {
18
+ displayName: "Formbricks",
19
+ name: "formbricks",
20
+ icon: "file:formbricks.svg",
21
+ group: ["trigger"],
22
+ version: 1,
23
+ subtitle: '=Surveys: {{$parameter["surveyIds"]}}',
24
+ description: "Open Source Surveys & Experience Management Solution",
25
+ defaults: {
26
+ name: "Formbricks",
27
+ },
28
+ inputs: [],
29
+ outputs: ["main"],
30
+ credentials: [
31
+ {
32
+ name: "formbricksApi",
33
+ required: true,
34
+ },
35
+ ],
36
+ webhooks: [
37
+ {
38
+ name: "default",
39
+ httpMethod: "POST",
40
+ responseMode: "onReceived",
41
+ path: "webhook",
42
+ },
43
+ ],
44
+ properties: [
45
+ {
46
+ displayName: "Events",
47
+ name: "events",
48
+ type: "multiOptions",
49
+ options: [
50
+ {
51
+ name: "Response Created",
52
+ value: "responseCreated",
53
+ description: "Triggers when a new response is created for a survey. Normally triggered after the first question was answered.",
54
+ },
55
+ {
56
+ name: "Response Updated",
57
+ value: "responseUpdated",
58
+ description: "Triggers when a response is updated within a survey",
59
+ },
60
+ {
61
+ name: "Response Finished",
62
+ value: "responseFinished",
63
+ description: "Triggers when a response is marked as finished",
64
+ },
65
+ ],
66
+ default: [],
67
+ required: true,
68
+ },
69
+ {
70
+ displayName: "Survey IDs",
71
+ name: "surveyIds",
72
+ description: "Optional comma-separated survey IDs. Leave empty to trigger this node for all surveys in the workspace.",
73
+ type: "string",
74
+ default: "",
75
+ },
76
+ ],
77
+ };
78
+ this.webhookMethods = {
79
+ default: {
80
+ async checkExists() {
81
+ var _a;
82
+ const webhookData = this.getWorkflowStaticData("node");
83
+ const webhookUrl = this.getNodeWebhookUrl("default");
84
+ 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
+ if (!workspaceId) {
88
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Workspace ID is required to check for an existing Formbricks webhook.");
89
+ }
90
+ const endpoint = "/management/webhooks";
91
+ const response = await GenericFunctions_1.apiRequest.call(this, "GET", endpoint, {}, { limit: 250 });
92
+ for (const webhook of response.data) {
93
+ const webhookSurveyIds = Array.isArray(webhook.surveyIds)
94
+ ? webhook.surveyIds
95
+ : [];
96
+ const surveyIdsMatch = (surveyIds.length === 0 && webhookSurveyIds.length === 0) ||
97
+ surveyIds.some((surveyId) => webhookSurveyIds.includes(surveyId));
98
+ if (webhook.url === webhookUrl && webhook.workspaceId === workspaceId && surveyIdsMatch) {
99
+ webhookData.webhookId = webhook.id;
100
+ return true;
101
+ }
102
+ }
103
+ return false;
104
+ },
105
+ async create() {
106
+ var _a;
107
+ const webhookData = this.getWorkflowStaticData("node");
108
+ const webhookUrl = this.getNodeWebhookUrl("default");
109
+ const surveyIds = parseSurveyIds(this.getNodeParameter("surveyIds"));
110
+ 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
+ if (!Array.isArray(events) || events.length === 0) {
114
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Select at least one Formbricks event before activating this trigger.");
115
+ }
116
+ if (!workspaceId) {
117
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Workspace ID is required to create a Formbricks webhook.");
118
+ }
119
+ const body = {
120
+ name: null,
121
+ workspaceId,
122
+ url: webhookUrl,
123
+ source: "n8n",
124
+ triggers: events,
125
+ surveyIds: surveyIds,
126
+ };
127
+ const endpoint = "/management/webhooks";
128
+ const response = await GenericFunctions_1.apiRequest.call(this, "POST", endpoint, body);
129
+ webhookData.webhookId = response.id;
130
+ return true;
131
+ },
132
+ async delete() {
133
+ const webhookData = this.getWorkflowStaticData("node");
134
+ if (webhookData.webhookId === undefined) {
135
+ return true;
136
+ }
137
+ const endpoint = `/management/webhooks/${webhookData.webhookId}`;
138
+ await GenericFunctions_1.apiRequest.call(this, "DELETE", endpoint, {});
139
+ delete webhookData.webhookId;
140
+ return true;
141
+ },
142
+ },
143
+ };
144
+ }
145
+ async webhook() {
146
+ const bodyData = this.getBodyData();
147
+ return {
148
+ workflowData: [this.helpers.returnJsonArray(bodyData)],
149
+ };
150
+ }
151
+ }
152
+ exports.Formbricks = Formbricks;
153
+ //# sourceMappingURL=Formbricks.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formbricks.node.js","sourceRoot":"","sources":["../../../nodes/Formbricks/Formbricks.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,yDAAgD;AAEhD,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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BAED,MAAM,QAAQ,GAAG,wBAAwB,WAAW,CAAC,SAAS,EAAE,CAAC;oBAEjE,MAAM,6BAAU,CAAC,IAAI,CAAC,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;AAlKD,gCAkKC"}
@@ -0,0 +1,18 @@
1
+ {
2
+ "node": "n8n-nodes-base.Formbricks",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Communication"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://docs.n8n.io/credentials/formbricks"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.formbricks/"
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,2 @@
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>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apiRequest = apiRequest;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ async function apiRequest(method, resource, body, query = {}, option = {}) {
6
+ const credentials = await this.getCredentials("formbricksApi");
7
+ let options = {
8
+ baseURL: `${credentials.host}/api/v2`,
9
+ method,
10
+ body,
11
+ qs: query,
12
+ url: resource,
13
+ headers: {
14
+ "x-api-key": credentials.apiKey,
15
+ },
16
+ };
17
+ if (!Object.keys(query).length) {
18
+ delete options.qs;
19
+ }
20
+ options = Object.assign({}, options, option);
21
+ try {
22
+ return await this.helpers.httpRequestWithAuthentication.call(this, "formbricksApi", options);
23
+ }
24
+ catch (error) {
25
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
26
+ }
27
+ }
28
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Formbricks/GenericFunctions.ts"],"names":[],"mappings":";;AAaA,gCAmCC;AAhDD,+CAQsB;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,OAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAC1D,IAAI,EACJ,eAAe,EACf,OAAO,CACR,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
@@ -0,0 +1,75 @@
1
+ <svg width="500" height="500" viewBox="0 0 500 500" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="500" height="500" fill="white"/>
3
+ <path d="M90 334H218V398.716C218 433.667 189.667 462 154.716 462H153.284C118.333 462 90 433.667 90 398.716V334Z" fill="url(#paint0_linear_3927_2011)"/>
4
+ <path d="M90 186H346.716C381.667 186 410 214.334 410 249.284V250.717C410 285.667 381.667 314 346.716 314H90V186Z" fill="url(#paint1_linear_3927_2011)"/>
5
+ <path d="M90 101.284C90 66.333 118.333 38 153.284 38H346.716C381.667 38 410 66.333 410 101.284V102.716C410 137.667 381.667 166 346.716 166H90V101.284Z" fill="url(#paint2_linear_3927_2011)"/>
6
+ <mask id="mask0_3927_2011" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="90" y="38" width="320" height="424">
7
+ <path d="M90 334H218V398.716C218 433.667 189.667 462 154.716 462H153.284C118.333 462 90 433.667 90 398.716V334Z" fill="url(#paint3_linear_3927_2011)"/>
8
+ <path d="M90 186H346.716C381.667 186 410 214.334 410 249.284V250.717C410 285.667 381.667 314 346.716 314H90V186Z" fill="url(#paint4_linear_3927_2011)"/>
9
+ <path d="M90 101.284C90 66.333 118.333 38 153.284 38H346.716C381.667 38 410 66.333 410 101.284V102.716C410 137.667 381.667 166 346.716 166H90V101.284Z" fill="url(#paint5_linear_3927_2011)"/>
10
+ </mask>
11
+ <g mask="url(#mask0_3927_2011)">
12
+ <g filter="url(#filter0_d_3927_2011)">
13
+ <mask id="mask1_3927_2011" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="90" y="38" width="320" height="424">
14
+ <path d="M90 334H218V398.716C218 433.667 189.667 462 154.716 462H153.284C118.333 462 90 433.667 90 398.716V334Z" fill="black" fill-opacity="0.1"/>
15
+ <path d="M90 101.284C90 66.333 118.333 38 153.284 38H346.716C381.667 38 410 66.333 410 101.284V102.716C410 137.667 381.667 166 346.716 166H90V101.284Z" fill="black" fill-opacity="0.1"/>
16
+ <path d="M90 186H346.716C381.667 186 410 214.334 410 249.284V250.717C410 285.667 381.667 314 346.716 314H90V186Z" fill="black" fill-opacity="0.1"/>
17
+ </mask>
18
+ <g mask="url(#mask1_3927_2011)">
19
+ <path d="M96.7149 -72.2506C146.856 -121.187 273.999 -72.2506 273.999 -72.2506H96.7149C84.3998 -60.2313 76.7298 -42.3079 76.7298 -16.3051C76.7298 115.567 219.58 163.522 219.58 255.433C219.58 345.407 82.6888 400.915 76.9176 523.174H273.999C273.999 523.174 76.7298 659.043 76.7298 531.166C76.7298 528.471 76.7933 525.807 76.9176 523.174H-10.0007L7.00526 -72.2506H96.7149Z" fill="black" fill-opacity="0.1"/>
20
+ </g>
21
+ </g>
22
+ <g filter="url(#filter1_f_3927_2011)">
23
+ <circle cx="50.0005" cy="406" r="120" fill="#00C4B8"/>
24
+ </g>
25
+ <g filter="url(#filter2_f_3927_2011)">
26
+ <circle cx="50.0005" cy="102" r="120" fill="#00C4B8"/>
27
+ </g>
28
+ </g>
29
+ <defs>
30
+ <filter id="filter0_d_3927_2011" x="83.6716" y="0.0298538" width="259.94" height="499.94" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
31
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
32
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
33
+ <feOffset dx="31.6418"/>
34
+ <feGaussianBlur stdDeviation="18.9851"/>
35
+ <feComposite in2="hardAlpha" operator="out"/>
36
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
37
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_3927_2011"/>
38
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_3927_2011" result="shape"/>
39
+ </filter>
40
+ <filter id="filter1_f_3927_2011" x="-133.283" y="222.717" width="366.567" height="366.567" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
41
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
42
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
43
+ <feGaussianBlur stdDeviation="31.6418" result="effect1_foregroundBlur_3927_2011"/>
44
+ </filter>
45
+ <filter id="filter2_f_3927_2011" x="-133.283" y="-81.2831" width="366.567" height="366.567" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
46
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
47
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
48
+ <feGaussianBlur stdDeviation="31.6418" result="effect1_foregroundBlur_3927_2011"/>
49
+ </filter>
50
+ <linearGradient id="paint0_linear_3927_2011" x1="218.557" y1="395.681" x2="89.989" y2="396.2" gradientUnits="userSpaceOnUse">
51
+ <stop stop-color="#00E6CA"/>
52
+ <stop offset="1" stop-color="#00C4B8"/>
53
+ </linearGradient>
54
+ <linearGradient id="paint1_linear_3927_2011" x1="411.391" y1="247.682" x2="90" y2="250.928" gradientUnits="userSpaceOnUse">
55
+ <stop stop-color="#00E6CA"/>
56
+ <stop offset="1" stop-color="#00C4B8"/>
57
+ </linearGradient>
58
+ <linearGradient id="paint2_linear_3927_2011" x1="411.391" y1="99.6812" x2="90" y2="102.928" gradientUnits="userSpaceOnUse">
59
+ <stop stop-color="#00E6CA"/>
60
+ <stop offset="1" stop-color="#00C4B8"/>
61
+ </linearGradient>
62
+ <linearGradient id="paint3_linear_3927_2011" x1="218.557" y1="395.681" x2="89.989" y2="396.2" gradientUnits="userSpaceOnUse">
63
+ <stop stop-color="#00FFE1"/>
64
+ <stop offset="1" stop-color="#01E0C6"/>
65
+ </linearGradient>
66
+ <linearGradient id="paint4_linear_3927_2011" x1="411.391" y1="247.682" x2="90" y2="250.928" gradientUnits="userSpaceOnUse">
67
+ <stop stop-color="#00FFE1"/>
68
+ <stop offset="1" stop-color="#01E0C6"/>
69
+ </linearGradient>
70
+ <linearGradient id="paint5_linear_3927_2011" x1="411.391" y1="99.6812" x2="90" y2="102.928" gradientUnits="userSpaceOnUse">
71
+ <stop stop-color="#00FFE1"/>
72
+ <stop offset="1" stop-color="#01E0C6"/>
73
+ </linearGradient>
74
+ </defs>
75
+ </svg>
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "n8n-nodes-formbricks-new",
3
+ "version": "1.0.2",
4
+ "description": "A n8n node to connect Formbricks and send survey data to hundreds of other apps.",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "n8n",
8
+ "trigger",
9
+ "Formbricks",
10
+ "n8n-node",
11
+ "surveys",
12
+ "experience management"
13
+ ],
14
+ "license": "MIT",
15
+ "homepage": "https://github.com/shkero/n8n-nodes-formbricks",
16
+ "author": {
17
+ "name": "PratikAwaik",
18
+ "email": "pratikawaik125@gmail.com"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/shkero/n8n-nodes-formbricks.git"
23
+ },
24
+ "main": "index.js",
25
+ "scripts": {
26
+ "build": "tsc && gulp build:icons",
27
+ "clean": "rimraf .turbo node_modules dist",
28
+ "dev": "tsc --watch",
29
+ "format": "prettier nodes credentials --write",
30
+ "lint": "eslint nodes credentials package.json",
31
+ "lintfix": "eslint nodes credentials package.json --fix",
32
+ "prepublishOnly": "npm run build && eslint -c .eslintrc.prepublish.js nodes credentials package.json"
33
+ },
34
+ "files": [
35
+ "dist/**/*.d.ts",
36
+ "dist/**/*.js",
37
+ "dist/**/*.js.map",
38
+ "dist/**/*.json",
39
+ "dist/**/*.svg"
40
+ ],
41
+ "n8n": {
42
+ "n8nNodesApiVersion": 1,
43
+ "credentials": [
44
+ "dist/credentials/FormbricksApi.credentials.js"
45
+ ],
46
+ "nodes": [
47
+ "dist/nodes/Formbricks/Formbricks.node.js"
48
+ ]
49
+ },
50
+ "devDependencies": {
51
+ "@types/express": "^4.17.6",
52
+ "@types/request-promise-native": "~1.0.15",
53
+ "@typescript-eslint/parser": "^8.60.1",
54
+ "eslint-plugin-n8n-nodes-base": "^1.11.0",
55
+ "gulp": "^4.0.2",
56
+ "n8n-core": "*",
57
+ "n8n-workflow": "*",
58
+ "rimraf": "^5.0.5",
59
+ "typescript": "^5.9.3"
60
+ }
61
+ }
package/index.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "n8n-nodes-formbricks-new",
3
+ "version": "1.0.2",
4
+ "description": "A n8n node to connect Formbricks and send survey data to hundreds of other apps.",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "n8n",
8
+ "trigger",
9
+ "Formbricks",
10
+ "n8n-node",
11
+ "surveys",
12
+ "experience management"
13
+ ],
14
+ "license": "MIT",
15
+ "homepage": "https://github.com/shkero/n8n-nodes-formbricks",
16
+ "author": {
17
+ "name": "PratikAwaik",
18
+ "email": "pratikawaik125@gmail.com"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/shkero/n8n-nodes-formbricks.git"
23
+ },
24
+ "main": "index.js",
25
+ "scripts": {
26
+ "build": "tsc && gulp build:icons",
27
+ "clean": "rimraf .turbo node_modules dist",
28
+ "dev": "tsc --watch",
29
+ "format": "prettier nodes credentials --write",
30
+ "lint": "eslint nodes credentials package.json",
31
+ "lintfix": "eslint nodes credentials package.json --fix",
32
+ "prepublishOnly": "npm run build && eslint -c .eslintrc.prepublish.js nodes credentials package.json"
33
+ },
34
+ "files": [
35
+ "dist/**/*.d.ts",
36
+ "dist/**/*.js",
37
+ "dist/**/*.js.map",
38
+ "dist/**/*.json",
39
+ "dist/**/*.svg"
40
+ ],
41
+ "n8n": {
42
+ "n8nNodesApiVersion": 1,
43
+ "credentials": [
44
+ "dist/credentials/FormbricksApi.credentials.js"
45
+ ],
46
+ "nodes": [
47
+ "dist/nodes/Formbricks/Formbricks.node.js"
48
+ ]
49
+ },
50
+ "devDependencies": {
51
+ "@types/express": "^4.17.6",
52
+ "@types/request-promise-native": "~1.0.15",
53
+ "@typescript-eslint/parser": "^8.60.1",
54
+ "eslint-plugin-n8n-nodes-base": "^1.11.0",
55
+ "gulp": "^4.0.2",
56
+ "n8n-core": "*",
57
+ "n8n-workflow": "*",
58
+ "rimraf": "^5.0.5",
59
+ "typescript": "^5.9.3"
60
+ }
61
+ }