@bentonow/bento-node-sdk 0.1.13 → 0.2.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 +39 -2
- package/dist/bento-node-sdk.cjs.development.js +321 -332
- package/dist/bento-node-sdk.cjs.development.js.map +1 -1
- package/dist/bento-node-sdk.cjs.production.min.js +1 -1
- package/dist/bento-node-sdk.cjs.production.min.js.map +1 -1
- package/dist/bento-node-sdk.esm.js +321 -332
- package/dist/bento-node-sdk.esm.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/sdk/batch/errors.d.ts +10 -0
- package/dist/sdk/batch/events.d.ts +71 -0
- package/dist/sdk/batch/index.d.ts +19 -3
- package/dist/sdk/batch/types.d.ts +37 -0
- package/dist/sdk/client/errors.d.ts +2 -0
- package/dist/sdk/client/index.d.ts +3 -3
- package/dist/sdk/client/types.d.ts +3 -0
- package/dist/sdk/commands/index.d.ts +3 -3
- package/dist/sdk/commands/types.d.ts +32 -0
- package/dist/sdk/experimental/index.d.ts +3 -3
- package/dist/sdk/experimental/types.d.ts +41 -0
- package/dist/sdk/fields/index.d.ts +2 -2
- package/dist/sdk/fields/types.d.ts +17 -0
- package/dist/sdk/forms/index.d.ts +2 -2
- package/dist/sdk/forms/types.d.ts +28 -0
- package/dist/sdk/interfaces.d.ts +13 -0
- package/dist/sdk/subscribers/index.d.ts +2 -2
- package/dist/sdk/subscribers/types.d.ts +25 -0
- package/dist/sdk/tags/index.d.ts +2 -2
- package/dist/sdk/tags/types.d.ts +17 -0
- package/dist/sdk/types.d.ts +41 -0
- package/dist/versions/v1/index.d.ts +4 -4
- package/dist/versions/v1/types.d.ts +31 -0
- package/package.json +5 -9
- package/src/index.ts +2 -2
- package/src/sdk/batch/errors.ts +41 -4
- package/src/sdk/batch/{events.d.ts → events.ts} +4 -5
- package/src/sdk/batch/index.ts +75 -46
- package/src/sdk/batch/types.ts +44 -0
- package/src/sdk/client/errors.ts +13 -2
- package/src/sdk/client/index.ts +21 -15
- package/src/sdk/client/{types.d.ts → types.ts} +0 -0
- package/src/sdk/commands/index.ts +93 -121
- package/src/sdk/commands/{types.d.ts → types.ts} +1 -1
- package/src/sdk/experimental/index.ts +29 -45
- package/src/sdk/experimental/{types.d.ts → types.ts} +1 -1
- package/src/sdk/fields/index.ts +11 -19
- package/src/sdk/fields/{types.d.ts → types.ts} +1 -1
- package/src/sdk/forms/index.ts +11 -15
- package/src/sdk/forms/{types.d.ts → types.ts} +3 -3
- package/src/sdk/{interfaces.d.ts → interfaces.ts} +0 -0
- package/src/sdk/subscribers/index.ts +17 -25
- package/src/sdk/subscribers/{types.d.ts → types.ts} +1 -1
- package/src/sdk/tags/index.ts +11 -19
- package/src/sdk/tags/{types.d.ts → types.ts} +1 -1
- package/src/sdk/{types.d.ts → types.ts} +2 -0
- package/src/versions/v1/index.ts +65 -86
- package/src/versions/v1/{types.d.ts → types.ts} +4 -2
- package/src/sdk/batch/types.d.ts +0 -25
package/README.md
CHANGED
|
@@ -270,6 +270,10 @@ Reference Types: [TrackParameters<S, E>](#trackparametersse)
|
|
|
270
270
|
bento.V1.track({
|
|
271
271
|
email: 'test@bentonow.com',
|
|
272
272
|
type: '$custom.event',
|
|
273
|
+
fields: {
|
|
274
|
+
firstName: 'Custom Name',
|
|
275
|
+
lastName: 'Custom Name',
|
|
276
|
+
},
|
|
273
277
|
details: {
|
|
274
278
|
fromCustomEvent: true,
|
|
275
279
|
},
|
|
@@ -282,7 +286,7 @@ bento.V1.track({
|
|
|
282
286
|
|
|
283
287
|
### `Batch.importSubscribers(parameters: BatchImportSubscribersParameter<S>): Promise<number>`
|
|
284
288
|
|
|
285
|
-
**This does not trigger automations!** - If you wish to trigger automations, please batch import events
|
|
289
|
+
**This does not trigger automations!** - If you wish to trigger automations, please batch import events.
|
|
286
290
|
|
|
287
291
|
Creates a batch job to import subscribers into the system. You can pass in between 1 and 1,000 subscribers to import. Each subscriber must have an email, and may optionally have any additional fields. The additional fields are added as custom fields on the subscriber.
|
|
288
292
|
|
|
@@ -301,6 +305,8 @@ bento.V1.Batch.importSubscribers({
|
|
|
301
305
|
},
|
|
302
306
|
{
|
|
303
307
|
email: 'test2@bentonow.com',
|
|
308
|
+
some_custom_variable: 'tester-123',
|
|
309
|
+
primary_user: true,
|
|
304
310
|
},
|
|
305
311
|
{
|
|
306
312
|
email: 'test3@bentonow.com',
|
|
@@ -316,7 +322,7 @@ bento.V1.Batch.importSubscribers({
|
|
|
316
322
|
|
|
317
323
|
### `Batch.importEvents(parameters: BatchImportEventsParameter<S, E>): Promise<number>`
|
|
318
324
|
|
|
319
|
-
Creates a batch job to import events into the system. You can pass in between 1 and
|
|
325
|
+
Creates a batch job to import events into the system. You can pass in between 1 and 100 events to import. Each event must have an email and a type. In addition to this, you my pass in additional data in the `details` property,
|
|
320
326
|
|
|
321
327
|
Returns the number of events that were imported.
|
|
322
328
|
|
|
@@ -360,6 +366,37 @@ bento.V1.Batch.importEvents({
|
|
|
360
366
|
.catch(error => console.error(error));
|
|
361
367
|
```
|
|
362
368
|
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
### `Batch.sendTransactionalEmails(parameters: BatchsendTransactionalEmailsParameter<S, E>): Promise<number>`
|
|
372
|
+
|
|
373
|
+
Creates a batch job to send transactional emails from Bento's infrastructure. You can pass in between 1 and 100 emails to send. Each email must have a `to` address, a `from` address, a `subject`, an `html_body` and `transactional: true`.
|
|
374
|
+
|
|
375
|
+
In addition you can add a `personalizations` object to provide liquid tags that will be injected into the email.
|
|
376
|
+
|
|
377
|
+
Requests are instant and queued into a priority queue. Most requests will be processed within 30 seconds. We currently limit this endpoint to 60 emails per minute.
|
|
378
|
+
|
|
379
|
+
Returns the number of emails that were imported.
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
bento.V1.Batch.sendTransactionalEmails({
|
|
383
|
+
emails: [
|
|
384
|
+
{
|
|
385
|
+
to: 'test@bentonow.com', // required — if no user with this email exists in your account they will be created.
|
|
386
|
+
from: 'jesse@bentonow.com', // required — must be an email author in your account.
|
|
387
|
+
subject: 'Reset Password', // required
|
|
388
|
+
html_body: '<p>Here is a link to reset your password ... {{ link }}</p>', // required - can also use text_body if you want to use our plain text theme.
|
|
389
|
+
transactional: true, // IMPORTANT — this bypasses the subscription status of a user. Abuse will lead to account shutdown.
|
|
390
|
+
personalizations: {
|
|
391
|
+
link: 'https://example.com/test',
|
|
392
|
+
}, // optional — provide your own Liquid tags to be injected into the email.
|
|
393
|
+
},
|
|
394
|
+
],
|
|
395
|
+
})
|
|
396
|
+
.then(result => console.log(result))
|
|
397
|
+
.catch(error => console.error(error));
|
|
398
|
+
```
|
|
399
|
+
|
|
363
400
|
## Commands
|
|
364
401
|
|
|
365
402
|
### `Commands.addTag(parameters: AddTagParameters): Promise<Subscriber<S> | null>`
|