Types
TypeScript types exported from the noketa package
The noketa package exports the client and all request/response types from the root module. Use them for type-safe requests and responses.
Exports
import {
Noketa,
type ContactAttributes,
type CreateContactRequest,
type CreateContactResponse,
type NoketaApiResponse,
type SendEmailRequest,
type SendEmailResponse,
type TrackEventRequest,
type TrackEventResponse,
} from "noketa";Legacy names ProfileAttributes, CreateProfileRequest, and CreateProfileResponse are still exported for compatibility; prefer the Contact* types.
ContactAttributes
Used in Contacts for attributes. Supports known optional fields and arbitrary custom keys:
| Field | Type | Description |
|---|---|---|
first_name | string? | Given name |
last_name | string? | Family name |
locale | string? | Locale code (e.g. en, en-US) |
gender | string? | Gender |
age | number? | Age |
birthdate | Date? | Birth date |
external_id | string? | Your system’s user ID |
last_event_date | Date? | Last activity date |
properties | Record<string, unknown>? | Custom key-value data |
[key: string] | unknown | Additional custom fields |
API responses
CreateContactResponse is the typed shape returned by contacts.create:
type CreateContactResponse = {
message: string;
contactId: string;
action?: "created" | "updated";
};SendEmailRequest is used by Emails:
type SendEmailRequest = {
from: string;
to: string | string[];
subject: string;
html?: string;
text?: string;
replyTo?: string | string[];
/** Defaults to `true`. Set `false` to skip open/click tracking. */
tracking?: boolean;
unsubscribeUrl?: string;
unsubscribeOneClick?: boolean;
};SendEmailResponse uses the broader NoketaApiResponse:
type NoketaApiResponse = {
message?: string;
[key: string]: unknown;
};Use NoketaApiResponse when you need to access extra fields returned by the API.
TrackEventRequest is used by Events and Automations:
type TrackEventRequest = {
event: string;
email?: string;
contactId?: string;
attributes?: ContactAttributes;
metadata?: Record<string, unknown>;
};TrackEventResponse describes the automation dispatch result:
type TrackEventResponse = {
message: string;
eventId: string | null;
contactId: string;
contactAction: "matched" | "created" | "updated";
triggered: number;
completedWaitpoints: number;
failed?: number;
};