Repository navigation
Releases: tilli-pro/nudge.js
Releases · tilli-pro/nudge.js
Release list
v0.2.0
Minor Changes
-
31dc3ed: First release under the name
@tilli.dev/nudge.js; 0.1.0 was published as@tilli-pro/nudge.js.Breaking changes from 0.1.0:
createSendClient({ apiKey, baseUrl })becomescreateNudgeClient({ apiKey, baseUrl? });
baseUrlis the API root ending in/api, and the routes are appended.createClient({ apiKey, baseUrl, authCredentials })andlistNudges()are removed: the
client uses an API key only.send({ nudgeId, recipient: { email }, mergeTags })becomessendByTemplate({ externalRef, channel, to: { email }, mergeTags }); a nudge without an external ref gets one in the portal.recipient.nameis removed: Nudge has no recipient-name field, andtoNamewas always
dropped. Pass a merge tag the template uses.mergeTagsis aRecord<string, string>only; theMergeTag[]form is removed.options.cc,options.bccandfilesare removed;filesnever sent base64 on Node 16
and later.- A failure no longer resolves
{ success: false, error }; it rejects withNudgeError, and
a success resolves{ accepted: true, notificationLogId }. - Email only becomes
channel: "email" | "sms". - A new
idempotencyKeyreplaces the absence of any idempotency. - The CommonJS output under
"type": "module"that was committed becomes an ESM build that is
published only and never committed. - The warning printed by
createClientand the errors logged bylistNudgesare gone: the
package is silent. - The exports
MergeTag,EmailRecipient,NudgeSendOpts,NudgeSendResult,
NudgeSendClient,sendNudge,ClientCreationOpts,AnyFunctionandUnwrapPromiseare
removed; the new names replace them.
Migration:
- Create one client per API key at module scope:
createNudgeClient({ apiKey, baseUrl }). baseUrlis the API root and ends in/api(productionhttps://app.nudge.net/api, the
default; staginghttps://staging.nudge.net/api; QAhttps://qa.nudge.net/api). If
your configuration holds the host only, pass${host}/api; never pass the host alone:
the SDK does not add/api.- Replace each request to
.../Nudge/Sendwithawait client.sendByTemplate({ externalRef, channel, to, mergeTags, idempotencyKey }): one call per channel, with the merge tags as a
record. - Build the idempotency key from what makes the delivery unique across the whole Nudge account.
- A caller that put
RecipientIdin its merge tags passesrecipientIdinstead. - A caller of Nudge's v1 Send moves to v2 by the same change; v2 looks the template up per
channel. - Replace an
if (!result.success)check withtry/catchonNudgeError, branch oncode,
and logcodeandstatus, never the input. - A raw
GetNotificationDetailsread becomes
client.stats.details({ channel, notificationLogId }). - Stats reads pass wall time
YYYY-MM-DDTHH:mm:ssplustimeZone, nottoISOString(). - In tests, pass
transport: createFakeTransport({ templates })with your own catalogue.
v0.1.0
This is a preview release of the nudge.js client SDK.
The following functionality is currently supported:
| Feature | Send | Base |
|---|---|---|
| Real-time send | ✅ | ✅ |
| List Email Nudges | ❌ | ✅ |
The send client may ultimately be limited to only being able to send real-time transactional email. The team is currently evaluating whether the send client should also be able to retrieve sent nudge logs or query for the existing nudge templates on an account.