diff --git a/README.md b/README.md index cd74083..f3ddff2 100644 --- a/README.md +++ b/README.md @@ -621,17 +621,17 @@ Send a transactional email to a contact. [Learn about sending transactional emai #### Parameters -| Name | Type | Required | Notes | -| --------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `transactionalId` | string | Yes | The ID of the transactional email to send. | -| `email` | string | Yes | The email address of the recipient. | -| `addToAudience` | boolean | No | If `true`, a contact will be created in your audience using the `email` value (if a matching contact doesn’t already exist). | -| `dataVariables` | object | No | An object containing data as defined by the data variables added to the transactional email template.
Values can be of type `string` or `number`. | -| `attachments` | object[] | No | A list of attachments objects.
**Please note**: Attachments need to be enabled on your account before using them with the API. [Read more](https://loops.so/docs/transactional/attachments) | -| `attachments[].filename` | string | No | The name of the file, shown in email clients. | -| `attachments[].contentType` | string | No | The MIME type of the file. | -| `attachments[].data` | string | No | The base64-encoded content of the file. | -| `headers` | object | No | Additional headers to send with the request. | +| Name | Type | Required | Notes | +| --------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `transactionalId` | string | Yes | The ID of the transactional email to send. | +| `email` | string | Yes | The email address of the recipient. | +| `addToAudience` | boolean | No | If `true`, a contact will be created in your audience using the `email` value (if a matching contact doesn’t already exist). | +| `dataVariables` | object | No | An object containing data as defined by the data variables added to the transactional email template.
Values can be of type `string`, `number`, or an array of objects with `string` or `number` values. | +| `attachments` | object[] | No | A list of attachments objects.
**Please note**: Attachments need to be enabled on your account before using them with the API. [Read more](https://loops.so/docs/transactional/attachments) | +| `attachments[].filename` | string | No | The name of the file, shown in email clients. | +| `attachments[].contentType` | string | No | The MIME type of the file. | +| `attachments[].data` | string | No | The base64-encoded content of the file. | +| `headers` | object | No | Additional headers to send with the request. | #### Examples @@ -770,7 +770,8 @@ const resp = await loops.getTransactionalEmails({ perPage: 15 }); ## Version history -- `v6.1.0` (Jan 29, 2026) - Added `rawBody` to `APIError` in the case no JSON is received from the server (thanks to [@leipert](https://github.com/leipert)). +- `v6.2.0` (Feb 9, 2026) - Support for the new arrays feature in sendTransactionalEmail. +- `v6.1.2` (Jan 29, 2026) - Added `rawBody` to `APIError` in the case no JSON is received from the server (thanks to [@leipert](https://github.com/leipert)). - `v6.0.1` (Oct 15, 2025) - Added `optInStatus` to contact object in [`findContact()`](#findcontact) for the new double opt-in feature. - `v6.0.0` (Aug 22, 2025) - [`createContact()`](#createcontact) and [`updateContact()`](#updatecontact) now have a single object parameter instead of named parameters (breaking change). This allows support for using either `email` or `userId` when updating contacts. - `v5.0.1` (May 13, 2025) - Added a `headers` parameter for [`sendEvent()`](#sendevent) and [`sendTransactionalEmail()`](#sendtransactionalemail), enabling support for the `Idempotency-Key` header. diff --git a/package-lock.json b/package-lock.json index 6a7bc53..3accb3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "loops", - "version": "6.1.2", + "version": "6.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "loops", - "version": "6.1.2", + "version": "6.2.0", "license": "MIT", "devDependencies": { "@types/jest": "^29.5.12", diff --git a/package.json b/package.json index 6e6b758..e0fa840 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loops", - "version": "6.1.2", + "version": "6.2.0", "author": "Dan Rowden ", "license": "MIT", "main": "./dist/index.cjs", diff --git a/src/__tests__/LoopsClient.test.ts b/src/__tests__/LoopsClient.test.ts index c6d75f1..61d2cd1 100644 --- a/src/__tests__/LoopsClient.test.ts +++ b/src/__tests__/LoopsClient.test.ts @@ -499,7 +499,10 @@ describe("LoopsClient", () => { email: "test@example.com", dataVariables: { name: "John", - product: "Widgets", + products: [ + { name: "Widget", price: 29.99 }, + { name: "Gadget", price: 49.99 }, + ], }, }; const mockResponse = { success: true }; diff --git a/src/index.ts b/src/index.ts index f65e617..4c6e622 100644 --- a/src/index.ts +++ b/src/index.ts @@ -111,7 +111,10 @@ type EventProperties = Record; type MailingLists = Record; -type TransactionalVariables = Record; +type TransactionalVariables = Record< + string, + string | number | Array> +>; interface TransactionalAttachment { /**