@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.
Files changed (57) hide show
  1. package/README.md +39 -2
  2. package/dist/bento-node-sdk.cjs.development.js +321 -332
  3. package/dist/bento-node-sdk.cjs.development.js.map +1 -1
  4. package/dist/bento-node-sdk.cjs.production.min.js +1 -1
  5. package/dist/bento-node-sdk.cjs.production.min.js.map +1 -1
  6. package/dist/bento-node-sdk.esm.js +321 -332
  7. package/dist/bento-node-sdk.esm.js.map +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/sdk/batch/errors.d.ts +10 -0
  10. package/dist/sdk/batch/events.d.ts +71 -0
  11. package/dist/sdk/batch/index.d.ts +19 -3
  12. package/dist/sdk/batch/types.d.ts +37 -0
  13. package/dist/sdk/client/errors.d.ts +2 -0
  14. package/dist/sdk/client/index.d.ts +3 -3
  15. package/dist/sdk/client/types.d.ts +3 -0
  16. package/dist/sdk/commands/index.d.ts +3 -3
  17. package/dist/sdk/commands/types.d.ts +32 -0
  18. package/dist/sdk/experimental/index.d.ts +3 -3
  19. package/dist/sdk/experimental/types.d.ts +41 -0
  20. package/dist/sdk/fields/index.d.ts +2 -2
  21. package/dist/sdk/fields/types.d.ts +17 -0
  22. package/dist/sdk/forms/index.d.ts +2 -2
  23. package/dist/sdk/forms/types.d.ts +28 -0
  24. package/dist/sdk/interfaces.d.ts +13 -0
  25. package/dist/sdk/subscribers/index.d.ts +2 -2
  26. package/dist/sdk/subscribers/types.d.ts +25 -0
  27. package/dist/sdk/tags/index.d.ts +2 -2
  28. package/dist/sdk/tags/types.d.ts +17 -0
  29. package/dist/sdk/types.d.ts +41 -0
  30. package/dist/versions/v1/index.d.ts +4 -4
  31. package/dist/versions/v1/types.d.ts +31 -0
  32. package/package.json +5 -9
  33. package/src/index.ts +2 -2
  34. package/src/sdk/batch/errors.ts +41 -4
  35. package/src/sdk/batch/{events.d.ts → events.ts} +4 -5
  36. package/src/sdk/batch/index.ts +75 -46
  37. package/src/sdk/batch/types.ts +44 -0
  38. package/src/sdk/client/errors.ts +13 -2
  39. package/src/sdk/client/index.ts +21 -15
  40. package/src/sdk/client/{types.d.ts → types.ts} +0 -0
  41. package/src/sdk/commands/index.ts +93 -121
  42. package/src/sdk/commands/{types.d.ts → types.ts} +1 -1
  43. package/src/sdk/experimental/index.ts +29 -45
  44. package/src/sdk/experimental/{types.d.ts → types.ts} +1 -1
  45. package/src/sdk/fields/index.ts +11 -19
  46. package/src/sdk/fields/{types.d.ts → types.ts} +1 -1
  47. package/src/sdk/forms/index.ts +11 -15
  48. package/src/sdk/forms/{types.d.ts → types.ts} +3 -3
  49. package/src/sdk/{interfaces.d.ts → interfaces.ts} +0 -0
  50. package/src/sdk/subscribers/index.ts +17 -25
  51. package/src/sdk/subscribers/{types.d.ts → types.ts} +1 -1
  52. package/src/sdk/tags/index.ts +11 -19
  53. package/src/sdk/tags/{types.d.ts → types.ts} +1 -1
  54. package/src/sdk/{types.d.ts → types.ts} +2 -0
  55. package/src/versions/v1/index.ts +65 -86
  56. package/src/versions/v1/{types.d.ts → types.ts} +4 -2
  57. 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 with the type set to `BentoEvents.SUBSCRIBE`, or `$subscribe`. Note that the batch event import cannot attach custom fields and will ignore everything except the email.
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 1,000 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,
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>`