n8n-nodes-befroosh 0.2.0 → 0.3.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 +100 -8
- package/dist/credentials/BatabjamAboardSmsApi.credentials.js.map +1 -1
- package/dist/credentials/BatabjamSmsApi.credentials.js.map +1 -1
- package/dist/credentials/BefrooshAnalyticsApi.credentials.d.ts +7 -0
- package/dist/credentials/BefrooshAnalyticsApi.credentials.js +54 -0
- package/dist/credentials/BefrooshAnalyticsApi.credentials.js.map +1 -0
- package/dist/credentials/MeliPayamakSmsApi.credentials.js.map +1 -1
- package/dist/credentials/NotrikaSmsApi.credentials.js.map +1 -1
- package/dist/lib/signature.d.ts +17 -0
- package/dist/lib/signature.js +38 -0
- package/dist/lib/signature.js.map +1 -0
- package/dist/nodes/BefrooshAnalyticsTrigger/BefrooshAnalyticsTrigger.node.d.ts +5 -0
- package/dist/nodes/BefrooshAnalyticsTrigger/BefrooshAnalyticsTrigger.node.js +120 -0
- package/dist/nodes/BefrooshAnalyticsTrigger/BefrooshAnalyticsTrigger.node.js.map +1 -0
- package/dist/nodes/BefrooshAnalyticsTrigger/befroosh.svg +1 -0
- package/dist/nodes/BefrooshAssignAction/BefrooshAssignAction.node.d.ts +5 -0
- package/dist/nodes/BefrooshAssignAction/BefrooshAssignAction.node.js +202 -0
- package/dist/nodes/BefrooshAssignAction/BefrooshAssignAction.node.js.map +1 -0
- package/dist/nodes/BefrooshAssignAction/befroosh.svg +1 -0
- package/dist/nodes/BefrooshReplay/BefrooshReplay.node.d.ts +5 -0
- package/dist/nodes/BefrooshReplay/BefrooshReplay.node.js +169 -0
- package/dist/nodes/BefrooshReplay/BefrooshReplay.node.js.map +1 -0
- package/dist/nodes/BefrooshReplay/befroosh.svg +1 -0
- package/dist/nodes/BefrooshSms/BefrooshSms.node.js +2 -6
- package/dist/nodes/BefrooshSms/BefrooshSms.node.js.map +1 -1
- package/package.json +28 -8
package/README.md
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
# n8n-nodes-befroosh
|
|
2
2
|
|
|
3
|
-
Custom **n8n** nodes for Befroosh. This package is the home for any n8n node we build
|
|
4
|
-
|
|
3
|
+
Custom **n8n** nodes for Befroosh. This package is the home for any n8n node we build.
|
|
4
|
+
It ships the **Befroosh SMS** node, plus the analytics-webhook pair — **Befroosh Analytics
|
|
5
|
+
Trigger** and **Befroosh Replay** — driven by a shared **Befroosh Analytics API** credential.
|
|
5
6
|
|
|
6
7
|
## Layout
|
|
7
8
|
|
|
8
9
|
```
|
|
9
10
|
apps/n8n-nodes/
|
|
10
|
-
├── credentials/
|
|
11
|
-
│ ├── NotrikaSmsApi.credentials.ts
|
|
11
|
+
├── credentials/
|
|
12
|
+
│ ├── NotrikaSmsApi.credentials.ts # one per SMS provider
|
|
12
13
|
│ ├── BatabjamSmsApi.credentials.ts
|
|
13
14
|
│ ├── MeliPayamakSmsApi.credentials.ts
|
|
14
|
-
│
|
|
15
|
+
│ ├── BatabjamAboardSmsApi.credentials.ts
|
|
16
|
+
│ └── BefrooshAnalyticsApi.credentials.ts # baseUrl + signingSecret + apiKey
|
|
17
|
+
├── lib/
|
|
18
|
+
│ └── signature.ts # local HMAC verify (self-contained) + tests
|
|
15
19
|
├── nodes/
|
|
16
|
-
│
|
|
17
|
-
│
|
|
18
|
-
│
|
|
20
|
+
│ ├── BefrooshSms/
|
|
21
|
+
│ ├── BefrooshAnalyticsTrigger/ # webhook trigger (verifies + emits events)
|
|
22
|
+
│ └── BefrooshReplay/ # schedule/cancel/status replay calls
|
|
19
23
|
├── scripts/copy-icons.mjs # copies .svg/.png into dist after tsc
|
|
20
24
|
├── tsconfig.json
|
|
21
25
|
└── package.json # the "n8n" field registers nodes + credentials
|
|
22
26
|
```
|
|
23
27
|
|
|
28
|
+
> **Self-contained (CLAUDE.md §10):** this package is published, so it imports no
|
|
29
|
+
> `@befroosh/*` / `workspace:*` code. `lib/signature.ts` re-implements the webhook
|
|
30
|
+
> signature scheme locally (mirrors `apps/core/.../webhook-signer.ts`); tests run with
|
|
31
|
+
> Node's built-in runner: `node --test lib/signature.test.ts`.
|
|
32
|
+
|
|
24
33
|
## Develop
|
|
25
34
|
|
|
26
35
|
```bash
|
|
@@ -54,6 +63,89 @@ Fields: **To** (Batabjam/Aboard accept comma-separated numbers), **Message** (Se
|
|
|
54
63
|
or **OTP Code** (Send OTP). Set the node to *Continue On Fail* if a send must never break a
|
|
55
64
|
workflow.
|
|
56
65
|
|
|
66
|
+
## Befroosh Analytics API credential
|
|
67
|
+
|
|
68
|
+
One credential (`befrooshAnalyticsApi`) shared by the trigger and replay nodes — it
|
|
69
|
+
replaces the old `BEFROOSH_*` env vars:
|
|
70
|
+
|
|
71
|
+
| Field | Used by | Purpose |
|
|
72
|
+
|-------|---------|---------|
|
|
73
|
+
| `baseUrl` | Replay | Core API base incl. version prefix, e.g. `https://core/v1` |
|
|
74
|
+
| `signingSecret` | Trigger | HMAC secret to verify `X-Befroosh-Signature` |
|
|
75
|
+
| `apiKey` | Replay | Per-endpoint Bearer key (`awh_live_…`) for the Replay API |
|
|
76
|
+
|
|
77
|
+
## Befroosh Analytics Trigger node
|
|
78
|
+
|
|
79
|
+
A webhook **trigger** that receives Befroosh analytics events and verifies them. It computes
|
|
80
|
+
`HMAC_SHA256(signingSecret, "<t>.<rawBody>")` over the **raw** request bytes and compares it
|
|
81
|
+
to the `t=…,v1=…` `X-Befroosh-Signature` header, with a `Tolerance (Seconds)` anti-replay
|
|
82
|
+
window (default 300). Invalid/stale → **HTTP 401, no item emitted**; a missing signing secret
|
|
83
|
+
throws a node error (misconfiguration, not a 401). Valid → acks 200 (`responseMode: onReceived`)
|
|
84
|
+
and emits **one** flattened item: `eventId, type, parent, occurredAt, actorUserId, workspaceId,
|
|
85
|
+
data, context, delivery {id, attempt, origin, replayCount, replayScheduleId}, event`. Route
|
|
86
|
+
downstream with a Switch on `type`.
|
|
87
|
+
|
|
88
|
+
### Test the trigger without the backend
|
|
89
|
+
|
|
90
|
+
`scripts/send-test-event.mjs` builds a **mock** analytics event, signs it with the same
|
|
91
|
+
`HMAC_SHA256(signingSecret, "<t>.<rawBody>")` scheme the core dispatcher uses, and POSTs it
|
|
92
|
+
straight to an n8n webhook URL — so you can exercise a workflow **without** a registered
|
|
93
|
+
endpoint or the backend fan-out. The signing secret is used locally to compute the HMAC and is
|
|
94
|
+
**never sent over the wire**; supply the same secret the credential holds.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# from apps/n8n-nodes
|
|
98
|
+
node scripts/send-test-event.mjs \
|
|
99
|
+
--url https://dl4.mahsolist.ir:8443/webhook/befroosh-analytics \
|
|
100
|
+
--secret <signingSecret> \
|
|
101
|
+
--email user@example.com # and/or --mobile 09120000000
|
|
102
|
+
# or: npm run send-test -- --url … --secret … --email …
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Options: `--type` (default `account.created`), `--workspace-id`, `--actor-user-id`, `--stale`
|
|
106
|
+
(sign an out-of-tolerance timestamp to confirm the node returns **401**), `--help`. The
|
|
107
|
+
**production** URL is required and the workflow must be **Active** (the test URL only listens
|
|
108
|
+
while the editor is open). Self-signed host? Set `NODE_EXTRA_CA_CERTS` rather than disabling TLS.
|
|
109
|
+
|
|
110
|
+
#### Testing the Replay node (`--db`)
|
|
111
|
+
|
|
112
|
+
Replay re-delivers a **stored** event by id, so a mock that was never persisted will 404
|
|
113
|
+
(`ANALYTICS_WEBHOOK_EVENT_NOTFOUND`). Add `--db <conninfo>` to also INSERT the event into the
|
|
114
|
+
backend's `analytics_event` table **before** posting, so the workflow's Replay node can find it:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
PGPASSWORD=… node scripts/send-test-event.mjs \
|
|
118
|
+
--url https://dl4.mahsolist.ir:8443/webhook/befroosh-analytics \
|
|
119
|
+
--secret <signingSecret> --email user@example.com \
|
|
120
|
+
--db postgresql://postgres@HOST:5440/xx_mvp
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The INSERT is a local raw SQL statement run via the external `psql` binary (no backend import —
|
|
124
|
+
stays self-contained per CLAUDE.md §10); its column list mirrors migration `1781000000000` and
|
|
125
|
+
`payload` = the event's `data` (which is what replay rebuilds the delivered envelope from). The
|
|
126
|
+
endpoint must still be **subscribed** to the event type and the row stays within the 90-day
|
|
127
|
+
retention window. Note: the replayed delivery re-POSTs to the same endpoint, so design the
|
|
128
|
+
workflow to not replay an already-replayed event (check `delivery.replayCount`).
|
|
129
|
+
|
|
130
|
+
The script is plain ESM in `scripts/` — tsc does not compile it and `files: ["dist"]` never
|
|
131
|
+
publishes it. `npm test` round-trips its output through the node's real `verifySignature` to
|
|
132
|
+
guarantee the bytes it signs are accepted.
|
|
133
|
+
|
|
134
|
+
## Befroosh Replay node
|
|
135
|
+
|
|
136
|
+
An action node that calls the Replay API at `{baseUrl}/analytics/replays` with
|
|
137
|
+
`Authorization: Bearer {apiKey}`:
|
|
138
|
+
|
|
139
|
+
| Operation | Call | Key params |
|
|
140
|
+
|-----------|------|------------|
|
|
141
|
+
| Schedule Replay | `POST /analytics/replays` | `eventId` (default `={{ $json.eventId }}`), `schedule` (default `["1d","2d","3d"]`) |
|
|
142
|
+
| Cancel Replay | `DELETE /analytics/replays/:id` | `replayScheduleId` (default `={{ $json.delivery.replayScheduleId }}`) |
|
|
143
|
+
| Get Status | `GET /analytics/replays/:id` | `replayScheduleId` |
|
|
144
|
+
|
|
145
|
+
Defaults auto-wire from an upstream **Befroosh Analytics Trigger** item, so the common
|
|
146
|
+
`Trigger → Switch → Replay` flow needs no manual id entry. Surfaces the backend error `code`
|
|
147
|
+
and honors *Continue On Fail*.
|
|
148
|
+
|
|
57
149
|
## Install into an n8n instance
|
|
58
150
|
|
|
59
151
|
A custom node has to be loaded by the n8n runtime (it is **not** importable as a workflow):
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatabjamAboardSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/BatabjamAboardSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAAjC;
|
|
1
|
+
{"version":3,"file":"BatabjamAboardSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/BatabjamAboardSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAAjC;QACE,SAAI,GAAG,sBAAsB,CAAC;QAE9B,gBAAW,GAAG,yBAAyB,CAAC;QAExC,qBAAgB,GAAG,4BAA4B,CAAC;QAEhD,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,2DAA2D;aACzE;YACD;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IACJ,CAAC;CAAA;AAzBD,oDAyBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatabjamSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/BatabjamSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAA3B;
|
|
1
|
+
{"version":3,"file":"BatabjamSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/BatabjamSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAA3B;QACE,SAAI,GAAG,gBAAgB,CAAC;QAExB,gBAAW,GAAG,kBAAkB,CAAC;QAEjC,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD;gBACE,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IACJ,CAAC;CAAA;AAzBD,wCAyBC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BefrooshAnalyticsApi = void 0;
|
|
4
|
+
class BefrooshAnalyticsApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'befrooshAnalyticsApi';
|
|
7
|
+
this.displayName = 'Befroosh Analytics API';
|
|
8
|
+
this.documentationUrl = 'https://befroosh.com';
|
|
9
|
+
// Pure-data credential (no test/authenticate/preSend/loadOptions) — matches the
|
|
10
|
+
// existing SMS credentials and avoids the editor credential-save hang on the
|
|
11
|
+
// self-hosted box (import via `n8n import:credentials` CLI).
|
|
12
|
+
this.properties = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Core Base URL',
|
|
15
|
+
name: 'baseUrl',
|
|
16
|
+
type: 'string',
|
|
17
|
+
default: '',
|
|
18
|
+
required: true,
|
|
19
|
+
placeholder: 'https://core.befroosh.com/v1',
|
|
20
|
+
description: 'Base URL of the Befroosh core API including the version prefix; used for replay calls',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Admin Base URL',
|
|
24
|
+
name: 'adminBaseUrl',
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: '',
|
|
27
|
+
required: false,
|
|
28
|
+
placeholder: 'https://adminapi.mahsolist.ir/v1',
|
|
29
|
+
description: 'Base URL of the Befroosh admin API (with version prefix); used by admin nodes like Assign Action',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Signing Secret',
|
|
33
|
+
name: 'signingSecret',
|
|
34
|
+
type: 'string',
|
|
35
|
+
typeOptions: { password: true },
|
|
36
|
+
default: '',
|
|
37
|
+
required: true,
|
|
38
|
+
description: 'HMAC secret used to verify inbound webhook signatures (X-Befroosh-Signature)',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Replay API Key',
|
|
42
|
+
name: 'apiKey',
|
|
43
|
+
type: 'string',
|
|
44
|
+
typeOptions: { password: true },
|
|
45
|
+
default: '',
|
|
46
|
+
required: true,
|
|
47
|
+
placeholder: 'awh_live_…',
|
|
48
|
+
description: 'Per-endpoint API key (Bearer) used to authenticate replay requests',
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.BefrooshAnalyticsApi = BefrooshAnalyticsApi;
|
|
54
|
+
//# sourceMappingURL=BefrooshAnalyticsApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BefrooshAnalyticsApi.credentials.js","sourceRoot":"","sources":["../../credentials/BefrooshAnalyticsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAAjC;QACE,SAAI,GAAG,sBAAsB,CAAC;QAE9B,gBAAW,GAAG,wBAAwB,CAAC;QAEvC,qBAAgB,GAAG,sBAAsB,CAAC;QAE1C,gFAAgF;QAChF,6EAA6E;QAC7E,6DAA6D;QAC7D,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,8BAA8B;gBAC3C,WAAW,EACT,uFAAuF;aAC1F;YACD;gBACE,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,kCAAkC;gBAC/C,WAAW,EACT,kGAAkG;aACrG;YACD;gBACE,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,8EAA8E;aAC5F;YACD;gBACE,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,YAAY;gBACzB,WAAW,EAAE,oEAAoE;aAClF;SACF,CAAC;IACJ,CAAC;CAAA;AAnDD,oDAmDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeliPayamakSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/MeliPayamakSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAA9B;
|
|
1
|
+
{"version":3,"file":"MeliPayamakSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/MeliPayamakSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAA9B;QACE,SAAI,GAAG,mBAAmB,CAAC;QAE3B,gBAAW,GAAG,qBAAqB,CAAC;QAEpC,qBAAgB,GAAG,sBAAsB,CAAC;QAE1C,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ;gBACjB,WAAW,EAAE,yCAAyC;aACvD;SACF,CAAC;IACJ,CAAC;CAAA;AAtCD,8CAsCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotrikaSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/NotrikaSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAA1B;
|
|
1
|
+
{"version":3,"file":"NotrikaSmsApi.credentials.js","sourceRoot":"","sources":["../../credentials/NotrikaSmsApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAA1B;QACE,SAAI,GAAG,eAAe,CAAC;QAEvB,gBAAW,GAAG,iBAAiB,CAAC;QAEhC,qBAAgB,GAAG,0BAA0B,CAAC;QAE9C,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,yCAAyC;aACvD;YACD;gBACE,WAAW,EAAE,iBAAiB;gBAC9B,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,gCAAgC;aAC9C;SACF,CAAC;IACJ,CAAC;CAAA;AAtCD,sCAsCC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface VerifyInput {
|
|
2
|
+
rawBody: string;
|
|
3
|
+
signatureHeader: string;
|
|
4
|
+
secret: string;
|
|
5
|
+
toleranceSec?: number;
|
|
6
|
+
nowSec?: number;
|
|
7
|
+
}
|
|
8
|
+
export type VerifyReason = 'missing_secret' | 'missing_header' | 'malformed_header' | 'stale' | 'mismatch';
|
|
9
|
+
export interface VerifyResult {
|
|
10
|
+
valid: boolean;
|
|
11
|
+
reason?: VerifyReason;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseSignatureHeader(header: string): {
|
|
14
|
+
t?: string;
|
|
15
|
+
v1?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function verifySignature(input: VerifyInput): VerifyResult;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSignatureHeader = parseSignatureHeader;
|
|
4
|
+
exports.verifySignature = verifySignature;
|
|
5
|
+
// Local re-implementation of the Befroosh analytics webhook signature scheme.
|
|
6
|
+
// MIRRORS apps/core/src/analyticsEvents/dispatch/webhook-signer.ts but does NOT
|
|
7
|
+
// import it — this package is published and must stay self-contained (CLAUDE.md §10).
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
9
|
+
function parseSignatureHeader(header) {
|
|
10
|
+
const out = {};
|
|
11
|
+
for (const part of String(header || '').split(',')) {
|
|
12
|
+
const i = part.indexOf('=');
|
|
13
|
+
if (i > -1)
|
|
14
|
+
out[part.slice(0, i).trim()] = part.slice(i + 1).trim();
|
|
15
|
+
}
|
|
16
|
+
return { t: out.t, v1: out.v1 ? out.v1.toLowerCase() : undefined };
|
|
17
|
+
}
|
|
18
|
+
function verifySignature(input) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const toleranceSec = (_a = input.toleranceSec) !== null && _a !== void 0 ? _a : 300;
|
|
21
|
+
const nowSec = (_b = input.nowSec) !== null && _b !== void 0 ? _b : Math.floor(Date.now() / 1000);
|
|
22
|
+
if (!input.secret)
|
|
23
|
+
return { valid: false, reason: 'missing_secret' };
|
|
24
|
+
if (!input.signatureHeader)
|
|
25
|
+
return { valid: false, reason: 'missing_header' };
|
|
26
|
+
const { t, v1 } = parseSignatureHeader(input.signatureHeader);
|
|
27
|
+
if (!t || !v1)
|
|
28
|
+
return { valid: false, reason: 'malformed_header' };
|
|
29
|
+
const skew = Math.abs(nowSec - Number(t));
|
|
30
|
+
if (!Number.isFinite(skew) || skew > toleranceSec)
|
|
31
|
+
return { valid: false, reason: 'stale' };
|
|
32
|
+
const expected = (0, node_crypto_1.createHmac)('sha256', input.secret).update(`${t}.${input.rawBody}`).digest('hex');
|
|
33
|
+
const a = Buffer.from(v1, 'hex');
|
|
34
|
+
const b = Buffer.from(expected, 'hex');
|
|
35
|
+
const ok = a.length === b.length && (0, node_crypto_1.timingSafeEqual)(a, b);
|
|
36
|
+
return ok ? { valid: true } : { valid: false, reason: 'mismatch' };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../lib/signature.ts"],"names":[],"mappings":";;AAyBA,oDAOC;AAED,0CAcC;AAhDD,8EAA8E;AAC9E,gFAAgF;AAChF,sFAAsF;AACtF,6CAA0D;AAsB1D,SAAgB,oBAAoB,CAAC,MAAc;IACjD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI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AG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,YAAY;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC5F,MAAM,QAAQ,GAAG,IAAA,wBAAU,EAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClG,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACjC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,IAAA,6BAAe,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IWebhookFunctions, IWebhookResponseData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class BefrooshAnalyticsTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BefrooshAnalyticsTrigger = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
// Within-package import (does NOT escape apps/n8n-nodes — allowed under CLAUDE.md §10).
|
|
6
|
+
const signature_1 = require("../../lib/signature");
|
|
7
|
+
class BefrooshAnalyticsTrigger {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.description = {
|
|
10
|
+
displayName: 'Befroosh Analytics Trigger',
|
|
11
|
+
name: 'befrooshAnalyticsTrigger',
|
|
12
|
+
icon: 'file:befroosh.svg',
|
|
13
|
+
group: ['trigger'],
|
|
14
|
+
version: 1,
|
|
15
|
+
subtitle: '=POST /{{$parameter["path"]}}',
|
|
16
|
+
description: 'Receive and verify Befroosh analytics webhook events',
|
|
17
|
+
defaults: { name: 'Befroosh Analytics Trigger' },
|
|
18
|
+
inputs: [],
|
|
19
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
20
|
+
credentials: [{ name: 'befrooshAnalyticsApi', required: true }],
|
|
21
|
+
webhooks: [
|
|
22
|
+
{
|
|
23
|
+
name: 'default',
|
|
24
|
+
httpMethod: 'POST',
|
|
25
|
+
responseMode: 'onReceived',
|
|
26
|
+
// isFullPath registers the production webhook at /webhook/<path> instead of
|
|
27
|
+
// /webhook/<webhookId>/<path> — matches n8n's core Webhook node so this is a
|
|
28
|
+
// drop-in for the URL core already POSTs to.
|
|
29
|
+
isFullPath: true,
|
|
30
|
+
path: '={{$parameter["path"]}}',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Path',
|
|
36
|
+
name: 'path',
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: 'befroosh-analytics',
|
|
39
|
+
required: true,
|
|
40
|
+
description: 'URL path segment events are POSTed to',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Tolerance (Seconds)',
|
|
44
|
+
name: 'toleranceSec',
|
|
45
|
+
type: 'number',
|
|
46
|
+
default: 300,
|
|
47
|
+
typeOptions: { minValue: 0 },
|
|
48
|
+
description: 'Max clock skew allowed for the signature timestamp (anti-replay)',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async webhook() {
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
55
|
+
const req = this.getRequestObject();
|
|
56
|
+
const res = this.getResponseObject();
|
|
57
|
+
const headers = this.getHeaderData();
|
|
58
|
+
const signatureHeader = headers['x-befroosh-signature'] || '';
|
|
59
|
+
const toleranceSec = this.getNodeParameter('toleranceSec', 300);
|
|
60
|
+
const credentials = await this.getCredentials('befrooshAnalyticsApi');
|
|
61
|
+
const secret = credentials.signingSecret;
|
|
62
|
+
// A missing secret is a misconfiguration, not a forged request — fail loudly so it
|
|
63
|
+
// surfaces in the editor instead of masquerading as an "invalid signature" 401.
|
|
64
|
+
if (!secret) {
|
|
65
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Befroosh signing secret is not configured on the credential');
|
|
66
|
+
}
|
|
67
|
+
// HMAC must be over the EXACT received bytes. n8n exposes req.rawBody (+ readRawBody()).
|
|
68
|
+
// Re-stringifying parsed JSON would reorder keys and break the signature, so that is
|
|
69
|
+
// only a last-resort fallback for already-parsed bodies (verifies as a mismatch/401,
|
|
70
|
+
// never a false accept — forging any signature still requires the secret).
|
|
71
|
+
const anyReq = req;
|
|
72
|
+
if (!anyReq.rawBody && typeof anyReq.readRawBody === 'function') {
|
|
73
|
+
await anyReq.readRawBody();
|
|
74
|
+
}
|
|
75
|
+
let raw;
|
|
76
|
+
if (anyReq.rawBody && anyReq.rawBody.length) {
|
|
77
|
+
raw = anyReq.rawBody.toString('utf8');
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// eslint-disable-next-line no-console
|
|
81
|
+
console.warn('[BefrooshAnalyticsTrigger] raw request body unavailable; verifying against re-serialized body (degraded)');
|
|
82
|
+
raw = JSON.stringify(this.getBodyData());
|
|
83
|
+
}
|
|
84
|
+
const result = (0, signature_1.verifySignature)({ rawBody: raw, signatureHeader, secret, toleranceSec });
|
|
85
|
+
if (!result.valid) {
|
|
86
|
+
res.status(401).json({ error: 'invalid_signature', reason: result.reason });
|
|
87
|
+
return { noWebhookResponse: true };
|
|
88
|
+
}
|
|
89
|
+
let event = {};
|
|
90
|
+
try {
|
|
91
|
+
event = JSON.parse(raw);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
event = {};
|
|
95
|
+
}
|
|
96
|
+
const type = event.type || null;
|
|
97
|
+
const delivery = event.delivery || {};
|
|
98
|
+
const item = {
|
|
99
|
+
eventId: (_a = event.id) !== null && _a !== void 0 ? _a : null,
|
|
100
|
+
type,
|
|
101
|
+
parent: type ? type.split('.')[0] : null,
|
|
102
|
+
occurredAt: (_b = event.occurredAt) !== null && _b !== void 0 ? _b : null,
|
|
103
|
+
actorUserId: (_c = event.actorUserId) !== null && _c !== void 0 ? _c : null,
|
|
104
|
+
workspaceId: (_d = event.workspaceId) !== null && _d !== void 0 ? _d : null,
|
|
105
|
+
data: (_e = event.data) !== null && _e !== void 0 ? _e : {},
|
|
106
|
+
context: (_f = event.context) !== null && _f !== void 0 ? _f : null,
|
|
107
|
+
delivery: {
|
|
108
|
+
id: (_g = delivery.id) !== null && _g !== void 0 ? _g : null,
|
|
109
|
+
attempt: (_h = delivery.attempt) !== null && _h !== void 0 ? _h : null,
|
|
110
|
+
origin: (_j = delivery.origin) !== null && _j !== void 0 ? _j : null,
|
|
111
|
+
replayCount: (_k = delivery.replayCount) !== null && _k !== void 0 ? _k : null,
|
|
112
|
+
replayScheduleId: (_l = delivery.replayScheduleId) !== null && _l !== void 0 ? _l : null,
|
|
113
|
+
},
|
|
114
|
+
event,
|
|
115
|
+
};
|
|
116
|
+
return { workflowData: [[{ json: item }]] };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.BefrooshAnalyticsTrigger = BefrooshAnalyticsTrigger;
|
|
120
|
+
//# sourceMappingURL=BefrooshAnalyticsTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BefrooshAnalyticsTrigger.node.js","sourceRoot":"","sources":["../../../nodes/BefrooshAnalyticsTrigger/BefrooshAnalyticsTrigger.node.ts"],"names":[],"mappings":";;;AAAA,+CAQsB;AACtB,wFAAwF;AACxF,mDAAsD;AAEtD,MAAa,wBAAwB;IAArC;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,0BAA0B;YAChC,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,+BAA+B;YACzC,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE;YAChD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC/D,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;oBAC1B,4EAA4E;oBAC5E,6EAA6E;oBAC7E,6CAA6C;oBAC7C,UAAU,EAAE,IAAI;oBAChB,IAAI,EAAE,yBAAyB;iBAChC;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,MAAM;oBACnB,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,oBAAoB;oBAC7B,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,uCAAuC;iBACrD;gBACD;oBACE,WAAW,EAAE,qBAAqB;oBAClC,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,GAAG;oBACZ,WAAW,EAAE,EAAE,QAAQ,E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AAuB,mCAAI,IAAI;YAC/C,QAAQ,EAAE;gBACR,EAAE,EAAE,MAAA,QAAQ,CAAC,EAAE,mCAAI,IAAI;gBACvB,OAAO,EAAE,MAAA,QAAQ,CAAC,OAAO,mCAAI,IAAI;gBACjC,MAAM,EAAE,MAAA,QAAQ,CAAC,MAAM,mCAAI,IAAI;gBAC/B,WAAW,EAAE,MAAA,QAAQ,CAAC,WAAW,mCAAI,IAAI;gBACzC,gBAAgB,EAAE,MAAA,QAAQ,CAAC,gBAAgB,mCAAI,IAAI;aACpD;YACD,KAAK;SACN,CAAC;QACF,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;IAC9C,CAAC;CACF;AAnHD,4DAmHC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><rect width="24" height="24" rx="5" fill="#10b981"/><path d="M6 12.5l3.5 3.5L18 7.5" fill="none" stroke="#fff" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class BefrooshAssignAction implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BefrooshAssignAction = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class BefrooshAssignAction {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Befroosh Assign Action',
|
|
9
|
+
name: 'befrooshAssignAction',
|
|
10
|
+
icon: 'file:befroosh.svg',
|
|
11
|
+
group: ['output'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{ $parameter["mode"] }}',
|
|
14
|
+
description: 'Create a task (action) and assign it to an admin (by username or balanced-random by role)',
|
|
15
|
+
defaults: { name: 'Befroosh Assign Action' },
|
|
16
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
17
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
18
|
+
credentials: [{ name: 'befrooshAnalyticsApi', required: true }],
|
|
19
|
+
properties: [
|
|
20
|
+
{
|
|
21
|
+
displayName: 'For',
|
|
22
|
+
name: 'for',
|
|
23
|
+
type: 'options',
|
|
24
|
+
noDataExpression: true,
|
|
25
|
+
default: 'user',
|
|
26
|
+
options: [
|
|
27
|
+
{ name: 'User', value: 'user' },
|
|
28
|
+
{ name: 'Marketing Lead', value: 'marketingLead' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'User / Lead ID',
|
|
33
|
+
name: 'leadOrUserId',
|
|
34
|
+
type: 'string',
|
|
35
|
+
default: '={{ $json.id }}',
|
|
36
|
+
required: true,
|
|
37
|
+
description: 'UUID of the user or marketing lead the task is for',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Type',
|
|
41
|
+
name: 'type',
|
|
42
|
+
type: 'options',
|
|
43
|
+
default: 'phone',
|
|
44
|
+
options: [
|
|
45
|
+
{ name: 'Phone', value: 'phone' },
|
|
46
|
+
{ name: 'Telegram', value: 'telegram' },
|
|
47
|
+
{ name: 'Instagram', value: 'instagram' },
|
|
48
|
+
{ name: 'WhatsApp', value: 'whatsapp' },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Description',
|
|
53
|
+
name: 'description',
|
|
54
|
+
type: 'string',
|
|
55
|
+
typeOptions: { rows: 3 },
|
|
56
|
+
default: '',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Action Date',
|
|
60
|
+
name: 'actionDate',
|
|
61
|
+
type: 'dateTime',
|
|
62
|
+
default: '',
|
|
63
|
+
description: 'When the task is due; defaults to now if empty',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Status',
|
|
67
|
+
name: 'status',
|
|
68
|
+
type: 'options',
|
|
69
|
+
default: 'todo',
|
|
70
|
+
options: [
|
|
71
|
+
{ name: 'To Do', value: 'todo' },
|
|
72
|
+
{ name: 'Done', value: 'done' },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Assignment Mode',
|
|
77
|
+
name: 'mode',
|
|
78
|
+
type: 'options',
|
|
79
|
+
noDataExpression: true,
|
|
80
|
+
default: 'username',
|
|
81
|
+
options: [
|
|
82
|
+
{ name: 'By Username', value: 'username' },
|
|
83
|
+
{ name: 'Random by Role', value: 'random' },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
displayName: 'Admin Username',
|
|
88
|
+
name: 'username',
|
|
89
|
+
type: 'string',
|
|
90
|
+
default: '',
|
|
91
|
+
required: true,
|
|
92
|
+
displayOptions: { show: { mode: ['username'] } },
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Role',
|
|
96
|
+
name: 'role',
|
|
97
|
+
type: 'options',
|
|
98
|
+
default: 'all',
|
|
99
|
+
displayOptions: { show: { mode: ['random'] } },
|
|
100
|
+
options: [
|
|
101
|
+
{ name: 'Admin', value: 'admin' },
|
|
102
|
+
{ name: 'Manager', value: 'manager' },
|
|
103
|
+
{ name: 'KAM', value: 'kam' },
|
|
104
|
+
{ name: 'All', value: 'all' },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async execute() {
|
|
111
|
+
const items = this.getInputData();
|
|
112
|
+
const returnData = [];
|
|
113
|
+
const credentials = await this.getCredentials('befrooshAnalyticsApi');
|
|
114
|
+
const adminBaseUrl = String(credentials.adminBaseUrl || '').replace(/\/+$/, '');
|
|
115
|
+
const apiKey = credentials.apiKey;
|
|
116
|
+
// Misconfigured credential fields are operator errors: respect Continue-On-Fail,
|
|
117
|
+
// otherwise surface loudly in the editor.
|
|
118
|
+
if (!adminBaseUrl || !apiKey) {
|
|
119
|
+
const message = !adminBaseUrl
|
|
120
|
+
? 'Admin Base URL is not configured on the befrooshAnalyticsApi credential'
|
|
121
|
+
: 'API Key is not configured on the befrooshAnalyticsApi credential';
|
|
122
|
+
if (this.continueOnFail()) {
|
|
123
|
+
return [
|
|
124
|
+
items.map((_, i) => ({
|
|
125
|
+
json: { success: false, error: message },
|
|
126
|
+
pairedItem: { item: i },
|
|
127
|
+
})),
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), message);
|
|
131
|
+
}
|
|
132
|
+
for (let i = 0; i < items.length; i++) {
|
|
133
|
+
try {
|
|
134
|
+
const mode = this.getNodeParameter('mode', i);
|
|
135
|
+
const body = {
|
|
136
|
+
for: this.getNodeParameter('for', i),
|
|
137
|
+
leadOrUserId: this.getNodeParameter('leadOrUserId', i).trim(),
|
|
138
|
+
type: this.getNodeParameter('type', i),
|
|
139
|
+
status: this.getNodeParameter('status', i),
|
|
140
|
+
mode,
|
|
141
|
+
};
|
|
142
|
+
const description = this.getNodeParameter('description', i) || '';
|
|
143
|
+
if (description)
|
|
144
|
+
body.description = description;
|
|
145
|
+
const actionDate = this.getNodeParameter('actionDate', i) || '';
|
|
146
|
+
if (actionDate)
|
|
147
|
+
body.actionDate = actionDate;
|
|
148
|
+
if (mode === 'username') {
|
|
149
|
+
body.username = this.getNodeParameter('username', i).trim();
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
body.role = this.getNodeParameter('role', i);
|
|
153
|
+
}
|
|
154
|
+
const apiRes = (await this.helpers.httpRequest({
|
|
155
|
+
method: 'POST',
|
|
156
|
+
url: `${adminBaseUrl}/actions/assign`,
|
|
157
|
+
headers: { 'x-api-key': apiKey, Accept: 'application/json' },
|
|
158
|
+
body,
|
|
159
|
+
json: true,
|
|
160
|
+
returnFullResponse: true,
|
|
161
|
+
ignoreHttpStatusErrors: true,
|
|
162
|
+
}));
|
|
163
|
+
if (apiRes.statusCode >= 400) {
|
|
164
|
+
const b = apiRes.body;
|
|
165
|
+
const code = (b && b.code) || `HTTP_${apiRes.statusCode}`;
|
|
166
|
+
if (this.continueOnFail()) {
|
|
167
|
+
returnData.push({
|
|
168
|
+
json: { success: false, statusCode: apiRes.statusCode, code, response: b },
|
|
169
|
+
pairedItem: { item: i },
|
|
170
|
+
});
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), { statusCode: apiRes.statusCode, body: apiRes.body }, {
|
|
174
|
+
httpCode: String(apiRes.statusCode),
|
|
175
|
+
message: `Assign action failed (HTTP ${apiRes.statusCode}): ${code}`,
|
|
176
|
+
description: typeof apiRes.body === 'string' ? apiRes.body : JSON.stringify(apiRes.body),
|
|
177
|
+
itemIndex: i,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
returnData.push({
|
|
181
|
+
json: {
|
|
182
|
+
success: true,
|
|
183
|
+
statusCode: apiRes.statusCode,
|
|
184
|
+
response: apiRes.body,
|
|
185
|
+
},
|
|
186
|
+
pairedItem: { item: i },
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
if (this.continueOnFail()) {
|
|
191
|
+
const e = error;
|
|
192
|
+
returnData.push({ json: { success: false, error: e.message }, pairedItem: { item: i } });
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return [returnData];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.BefrooshAssignAction = BefrooshAssignAction;
|
|
202
|
+
//# sourceMappingURL=BefrooshAssignAction.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BefrooshAssignAction.node.js","sourceRoot":"","sources":["../../../nodes/BefrooshAssignAction/BefrooshAssignAction.node.ts"],"names":[],"mappings":";;;AAAA,+CAUsB;AAEtB,MAAa,oBAAoB;IAAjC;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,2BAA2B;YACrC,WAAW,EACT,2FAA2F;YAC7F,QAAQ,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE;YAC5C,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC/D,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,KAAK;oBAClB,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,MAAM;oBACf,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;wBAC/B,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE;qBACnD;iBACF;gBACD;oBACE,WAAW,EAAE,gBAAgB;oBAC7B,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,iBAAiB;oBAC1B,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,oDAAoD;iBAClE;gBACD;oBACE,WAAW,EAAE,MAAM;oBACnB,IAAI,EAAE,MAAM;oBACZ,I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stroke="#fff" stroke-width="2.1" stroke-linecap="round"/><path d="M7 8.5V12h3.5" fill="none" stroke="#fff" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class BefrooshReplay implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BefrooshReplay = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class BefrooshReplay {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Befroosh Replay',
|
|
9
|
+
name: 'befrooshReplay',
|
|
10
|
+
icon: 'file:befroosh.svg',
|
|
11
|
+
group: ['output'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{ $parameter["operation"] }}',
|
|
14
|
+
description: 'Schedule, cancel, or inspect Befroosh analytics event replays',
|
|
15
|
+
defaults: { name: 'Befroosh Replay' },
|
|
16
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
17
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
18
|
+
credentials: [{ name: 'befrooshAnalyticsApi', required: true }],
|
|
19
|
+
properties: [
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Operation',
|
|
22
|
+
name: 'operation',
|
|
23
|
+
type: 'options',
|
|
24
|
+
noDataExpression: true,
|
|
25
|
+
default: 'schedule',
|
|
26
|
+
options: [
|
|
27
|
+
{ name: 'Schedule Replay', value: 'schedule', action: 'Schedule replays for an event' },
|
|
28
|
+
{ name: 'Cancel Replay', value: 'cancel', action: 'Cancel a scheduled replay' },
|
|
29
|
+
{ name: 'Get Status', value: 'getStatus', action: 'Get a replay schedule status' },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Event ID',
|
|
34
|
+
name: 'eventId',
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '={{ $json.eventId }}',
|
|
37
|
+
required: true,
|
|
38
|
+
displayOptions: { show: { operation: ['schedule'] } },
|
|
39
|
+
description: 'Analytics event to replay; defaults to the upstream event item',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Schedule',
|
|
43
|
+
name: 'schedule',
|
|
44
|
+
type: 'string',
|
|
45
|
+
typeOptions: { multipleValues: true },
|
|
46
|
+
default: ['1d', '2d', '3d'],
|
|
47
|
+
required: true,
|
|
48
|
+
displayOptions: { show: { operation: ['schedule'] } },
|
|
49
|
+
placeholder: '1d',
|
|
50
|
+
description: 'Offsets from now to re-send the event (e.g. 1d, 12h, 30m, 45s)',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Replay Schedule ID',
|
|
54
|
+
name: 'replayScheduleId',
|
|
55
|
+
type: 'string',
|
|
56
|
+
default: '={{ $json.delivery.replayScheduleId }}',
|
|
57
|
+
required: true,
|
|
58
|
+
displayOptions: { show: { operation: ['cancel', 'getStatus'] } },
|
|
59
|
+
description: 'Replay schedule to act on; defaults to the upstream replayed event',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async execute() {
|
|
65
|
+
const items = this.getInputData();
|
|
66
|
+
const returnData = [];
|
|
67
|
+
const credentials = await this.getCredentials('befrooshAnalyticsApi');
|
|
68
|
+
const baseUrl = String(credentials.baseUrl || '').replace(/\/+$/, '');
|
|
69
|
+
const apiKey = credentials.apiKey;
|
|
70
|
+
// Misconfigured credential fields are operator errors. Respect Continue-On-Fail so a
|
|
71
|
+
// replay-deferred deployment (blank baseUrl/apiKey) degrades gracefully instead of
|
|
72
|
+
// erroring every execution; otherwise fail loudly so it surfaces in the editor.
|
|
73
|
+
if (!baseUrl || !apiKey) {
|
|
74
|
+
const message = !baseUrl
|
|
75
|
+
? 'Base URL is not configured on the befrooshAnalyticsApi credential'
|
|
76
|
+
: 'Replay API Key is not configured on the befrooshAnalyticsApi credential';
|
|
77
|
+
if (this.continueOnFail()) {
|
|
78
|
+
return [
|
|
79
|
+
items.map((_, i) => ({
|
|
80
|
+
json: { success: false, operation: 'skipped', error: message },
|
|
81
|
+
pairedItem: { item: i },
|
|
82
|
+
})),
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), message);
|
|
86
|
+
}
|
|
87
|
+
for (let i = 0; i < items.length; i++) {
|
|
88
|
+
const operation = this.getNodeParameter('operation', i);
|
|
89
|
+
try {
|
|
90
|
+
let method = 'GET';
|
|
91
|
+
let url = '';
|
|
92
|
+
let body;
|
|
93
|
+
if (operation === 'schedule') {
|
|
94
|
+
const eventId = this.getNodeParameter('eventId', i).trim();
|
|
95
|
+
const schedule = this.getNodeParameter('schedule', i);
|
|
96
|
+
if (!eventId) {
|
|
97
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Event ID is required', { itemIndex: i });
|
|
98
|
+
}
|
|
99
|
+
method = 'POST';
|
|
100
|
+
url = `${baseUrl}/analytics/replays`;
|
|
101
|
+
body = { eventId, schedule };
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const id = this.getNodeParameter('replayScheduleId', i).trim();
|
|
105
|
+
if (!id) {
|
|
106
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Replay Schedule ID is required', {
|
|
107
|
+
itemIndex: i,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
method = operation === 'cancel' ? 'DELETE' : 'GET';
|
|
111
|
+
url = `${baseUrl}/analytics/replays/${encodeURIComponent(id)}`;
|
|
112
|
+
}
|
|
113
|
+
const apiRes = (await this.helpers.httpRequest({
|
|
114
|
+
method,
|
|
115
|
+
url,
|
|
116
|
+
headers: { Authorization: `Bearer ${apiKey}`, Accept: 'application/json' },
|
|
117
|
+
body,
|
|
118
|
+
json: true,
|
|
119
|
+
returnFullResponse: true,
|
|
120
|
+
ignoreHttpStatusErrors: true,
|
|
121
|
+
}));
|
|
122
|
+
if (apiRes.statusCode >= 400) {
|
|
123
|
+
const b = apiRes.body;
|
|
124
|
+
const code = (b && b.code) || `HTTP_${apiRes.statusCode}`;
|
|
125
|
+
if (this.continueOnFail()) {
|
|
126
|
+
returnData.push({
|
|
127
|
+
json: { success: false, operation, statusCode: apiRes.statusCode, code, response: b },
|
|
128
|
+
pairedItem: { item: i },
|
|
129
|
+
});
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
133
|
+
operation,
|
|
134
|
+
statusCode: apiRes.statusCode,
|
|
135
|
+
body: apiRes.body,
|
|
136
|
+
}, {
|
|
137
|
+
httpCode: String(apiRes.statusCode),
|
|
138
|
+
message: `Replay ${operation} failed (HTTP ${apiRes.statusCode}): ${code}`,
|
|
139
|
+
description: typeof apiRes.body === 'string' ? apiRes.body : JSON.stringify(apiRes.body),
|
|
140
|
+
itemIndex: i,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
returnData.push({
|
|
144
|
+
json: {
|
|
145
|
+
success: true,
|
|
146
|
+
operation,
|
|
147
|
+
statusCode: apiRes.statusCode,
|
|
148
|
+
response: apiRes.body,
|
|
149
|
+
},
|
|
150
|
+
pairedItem: { item: i },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (this.continueOnFail()) {
|
|
155
|
+
const e = error;
|
|
156
|
+
returnData.push({
|
|
157
|
+
json: { success: false, operation, error: e.message },
|
|
158
|
+
pairedItem: { item: i },
|
|
159
|
+
});
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return [returnData];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.BefrooshReplay = BefrooshReplay;
|
|
169
|
+
//# sourceMappingURL=BefrooshReplay.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BefrooshReplay.node.js","sourceRoot":"","sources":["../../../nodes/BefrooshReplay/BefrooshReplay.node.ts"],"names":[],"mappings":";;;AAAA,+CAWsB;AAItB,MAAa,cAAc;IAA3B;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,gCAAgC;YAC1C,WAAW,EAAE,+DAA+D;YAC5E,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;YACrC,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC/D,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,UAAU;oBACnB,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,+BAA+B,EAAE;wBACvF,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,2BAA2B,EAAE;wBAC/E,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,8BAA8B,E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,KAAc,CAAC;oBACzB,UAAU,CAAC,IAAI,CAAC;wBACd,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;wBACrD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACxB,CAAC,CAAC;oBACH,SAAS;gBACX,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;CACF;AA1KD,wCA0KC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><rect width="24" height="24" rx="5" fill="#6366f1"/><path d="M7 12a5 5 0 1 1 1.6 3.7" fill="none" stroke="#fff" stroke-width="2.1" stroke-linecap="round"/><path d="M7 8.5V12h3.5" fill="none" stroke="#fff" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
@@ -145,9 +145,7 @@ class BefrooshSms {
|
|
|
145
145
|
const operation = this.getNodeParameter('operation', i);
|
|
146
146
|
const to = this.getNodeParameter('to', i).trim();
|
|
147
147
|
try {
|
|
148
|
-
const message = operation === 'sendMessage'
|
|
149
|
-
? this.getNodeParameter('message', i)
|
|
150
|
-
: '';
|
|
148
|
+
const message = operation === 'sendMessage' ? this.getNodeParameter('message', i) : '';
|
|
151
149
|
const otpCode = operation === 'sendOtp' ? this.getNodeParameter('otpCode', i) : '';
|
|
152
150
|
let result;
|
|
153
151
|
if (provider === 'notrika') {
|
|
@@ -164,9 +162,7 @@ class BefrooshSms {
|
|
|
164
162
|
body: {
|
|
165
163
|
senderNumber: c.senderNumber,
|
|
166
164
|
recipientNumber: to,
|
|
167
|
-
templateId: isOtp
|
|
168
|
-
? c.otpTemplateId
|
|
169
|
-
: c.messageTemplateId,
|
|
165
|
+
templateId: isOtp ? c.otpTemplateId : c.messageTemplateId,
|
|
170
166
|
parameters: isOtp
|
|
171
167
|
? [{ name: 'code', value: otpCode }]
|
|
172
168
|
: [{ name: 'message', value: message }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BefrooshSms.node.js","sourceRoot":"","sources":["../../../nodes/BefrooshSms/BefrooshSms.node.ts"],"names":[],"mappings":";;;AAAA,+CAWsB;AAQtB,qFAAqF;AACrF,SAAS,YAAY,CAAC,GAAW;
|
|
1
|
+
{"version":3,"file":"BefrooshSms.node.js","sourceRoot":"","sources":["../../../nodes/BefrooshSms/BefrooshSms.node.ts"],"names":[],"mappings":";;;AAAA,+CAWsB;AAQtB,qFAAqF;AACrF,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG;SACP,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED,6EAA6E;AAC7E,SAAS,YAAY,CAAC,IAAa;IACjC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,uBAAuB,CAAC;IACvF,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,WAAW,CACxB,GAAsB,EACtB,QAAgB,EAChB,IAAY,EACZ,OAA4B,EAC5B,SAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC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Befroosh custom n8n nodes (SMS providers,
|
|
5
|
+
"description": "Befroosh custom n8n nodes (SMS providers, analytics webhook trigger, event replay)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"author": "Befroosh",
|
|
8
|
-
"keywords": [
|
|
8
|
+
"keywords": [
|
|
9
|
+
"n8n",
|
|
10
|
+
"n8n-community-node-package",
|
|
11
|
+
"sms",
|
|
12
|
+
"analytics",
|
|
13
|
+
"webhook"
|
|
14
|
+
],
|
|
9
15
|
"engines": {
|
|
10
16
|
"node": ">=18"
|
|
11
17
|
},
|
|
@@ -17,7 +23,10 @@
|
|
|
17
23
|
"build": "rm -rf dist && tsc && node scripts/copy-icons.mjs",
|
|
18
24
|
"dev": "tsc --watch",
|
|
19
25
|
"check-types": "tsc --noEmit",
|
|
20
|
-
"
|
|
26
|
+
"send-test": "node scripts/send-test-event.mjs",
|
|
27
|
+
"test": "node --test lib/signature.test.ts scripts/send-test-event.test.ts",
|
|
28
|
+
"lint": "eslint .",
|
|
29
|
+
"lint:fix": "eslint . --fix",
|
|
21
30
|
"prepublishOnly": "npm run build"
|
|
22
31
|
},
|
|
23
32
|
"n8n": {
|
|
@@ -26,17 +35,28 @@
|
|
|
26
35
|
"dist/credentials/NotrikaSmsApi.credentials.js",
|
|
27
36
|
"dist/credentials/BatabjamSmsApi.credentials.js",
|
|
28
37
|
"dist/credentials/MeliPayamakSmsApi.credentials.js",
|
|
29
|
-
"dist/credentials/BatabjamAboardSmsApi.credentials.js"
|
|
38
|
+
"dist/credentials/BatabjamAboardSmsApi.credentials.js",
|
|
39
|
+
"dist/credentials/BefrooshAnalyticsApi.credentials.js"
|
|
30
40
|
],
|
|
31
41
|
"nodes": [
|
|
32
|
-
"dist/nodes/BefrooshSms/BefrooshSms.node.js"
|
|
42
|
+
"dist/nodes/BefrooshSms/BefrooshSms.node.js",
|
|
43
|
+
"dist/nodes/BefrooshAnalyticsTrigger/BefrooshAnalyticsTrigger.node.js",
|
|
44
|
+
"dist/nodes/BefrooshReplay/BefrooshReplay.node.js",
|
|
45
|
+
"dist/nodes/BefrooshAssignAction/BefrooshAssignAction.node.js"
|
|
33
46
|
]
|
|
34
47
|
},
|
|
35
|
-
"files": [
|
|
48
|
+
"files": [
|
|
49
|
+
"dist"
|
|
50
|
+
],
|
|
36
51
|
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.31.0",
|
|
37
53
|
"@types/node": "^20.11.0",
|
|
54
|
+
"eslint": "^9.31.0",
|
|
55
|
+
"eslint-config-prettier": "^10.1.5",
|
|
56
|
+
"globals": "^16.2.0",
|
|
38
57
|
"n8n-workflow": "*",
|
|
39
|
-
"typescript": "5.8.2"
|
|
58
|
+
"typescript": "5.8.2",
|
|
59
|
+
"typescript-eslint": "^8.35.0"
|
|
40
60
|
},
|
|
41
61
|
"peerDependencies": {
|
|
42
62
|
"n8n-workflow": "*"
|