flowflex 0.1.0 → 0.1.1
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 +5 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# flowflex
|
|
2
2
|
|
|
3
3
|
Official Node/browser SDK for firing **FlowFlex custom-integration events** and
|
|
4
4
|
attaching **private files** to them — without ever dealing with presigned URLs,
|
|
5
5
|
Basic-auth headers, or the multi-step upload dance yourself.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install flowflex
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Requires Node 18+ (for the built-in `fetch`) or any modern browser.
|
|
@@ -15,13 +15,13 @@ Requires Node 18+ (for the built-in `fetch`) or any modern browser.
|
|
|
15
15
|
## Quick start
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import { FlowFlex } from "
|
|
18
|
+
import { FlowFlex } from "flowflex";
|
|
19
19
|
|
|
20
20
|
const ff = new FlowFlex({
|
|
21
21
|
apiKey: "cik_xxx", // from your custom integration
|
|
22
22
|
apiSecret: "yyy",
|
|
23
23
|
integrationCode: "ic_abc123", // the code in your event URL: /v1/events/<code>
|
|
24
|
-
baseUrl: "https://
|
|
24
|
+
baseUrl: "https://api.flowflex.ai",
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
// Plain event, no file
|
|
@@ -173,7 +173,7 @@ All errors extend `FlowFlexError` (`{ message, status?, code?, details? }`):
|
|
|
173
173
|
e.g. `MIME_NOT_ALLOWED`, `ASSET_FILE_MISSING`).
|
|
174
174
|
|
|
175
175
|
```ts
|
|
176
|
-
import { FlowFlexError } from "
|
|
176
|
+
import { FlowFlexError } from "flowflex";
|
|
177
177
|
|
|
178
178
|
try {
|
|
179
179
|
await ff.sendEvent("invoice.created", { payload: { assetId: ff.file("./big.pdf") } });
|
|
@@ -267,18 +267,3 @@ Other protections built in:
|
|
|
267
267
|
|
|
268
268
|
If you must call FlowFlex from a browser, proxy through your own backend: the
|
|
269
269
|
browser talks to your server, your server holds the secret and calls this SDK.
|
|
270
|
-
|
|
271
|
-
## How it works
|
|
272
|
-
|
|
273
|
-
```
|
|
274
|
-
ff.sendEvent("invoice.created", { payload: { assetId: file("invoice.pdf") } })
|
|
275
|
-
│
|
|
276
|
-
├─ 1. POST /v1/assets/upload-url → { assetId, uploadUrl }
|
|
277
|
-
├─ 2. PUT <uploadUrl> (file bytes straight to private storage)
|
|
278
|
-
└─ 3. POST /v1/events/<code> with { assetId: "asset_…" }
|
|
279
|
-
│
|
|
280
|
-
└─ flow runs; media node resolves assetId → WhatsApp media at send time
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
The caller only ever holds the opaque `assetId`. There is no readable link to
|
|
284
|
-
the file — the backend resolves it server-side when the flow delivers the message.
|
package/package.json
CHANGED