UNPKG

@trycourier/courier-js

Version:

A browser-safe API wrapper

41 lines (40 loc) 1.75 kB
import { CourierTrackingEvent } from '../types/tracking-event'; import { Client } from './client'; export declare class TrackingClient extends Client { /** * @deprecated This method is deprecated and will be removed or changed significantly in a future release. * * Post an inbound courier event. This is typically used for tracking custom events * related to a specific message in Courier. * * @param props - The event properties object containing: * - `clientKey`: The client key associated with your Courier project. * You can get your client key here: https://app.courier.com/settings/api-keys * - `event`: The name of the event (e.g., "New Order Placed"). * - `messageId`: The unique ID of the message this event relates to. * - `type`: The type of event. Only supported value: "track". * - `properties`: (Optional) Additional custom properties for the event. * @returns Promise resolving to an object containing the messageId. * @see https://www.courier.com/docs/api-reference/inbound/courier-track-event */ postInboundCourier(props: { clientKey: string; event: string; messageId: string; type: 'track'; properties?: Record<string, any>; }): Promise<{ messageId: string; }>; /** * Post a tracking URL event * These urls are found in messages sent from Courier * @param url - The URL to post the event to * @param event - The event type: Available options: "click", "open", "unsubscribe" * @returns Promise resolving when the event is posted */ postTrackingUrl(props: { url: string; event: CourierTrackingEvent; }): Promise<void>; }