Skip to content

feat: add traits to Events API and update transactional response type#16

Merged
ferreiro merged 2 commits intomainfrom
add-traits
Sep 29, 2025
Merged

feat: add traits to Events API and update transactional response type#16
ferreiro merged 2 commits intomainfrom
add-traits

Conversation

@ferreiro
Copy link
Copy Markdown
Contributor

@ferreiro ferreiro commented Sep 29, 2025

we now support traits to our Events API!

IT'S MAGIC!! You can pass things like firstName, lastName, etc... and we'll create the user with those properties if you are sending an event for a user that wasn't in your CRM before.

on top, updating our transactional email response, we don't longer pass the original message to save on API bandwith (and because wasn't needed lol)


Note

Adds user traits support to Events API and BREAKING: simplifies transactional email send response types; bumps version to 1.16.0.

  • Interfaces:
    • Events API: Add EventTraits and EventIdentify; EventPayload.identify now uses EventIdentify and supports optional traits.
    • Transactional Email (BREAKING): Simplify RawEmailSendResponse and TemplatedEmailSendResponse to { messageId, status, to, warning?, groupBy? } (raw) and { messageId, status, to, warning? }; remove from, subject, type, template fields.
  • Changelog:
    • Document new contacts.deleteByEmail(email) endpoint integration and response shape.
    • Note BREAKING transactional response changes and tests alignment.
  • Release:
    • Bump package version to 1.16.0.

Written by Cursor Bugbot for commit 064da8a. This will update automatically on new commits. Configure here.

@ferreiro ferreiro changed the title feat: add traits to Events API and update transactional response time feat: add traits to Events API and update transactional response type Sep 29, 2025
@ferreiro ferreiro merged commit aec9ce5 into main Sep 29, 2025
2 checks passed
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: TypeScript Union Breaks Without Discriminator

Removing the type discriminator from RawEmailSendResponse and TemplatedEmailSendResponse prevents TypeScript from properly narrowing the TransactionalEmailSendResponse union. This makes it difficult for consumers to reliably distinguish between the two types, especially when the optional groupBy field is absent, and breaks existing type-guarding logic.

src/interfaces/types.ts#L121-L146

export interface RawEmailSendResponse {
/** Unique message identifier. */
messageId: string;
/** Delivery status. */
status: TransactionalEmailStatus;
/** Recipient address. */
to: string;
/** Warning returned by backend when the email is accepted with caveats. */
warning?: string;
/** Custom analytics group identifier if provided. */
groupBy?: string;
}
export interface TemplatedEmailSendResponse {
/** Unique message identifier. */
messageId: string;
/** Delivery status. */
status: TransactionalEmailStatus;
/** Recipient address. */
to: string;
/** Warning returned by backend when the email is accepted with caveats. */
warning?: string;
}
export type TransactionalEmailSendResponse = RawEmailSendResponse | TemplatedEmailSendResponse;

Fix in Cursor Fix in Web


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant