@lovable.dev/email-js 0.0.3 → 0.0.4

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.
Files changed (2) hide show
  1. package/README.md +28 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,6 +10,11 @@ npm install @lovable.dev/email-js
10
10
 
11
11
  ## Usage
12
12
 
13
+ ### Sending with a `run_id` (build-context emails)
14
+
15
+ When sending from a webhook where a build run exists, pass the `run_id` from
16
+ the payload. You can override the idempotency key (defaults to `run_id`).
17
+
13
18
  ```ts
14
19
  import { parseEmailWebhookPayload, sendLovableEmail } from "@lovable.dev/email-js";
15
20
  import { verifyWebhookRequest, type EmailWebhookPayload } from "@lovable.dev/webhooks-js";
@@ -50,4 +55,26 @@ export async function handleWebhook(req: Request) {
50
55
  }
51
56
  ```
52
57
 
53
- You can also override the idempotency key (defaults to `run_id`).
58
+ ### Sending without a `run_id` (runtime-triggered emails)
59
+
60
+ For transactional emails sent outside a build context (e.g., webhook handlers,
61
+ admin actions, database triggers), `run_id` is not required. Provide an
62
+ `idempotency_key` with `purpose: "transactional"` and the API creates a
63
+ transactional run automatically:
64
+
65
+ ```ts
66
+ await sendLovableEmail(
67
+ {
68
+ to: "user@example.com",
69
+ from: "App <noreply@notify.example.com>",
70
+ sender_domain: "notify.example.com",
71
+ subject: "Your request was approved",
72
+ html: "<p>Approved!</p>",
73
+ text: "Approved!",
74
+ purpose: "transactional",
75
+ idempotency_key: `approval-${requestId}`,
76
+ unsubscribe_token: token,
77
+ },
78
+ { apiKey },
79
+ );
80
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/email-js",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Lovable Email JS",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",