Skip to content

Commit 10cddf6

Browse files
committed
Added addToAudience parameter
1 parent 3687e3e commit 10cddf6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ Send a transactional email to a contact. [Learn about sending transactional emai
381381
| --------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
382382
| `transactionalId` | string | Yes | The ID of the transactional email to send. |
383383
| `email` | string | Yes | The email address of the recipient. |
384+
| `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). |
384385
| `dataVariables` | object | No | An object containing data as defined by the data variables added to the transactional email template.<br />Values can be of type `string` or `number`. |
385386
| `attachments` | object[] | No | A list of attachments objects.<br />**Please note**: Attachments need to be enabled on your account before using them with the API. [Read more](https://loops.so/docs/transactional/attachments) |
386387
| `attachments[].filename` | string | No | The name of the file, shown in email clients. |
@@ -489,6 +490,7 @@ If your account has no custom fields, an empty list will be returned.
489490

490491
## Version history
491492

493+
- `v2.2.0` (Jul 2, 2024) - Added new `addToAudience` option to [`sendTransactionalEmail()`](#sendtransactionalemail).
492494
- `v2.1.1` (Jun 20, 2024) - Added support for mailing lists in [`createContact()`](#createcontact), [`updateContact()`](#updatecontact) and [`sendEvent()`](#sendevent).
493495
- `v2.1.0` (Jun 19, 2024) - Added support for new [List mailing lists](#getmailinglists) endpoint.
494496
- `v2.0.0` (Apr 19, 2024)

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ class LoopsClient {
336336
*
337337
* @param {string} transactionalId The ID of the transactional email to send.
338338
* @param {string} email The email address of the recipient.
339+
* @param {boolean} [addToAudience] Create a contact in your audience using the provided email address (if one doesn't already exist).
339340
* @param {Object} [dataVariables] Data variables as defined by the transational email template.
341+
* @param {Object[]} [attachments] File(s) to be sent along with the email message.
340342
*
341343
* @see https://loops.so/docs/api-reference/send-transactional-email
342344
*
@@ -345,15 +347,17 @@ class LoopsClient {
345347
async sendTransactionalEmail(
346348
transactionalId: string,
347349
email: string,
350+
addToAudience?: boolean,
348351
dataVariables?: TransactionalVariables,
349352
attachments?: Array<TransactionalAttachment>
350353
): Promise<TransactionalResponse> {
351354
const payload: {
352355
transactionalId: string;
353356
email: string;
357+
addToAudience?: boolean;
354358
dataVariables?: TransactionalVariables;
355359
attachments?: Array<TransactionalAttachment>;
356-
} = { transactionalId, email };
360+
} = { transactionalId, email, addToAudience };
357361
if (dataVariables) payload["dataVariables"] = dataVariables;
358362
if (attachments) payload["attachments"] = attachments;
359363
return this._makeQuery({

0 commit comments

Comments
 (0)