Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **New Feature**: `contacts.deleteByEmail()` method for deleting contacts by email address
- Added `deleteByEmail(email: string)` method to Contacts API
- Properly handles URL encoding of email addresses with special characters
- Returns same response format as existing `delete()` method: `{ isDeleted: boolean, contact: Contact }`
- Added comprehensive tests and example usage
- Integrates with new SMASHSEND backend endpoint `/v1/contacts/by-email/{email}`

## [1.16.0] - 2025-01-21

### Changed

- **BREAKING**: Simplified transactional email response format to match backend API changes
- `RawEmailSendResponse` now returns: `{ messageId, status, to, warning?, groupBy? }`
- `TemplatedEmailSendResponse` now returns: `{ messageId, status, to, warning? }`
- Removed deprecated fields: `from`, `subject`, `type`, `template`, `created`, `statusCode`, `message`
- Updated all tests to use the new response format
- This change aligns the Node.js SDK with the simplified backend response schema

### Added

- **Dynamic Reply-To Addresses**: Added support for custom reply-to addresses in both raw and templated emails
- 📧 **Multiple addresses**: Support for up to 5 reply-to addresses per email
- 🔄 **Flexible input**: Accept single email string or array of email strings
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smashsend/node",
"version": "1.15.0",
"version": "1.16.0",
"description": "SMASHSEND Node.js SDK - Official Node.js client for SMASHSEND API",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
45 changes: 37 additions & 8 deletions src/interfaces/events.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,49 @@
// Events API types for SMASHSEND

/**
* User traits/attributes to sync with contact record
*/
export interface EventTraits {
[key: string]: any;
}

/**
* User identification information
*/
export interface EventIdentify {
/** User email address (required) */
email: string;
/**
* User traits/attributes to sync with contact record
* This is optional, and will be ignored if not provided.
**/
traits?: EventTraits;
}

/**
* Event tracking payload for single event
*/
export interface EventPayload {
/** Event name (alphanumeric, underscores, hyphens, dots, colons only) */
/**
* Event name (alphanumeric, underscores, hyphens, dots, colons only)
**/
event: string;
/** Event properties - key-value pairs with any data */

/**
* Event properties - key-value pairs with any data
**/
properties?: Record<string, any>;
/** User identification information */
identify: {
/** User email address (required) */
email: string;
};
/** Event timestamp (ISO string or Unix timestamp) */

/**
* User identification information
**/
identify: EventIdentify;

/**
* Event timestamp (ISO string or Unix timestamp)
**/
timestamp?: string | number;

/**
* Optional message ID for deduplication.
* If not provided, SMASHSEND will generate one automatically.
Expand Down
10 changes: 0 additions & 10 deletions src/interfaces/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ export interface RawEmailSendResponse {
status: TransactionalEmailStatus;
/** Recipient address. */
to: string;
/** Sender address. */
from: string;
/** Subject line. */
subject: string;
/** Discriminator – always `raw`. */
type: 'raw';
/** Warning returned by backend when the email is accepted with caveats. */
warning?: string;
/** Custom analytics group identifier if provided. */
Expand All @@ -145,10 +139,6 @@ export interface TemplatedEmailSendResponse {
status: TransactionalEmailStatus;
/** Recipient address. */
to: string;
/** Template identifier sent in the request. */
template: string;
/** Discriminator – always `templated`. */
type: 'templated';
/** Warning returned by backend when the email is accepted with caveats. */
warning?: string;
}
Expand Down