### Install Postmark Node.js Library Source: https://github.com/activecampaign/postmark.js/blob/main/README.md Use this command to install the postmark javascript library. Ensure your Node.js version is v14.0.0 or higher. ```bash npm install postmark ``` -------------------------------- ### Attachment Content Example - Postmark.js Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/Models.Attachment.html Example of how to read file content and encode it to Base64 for the attachment. Ensure the file path is correct. ```javascript fs.readFileSync('/Folder/book.pdf').toString('base64') ``` -------------------------------- ### GET /api/client/options Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves client configuration options. ```APIDOC ## GET /api/client/options ### Description Get client configuration options. ### Method GET ### Endpoint /api/client/options ### Response #### Success Response (200) - **Configuration** - Client configuration details. #### Response Example ```json { "ApiUrl": "https://api.postmarkapp.com", "AccountApiKey": "YOUR_ACCOUNT_API_KEY", "ServerApiKey": "YOUR_SERVER_API_KEY" } ``` ``` -------------------------------- ### Get Webhook Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves details for a specific webhook configuration. ```APIDOC ## GET /webhooks/{id} ### Description Get details for a specific Webhook. ### Method GET ### Endpoint /webhooks/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the Webhook you wish to retrieve. ### Response #### Success Response (200) - **Webhook** (object) - The details of the specified webhook. #### Response Example { "example": "{\"id\": 1, \"url\": \"https://example.com/webhook\", \"events\": [\"Sent\", \"Delivery\"], \"enabled\": true}" } ``` -------------------------------- ### Get list of available templates Source: https://github.com/activecampaign/postmark.js/wiki/Templates Retrieves a list of all available templates on the Postmark server. ```APIDOC ## GET /templates ### Description Retrieves a list of all available templates. ### Method GET ### Endpoint /templates ### Parameters #### Query Parameters - **count** (integer) - Optional - The number of templates to return. - **offset** (integer) - Optional - The number of templates to skip. - **templateType** (string) - Optional - Filters templates by type ('Layout', 'Standard', 'All'). ### Response #### Success Response (200) - **Templates** (array) - An array of template objects. - **Name** (string) - The name of the template. - **TemplateId** (integer) - The unique identifier for the template. - **Active** (boolean) - Indicates if the template is active. ### Response Example ```json { "Templates": [ { "Name": "Example Template", "TemplateId": 12345, "Active": true } ] } ``` ``` -------------------------------- ### Get List of Servers Source: https://github.com/activecampaign/postmark.js/wiki/Servers Retrieves a list of all servers associated with your Postmark account. ```APIDOC ## Get List of Servers ### Description Retrieves a list of all servers associated with your Postmark account. ### Method GET ### Endpoint /servers ### Response #### Success Response (200) - **Servers** (array) - An array of server objects. - **ID** (integer) - The unique identifier of the server. - **Name** (string) - The name of the server. ### Response Example ```json { "Servers": [ { "ID": 1234567, "Name": "ServerOne" }, { "ID": 1234568, "Name": "ServerTwo" } ] } ``` ``` -------------------------------- ### GET /servers Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/AccountClient.html Retrieve a list of servers associated with your Postmark account. Supports filtering. ```APIDOC ## GET /servers ### Description Retrieve a list of Servers. Supports optional filtering. ### Method GET ### Endpoint /servers ### Parameters #### Query Parameters - **filter** (ServerFilteringParameters) - Optional - An optional filter for which data is retrieved. - **callback** (Callback) - Optional - If the callback is provided, it will be passed to the resulting promise as a continuation. ### Response #### Success Response (200) - **Servers** (Servers[]) - A list of server objects. ### Response Example ```json { "servers": [ { "ID": 123, "Name": "My Server", "ApiUrl": "https://api.postmarkapp.com/", "ContentServerUrl": "https://content.postmarkapp.com/", "SmtpApiUrl": "https://smtp.postmarkapp.com/", "AccountID": 456, "ServerID": 789, "Color": "blue" } ] } ``` ``` -------------------------------- ### Create Server Source: https://github.com/activecampaign/postmark.js/wiki/Servers Creates a new server within your Postmark account. ```APIDOC ## Create Server ### Description Creates a new server within your Postmark account. ### Method POST ### Endpoint /servers ### Parameters #### Request Body - **Name** (string) - Required - The desired name for the new server. ### Request Example ```javascript let postmark = require("postmark") const accountToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx" let accountClient = new postmark.AccountClient(accountToken); accountClient.createServer({Name: "ServerBlue"}).then(result => { console.log(result); }); ``` ### Response #### Success Response (200) - **ID** (integer) - The unique identifier of the newly created server. - **Name** (string) - The name of the newly created server. #### Response Example ```json { "ID": 1234568, "Name": "ServerBlue" } ``` ``` -------------------------------- ### Initialize Postmark.js v2.x Clients Source: https://github.com/activecampaign/postmark.js/wiki/Migrating-from-older-version This is the recommended initialization method for version 2.x and later of the Postmark.js library. It uses ServerClient and AccountClient. ```javascript let postmark = require("postmark"); let serverToken = "xxxxxx-xxxxxx-xxxxx-xxxxxx"; let accountToken = "yyyyyy-yyyyy-yyyyy-yyyyyy" let client = new postmark.ServerClient(serverToken); let accountClient = new postmark.AccountClient(accountToken); ``` -------------------------------- ### GET /Bounces Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves a batch of bounces. ```APIDOC ## GET /Bounces ### Description Get a batch of bounces. ### Method GET ### Endpoint /Bounces ### Parameters #### Query Parameters - **filter** (BounceFilteringParameters) - Optional - Optional filtering parameters. - **callback** (Callback) - Optional - If the callback is provided, it will be passed to the resulting promise as a continuation. ### Response #### Success Response (200) - **Bounces** (Bounces) - A list of bounces. #### Response Example ```json { "TotalCount": 100, "Bounces": [ { "ID": 123, "Type": "SpamNotification", "MessageID": "abc-123", "Email": "test@example.com", "BouncedAt": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Create a New Server Source: https://github.com/activecampaign/postmark.js/wiki/Servers Create a new server with a specified name. The response includes details of the newly created server. ```javascript accountClient.createServer({Name: "ServerBlue"}).then(result => { console.log(result); }); ``` -------------------------------- ### Initialize Postmark.js v1.x Clients Source: https://github.com/activecampaign/postmark.js/wiki/Migrating-from-older-version Use this initialization method for version 1.x of the Postmark.js library. Requires server or account tokens. ```javascript let postmark = require("postmark"); let serverToken = "xxxxxx-xxxxxx-xxxxx-xxxxxx"; let accountToken = "yyyyyy-yyyyy-yyyyy-yyyyyy" let client = new postmark.Client(serverToken); let accountClient = new postmark.AdminClient(accountToken); ``` -------------------------------- ### Server Client Initialization Source: https://github.com/activecampaign/postmark.js/wiki/Server This snippet shows how to initialize the Postmark ServerClient using a server API token. ```APIDOC ## Server Client Initialization ### Description Initializes the Postmark ServerClient with a provided server API token. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript let postmark = require("postmark") const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx" let client = new postmark.ServerClient(serverToken); ``` ### Response None ``` -------------------------------- ### Get Domains Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/AccountClient.html Retrieves a batch of domains, with optional filtering. ```APIDOC ## GET /api/v2/domains ### Description Retrieve a batch of Domains. ### Method GET ### Endpoint /api/v2/domains ### Parameters #### Path Parameters None #### Query Parameters - **filter** (FilteringParameters) - Optional - An optional filter for which data is retrieved. #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Domains** (object) - A collection of domain details. #### Response Example ```json { "Domains": [ { "ID": 123, "Name": "example.com", "Email Provider": "Postmark", "DKIM": { "Enabled": true, "VerifyStatus": "Success" }, "SPF": { "Verified": true }, "ReturnPath": "bounces.example.com" } ], "TotalCount": 1 } ``` ``` -------------------------------- ### ServerClient Constructor Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Initializes a new instance of the ServerClient class. ```APIDOC ## new ServerClient(serverToken, configOptions?) ### Description Create a client. ### Method constructor ### Parameters #### Path Parameters * **serverToken** (string) - Required - The token for the server that you wish to interact with. * **configOptions** (Configuration) - Optional - Options to customize the behavior of the this client. ### Returns ServerClient Overrides BaseClient.constructor ``` -------------------------------- ### Get Templates Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves a list of all email templates associated with the server. ```APIDOC ## GET /templates ### Description Get the list of templates associated with this server. ### Method GET ### Endpoint /templates ### Parameters #### Query Parameters - **filter** (TemplateFilteringParameters) - Optional - Optional filtering options. ### Response #### Success Response (200) - **Templates** (array) - A list of template objects. #### Response Example { "example": "[ {\"id\": 123, \"name\": \"Welcome Email\"}, {\"id\": 456, \"name\": \"Password Reset\"} ]" } ``` -------------------------------- ### Postmark.js Client Initialization Source: https://github.com/activecampaign/postmark.js/wiki/Bounces Initialize the Postmark server client with your server API token. ```APIDOC ## Postmark.js Client Initialization ### Description Initialize the Postmark server client using your server API token. This client is used to interact with the Postmark API for managing bounces and other email-related features. ### Code Example ```javascript let postmark = require("postmark") const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx" let client = new postmark.ServerClient(serverToken); ``` ``` -------------------------------- ### Get Template Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves a specific email template by its ID or alias. ```APIDOC ## GET /templates/{idOrAlias} ### Description Get a specific template associated with this server. ### Method GET ### Endpoint /templates/{idOrAlias} ### Parameters #### Path Parameters - **idOrAlias** (string | number) - Required - ID or alias for the template you wish to retrieve. ### Response #### Success Response (200) - **Template** (object) - The requested template details. #### Response Example { "example": "{\"id\": 123, \"name\": \"Welcome Email\", \"alias\": \"welcome\", \"subject\": \"Welcome to our service!\", \"htmlBody\": \"

Welcome!

Thank you for joining us.

\", \"textBody\": \"Welcome! Thank you for joining us.\", \"version\": 1, \"layoutId\": null, \"layoutAlias\": null}" } ``` -------------------------------- ### AccountClient Constructor Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/AccountClient.html Initializes a new instance of the AccountClient. ```APIDOC ## AccountClient Constructor ### Description Creates a new AccountClient instance. ### Method new AccountClient(accountToken, configOptions?) ### Parameters #### Path Parameters - **accountToken** (string) - Required - The account token that should be used with requests. - **configOptions** (Configuration) - Optional - Various options to customize client behavior. ### Returns [AccountClient] ### Request Example ```javascript const accountClient = new AccountClient("YOUR_ACCOUNT_TOKEN"); ``` ### Response Example ```json { "message": "AccountClient initialized successfully" } ``` ``` -------------------------------- ### GET /servers/{server_id} Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves the information for the Server associated with this Client. ```APIDOC ## GET /servers/{server_id} ### Description Get the information for the Server associated with this Client. ### Method GET ### Endpoint /servers/{server_id} ### Parameters #### Query Parameters - **callback** (Callback) - Optional - If the callback is provided, it will be passed to the resulting promise as a continuation. ### Response #### Success Response (200) - **Server** (object) - Information about the server. ### Response Example ```json { "ID": "server-id-123", "Name": "My Server", "ApiKeys": { "Sender": "sender-api-key", "Mgmt": "mgmt-api-key" }, "Color": "blue", "SmtpApiActivated": true, "InboundDomain": "inbound.example.com", "InboundHash": "some-hash" } ``` ``` -------------------------------- ### GET /getOutboundMessages Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves a batch of outbound messages, with optional filtering. ```APIDOC ## GET /getOutboundMessages ### Description Get a batch of Outbound Messages. ### Method GET ### Endpoint /getOutboundMessages ### Parameters #### Query Parameters - **filter** (OutboundMessagesFilteringParameters) - Optional - Optional filtering parameters. #### Request Body None ### Response #### Success Response (200) - **outboundMessages** (OutboundMessages[]) - An array of outbound message objects. #### Response Example ```json { "outboundMessages": [ { "messageId": "123e4567-e898-12d3-a456-426614174000", "from": "sender@example.com", "to": "recipient@example.com", "subject": "Test Email", "sentAt": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Create New Server Source: https://context7.com/activecampaign/postmark.js/llms.txt Creates a new server within your Postmark account. Requires specifying server details such as name, color, and tracking preferences. Returns API tokens upon successful creation. ```javascript accountClient.createServer({ Name: "Staging Server", Color: "yellow", SmtpApiActivated: true, RawEmailEnabled: false, DeliveryType: "Live", TrackOpens: true, TrackLinks: "HtmlOnly" }).then(result => { console.log("Server created:", result.Name); console.log("Server ID:", result.ID); console.log("API Tokens:", result.ApiTokens); }); ``` -------------------------------- ### GET /email/opens Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves overall open statistics for sent messages. ```APIDOC ## GET /email/opens ### Description Get Open statistics for messages sent from the Server associated with this Client. ### Method GET ### Endpoint /email/opens ### Parameters #### Query Parameters - **filter** (StatisticsFilteringParameters) - Optional - Optional filtering parameters. ### Response #### Success Response (200) - **OpenCounts** (Object) - Overall open statistics. ### Request Example ```json { "filter": { "fromdate": "2023-01-01", "todate": "2023-01-31" } } ``` ### Response Example ```json { "total_opens": 50000, "unique_opens": 25000 } ``` ``` -------------------------------- ### GET /api/stats/outbound/delivery Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves bounce statistic information for the associated server. ```APIDOC ## GET /api/stats/outbound/delivery ### Description Get bounce statistic information for the associated Server. ### Method GET ### Endpoint /api/stats/outbound/delivery ### Parameters #### Query Parameters - **callback** (Callback) - Optional - If the callback is provided, it will be passed to the resulting promise as a continuation. ### Response #### Success Response (200) - **DeliveryStatistics** - Bounce statistics. #### Response Example ```json { "TotalServers": 1, "TotalMessagesSent": 10000, "HardBounceCount": 50, "SoftBounceCount": 100, "TrackedReturnPathCount": 0, "BouncedRuleSetCount": 0 } ``` ``` -------------------------------- ### Server Configuration Options Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/Models.UpdateServerRequest.html This section outlines the optional configuration parameters for a Postmark server, allowing customization of inbound and outbound email behaviors. ```APIDOC ## Server Configuration Options This section details the optional server settings available in the Postmark.js library. ### InboundHookUrl * **Type**: `string` * **Optional**: Yes * **Description**: URL to receive inbound email webhooks. ### InboundSpamThreshold * **Type**: `number` * **Optional**: Yes * **Description**: Threshold for marking inbound emails as spam. ### IncludeBounceContentInHook * **Type**: `boolean` * **Optional**: Yes * **Description**: Whether to include bounce content in webhooks. ### Name * **Type**: `string` * **Optional**: Yes * **Description**: The name of the server. ### OpenHookUrl * **Type**: `string` * **Optional**: Yes * **Description**: URL to receive email open webhooks. ### PostFirstOpenOnly * **Type**: `boolean` * **Optional**: Yes * **Description**: Whether to only post the first email open event. ### RawEmailEnabled * **Type**: `boolean` * **Optional**: Yes * **Description**: Whether raw email content is enabled for processing. ### SmtpApiActivated * **Type**: `boolean` * **Optional**: Yes * **Description**: Whether the SMTP API is activated for the server. ### TrackLinks * **Type**: `LinkTrackingOptions` (enum) * **Optional**: Yes * **Description**: Option for tracking email links. Possible values include `None`, `HtmlAndText`, `HtmlOnly`, `TextOnly`. ### TrackOpens * **Type**: `boolean` * **Optional**: Yes * **Description**: Whether to track email opens. ``` -------------------------------- ### Initialize Postmark Server Client Source: https://github.com/activecampaign/postmark.js/wiki/Message-Streams Instantiate the ServerClient with your Postmark server API token. This client is used for all subsequent API requests. ```javascript let postmark = require("postmark") const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx" let client = new postmark.ServerClient(serverToken); ``` -------------------------------- ### GET /Bounces/{ID} Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves a Bounce Dump for a specific Bounce. ```APIDOC ## GET /Bounces/{ID} ### Description Get a Bounce Dump for a specific Bounce. ### Method GET ### Endpoint /Bounces/{ID} ### Parameters #### Path Parameters - **ID** (number) - Required - The ID of the Bounce for which you wish to retrieve Bounce Dump. #### Query Parameters - **callback** (Callback) - Optional - If the callback is provided, it will be passed to the resulting promise as a continuation. ### Response #### Success Response (200) - **BounceDump** (BounceDump) - The bounce dump details. #### Response Example ```json { "ID": 123, "Type": "SpamNotification", "MessageID": "abc-123", "Email": "test@example.com", "BouncedAt": "2023-10-27T10:00:00Z", "RawrCMessage": "...", "Details": "..." } ``` ``` -------------------------------- ### Get webhook by ID Source: https://github.com/activecampaign/postmark.js/wiki/Webhooks Retrieves a specific webhook by its unique identifier. ```APIDOC ## GET /webhooks/{ID} ### Description Get a specific webhook by its ID. ### Method GET ### Endpoint /webhooks/{ID} ### Parameters #### Path Parameters - **ID** (integer) - Required - The unique identifier of the webhook to retrieve. ### Request Example None ### Response #### Success Response (200) - **ID** (integer) - The unique identifier for the webhook. - **Url** (string) - The URL where the webhook events will be sent. #### Response Example ```json { "ID": 12345, "Url": "https://example.com/webhook" } ``` ``` -------------------------------- ### Server Settings - General Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/Models.CreateServerRequest.html General server settings including member visibility, theme, and various hook URLs. ```APIDOC ## Server Settings - General ### Description This section covers various server configuration settings such as member visibility, theme, and different types of hook URLs for event notifications. ### Method Not Applicable (Configuration Settings) ### Endpoint Not Applicable (Configuration Settings) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **Member Visibility** (Inherited) - Description of member visibility settings. - **Theme** (string) - OSLightDark - Specifies the theme for the server interface. - **BounceHookUrl** (string) - Optional - URL to receive bounce notifications. - **ClickHookUrl** (string) - Optional - URL to receive click tracking notifications. - **Color** (string) - Optional - Color setting for the server. - **DeliveryHookUrl** (string) - Optional - URL to receive delivery notifications. - **DeliveryType** (string) - Optional - Type of delivery. - **EnableSmtpApiErrorHooks** (boolean) - Optional - Enables error hooks for SMTP API. - **InboundDomain** (string) - Optional - The inbound domain for the server. - **InboundHookUrl** (string) - Optional - URL to receive inbound email notifications. - **InboundSpamThreshold** (integer) - Optional - Threshold for marking inbound emails as spam. - **IncludeBounceContentInHook** (boolean) - Optional - Includes bounce content in hook notifications. - **Name** (string) - Optional - The name of the server. - **OpenHookUrl** (string) - Optional - URL to receive open tracking notifications. - **PostFirstOpenOnly** (boolean) - Optional - If true, only the first open is posted. - **RawEmailEnabled** (boolean) - Optional - If true, raw email is enabled. - **SmtpApiActivated** (boolean) - Optional - If true, SMTP API is activated. - **TrackLinks** (string) - Optional - Type of link tracking. ### Request Example ```json { "Theme": "OSLightDark", "BounceHookUrl": "https://example.com/bounces", "ClickHookUrl": "https://example.com/clicks", "Name": "My Server", "TrackLinks": "All" } ``` ### Response #### Success Response (200) - **Settings** (object) - Contains all the server settings. #### Response Example ```json { "Settings": { "Member Visibility": "Inherited", "Theme": "OSLightDark", "BounceHookUrl": "https://example.com/bounces", "ClickHookUrl": "https://example.com/clicks", "Color": "#FFFFFF", "DeliveryHookUrl": "https://example.com/deliveries", "DeliveryType": "All", "EnableSmtpApiErrorHooks": false, "InboundDomain": "inbound.example.com", "InboundHookUrl": "https://example.com/inbound", "InboundSpamThreshold": 5, "IncludeBounceContentInHook": false, "Name": "My Server", "OpenHookUrl": "https://example.com/opens", "PostFirstOpenOnly": true, "RawEmailEnabled": false, "SmtpApiActivated": true, "TrackLinks": "All", "TrackOpens": true } } ``` ``` -------------------------------- ### GET /getOutboundMessageDetails Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves details for a specific outbound message using its ID. ```APIDOC ## GET /getOutboundMessageDetails ### Description Get details for a specific Outbound Message. ### Method GET ### Endpoint /getOutboundMessageDetails/{messageId} ### Parameters #### Path Parameters - **messageId** (string) - Required - The ID of the OutboundMessage you wish to retrieve. #### Request Body None ### Response #### Success Response (200) - **outboundMessageDetails** (OutboundMessageDetails) - An object containing the details of the outbound message. #### Response Example ```json { "outboundMessageDetails": { "messageId": "123e4567-e898-12d3-a456-426614174000", "from": "sender@example.com", "to": "recipient@example.com", "subject": "Test Email", "sentAt": "2023-10-27T10:00:00Z", "errorCode": 0, "errorDescription": "No error" } } ``` ``` -------------------------------- ### Get Message Stream Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves details for a specific message stream on a server. ```APIDOC ## GET /message-streams/{id} ### Description Get details for a specific message stream on a server. ### Method GET ### Endpoint /message-streams/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the message stream you wish to retrieve. #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **MessageStream** (object) - An object containing the details of the message stream. #### Response Example ```json { "id": "stream-123", "name": "Transactional Emails", "description": "Stream for all transactional emails", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Set Client Options Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/AccountClient.html Sets configuration options for the Postmark client. ```APIDOC ## PUT /client/options ### Description Set client options for the Postmark library. ### Method PUT ### Endpoint /client/options ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **configOptions** (object) - Required - The configuration options to set. - **apiKey** (string) - Your Postmark API token. - **messageStream** (string) - The message stream to use (e.g., "outbound"). ### Request Example ```json { "configOptions": { "apiKey": "YOUR_API_KEY", "messageStream": "outbound" } } ``` ### Response #### Success Response (200) None (void) #### Response Example None ``` -------------------------------- ### Get Inbound Messages Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves a batch of inbound messages, with optional filtering. ```APIDOC ## GET /inbound-messages ### Description Get a batch of Inbound Messages. ### Method GET ### Endpoint /inbound-messages ### Parameters #### Query Parameters - **filter** (InboundMessagesFilteringParameters) - Optional - Optional filtering parameters. - **callback** (Callback) - Optional - If the callback is provided, it will be passed to the resulting promise as a continuation. ### Response #### Success Response (200) - **InboundMessages** - A collection of inbound messages. #### Response Example ```json { "totalMessages": 100, "messages": [ { "id": "12345", "to": "recipient@example.com", "from": "sender@example.com", "subject": "Test Email 1", "date": "2023-10-27T10:00:00Z" }, { "id": "12346", "to": "recipient2@example.com", "from": "sender2@example.com", "subject": "Test Email 2", "date": "2023-10-27T10:05:00Z" } ] } ``` ``` -------------------------------- ### Settings Source: https://github.com/activecampaign/postmark.js/blob/main/docs/interfaces/Models.OutboundStatistics.html Configuration settings for Postmark.js. ```APIDOC ## Settings ### Member Visibility - **Inherited**: Yes ### Theme - **Type**: OSLightDark - **Description**: Specifies the theme setting, likely related to OS light/dark mode preference. ``` -------------------------------- ### GET /email/opens/read-times Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves statistics on the time taken to read sent messages. ```APIDOC ## GET /email/opens/read-times ### Description Get Read Time statistics for messages sent from the Server associated with this Client. ### Method GET ### Endpoint /email/opens/read-times ### Parameters #### Query Parameters - **filter** (StatisticsFilteringParameters) - Optional - Optional filtering parameters. ### Response #### Success Response (200) - **EmailReadTimesCounts** (Array) - Statistics on email read times. ### Request Example ```json { "filter": { "fromdate": "2023-01-01", "todate": "2023-01-31" } } ``` ### Response Example ```json [ { "read_time_seconds": 30, "count": 2000 }, { "read_time_seconds": 60, "count": 1500 } ] ``` ``` -------------------------------- ### Configuration Class Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/Models.ClientOptions.Configuration.html Details about the Configuration class, its constructor, and available properties for customizing the Postmark.js client. ```APIDOC ## Class Configuration * Defined in [client/models/client/ClientOptions.ts:2](https://github.com/ActiveCampaign/postmark.js/blob/62dfe1f/src/client/models/client/ClientOptions.ts#L2) ### Constructors * **new Configuration**(`useHttps?`: boolean, `requestHost?`: string, `timeout?`: number): [Configuration] * Optional `useHttps`: boolean * Optional `requestHost`: string * Optional `timeout`: number * Defined in [client/models/client/ClientOptions.ts:7](https://github.com/ActiveCampaign/postmark.js/blob/62dfe1f/src/client/models/client/ClientOptions.ts#L7) ### Properties * **`Optional` requestHost**: string * Defined in [client/models/client/ClientOptions.ts:5](https://github.com/ActiveCampaign/postmark.js/blob/62dfe1f/src/client/models/client/ClientOptions.ts#L5) * **`Optional` timeout**: number * Defined in [client/models/client/ClientOptions.ts:6](https://github.com/ActiveCampaign/postmark.js/blob/62dfe1f/src/client/models/client/ClientOptions.ts#L6) * **`Optional` useHttps**: boolean * Defined in [client/models/client/ClientOptions.ts:4](https://github.com/ActiveCampaign/postmark.js/blob/62dfe1f/src/client/models/client/ClientOptions.ts#L4) ``` -------------------------------- ### getClientOptions Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/AccountClient.html Retrieves the current client configuration options. ```APIDOC ## GET /api/v1/config ### Description Retrieves the current client configuration options. ### Method GET ### Endpoint /api/v1/config ### Response #### Success Response (200) - **Configuration** (object) - The client configuration settings. #### Response Example ```json { "api_url": "https://api.postmarkapp.com", "request_timeout": 30000 } ``` ``` -------------------------------- ### GET /email/opens/clients Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves statistics on email clients used to open messages. ```APIDOC ## GET /email/opens/clients ### Description Get statistics on which Email Clients were used to open messages sent from the Server associated with this Client. ### Method GET ### Endpoint /email/opens/clients ### Parameters #### Query Parameters - **filter** (StatisticsFilteringParameters) - Optional - Optional filtering parameters. ### Response #### Success Response (200) - **EmailClientUsageCounts** (Array) - Statistics on email client usage. ### Request Example ```json { "filter": { "fromdate": "2023-01-01", "todate": "2023-01-31" } } ``` ### Response Example ```json [ { "client": { "name": "Gmail", "version": "110.0" }, "count": 1500 }, { "client": { "name": "Outlook", "version": "2019" }, "count": 1200 } ] ``` ``` -------------------------------- ### GET /api/stats/outbound/clicks/platforms Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves browser platform usage statistics for tracked links. ```APIDOC ## GET /api/stats/outbound/clicks/platforms ### Description Get browser platform statistics for tracked links for messages sent from the Server associated with this Client. ### Method GET ### Endpoint /api/stats/outbound/clicks/platforms ### Parameters #### Query Parameters - **filter** (StatisticsFilteringParameters) - Optional - Optional filtering parameters. - **callback** (Callback) - Optional - If the callback is provided, it will be passed to the resulting promise as a continuation. ### Response #### Success Response (200) - **ClickPlatformUsageCounts** - Statistics for click platform usage. #### Response Example ```json { "TotalClicks": 150, "Clicked": 100, "UniqueClicks": 75, "ClickRate": 0.66, "Platforms": [ { "Platform": "Windows", "Clicks": 70 }, { "Platform": "Mac OS", "Clicks": 50 }, { "Platform": "Linux", "Clicks": 30 } ] } ``` ``` -------------------------------- ### Send Email with Postmark.js (ES6) Source: https://github.com/activecampaign/postmark.js/wiki/Getting-Started This example demonstrates sending an email using Postmark.js with ES6 syntax. Remember to substitute the placeholder server token and ensure the 'From' address is a verified sender signature in your Postmark account. ```javascript import * as postmark from "postmark"; const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx"; let client = new postmark.ServerClient(serverToken); client.sendEmail( { From: "igor@example.com", To: "chris@example.com", Subject: "Hello from Postmark!", HtmlBody: "Hello message body." } ).then(response => { console.log("Sending message"); console.log(response.To); console.log(response.Message); }); ``` -------------------------------- ### Retrieve Server Details Source: https://github.com/activecampaign/postmark.js/wiki/Server This snippet demonstrates how to retrieve details about the current server. ```APIDOC ## Retrieve Server Details ### Description Retrieves details for the server associated with the provided API token. ### Method GET ### Endpoint `/servers/{serverId}` (Implicitly handled by the client) ### Parameters #### Path Parameters None (Server ID is inferred from the client token) #### Query Parameters None #### Request Body None ### Request Example ```javascript client.getServer().then(result => { console.log(result.ApiTokens); }); ``` ### Response #### Success Response (200) - **ApiTokens** (array) - A list of API tokens associated with the server. - Other server-specific fields may be returned. ``` -------------------------------- ### Get Bounce API Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Retrieves details for a specific bounce using its ID. ```APIDOC ## GET /bounces/{bounceId} ### Description Get details for a specific Bounce. ### Method GET ### Endpoint /bounces/{bounceId} ### Parameters #### Path Parameters - **bounceId** (number) - Required - The ID of the Bounce you wish to retrieve. ### Response #### Success Response (200) - **Bounce** (object) - Details of the bounce. #### Response Example ```json { "ID": 12345, "TypeCode": "50", "Name": "Spam Notification Failure", "Email": "test@example.com", "BounceDate": "2023-01-01T14:00:00Z", "MessageID": "a1b2c3d4", "Details": "Recipient server did not accept our mail." } ``` ``` -------------------------------- ### Initialize AccountClient for Account Administration Source: https://context7.com/activecampaign/postmark.js/llms.txt Initialize an AccountClient using your Postmark account API token. This client is for administrative tasks like managing servers and domains. ```javascript const postmark = require("postmark"); const accountToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx"; const accountClient = new postmark.AccountClient(accountToken); ``` -------------------------------- ### Get Sender Signatures Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/AccountClient.html Retrieves a batch of sender signatures, with optional filtering. ```APIDOC ## GET /api/v2/signatures ### Description Retrieve a batch of Sender Signatures. ### Method GET ### Endpoint /api/v2/signatures ### Parameters #### Path Parameters None #### Query Parameters - **filter** (FilteringParameters) - Optional - An optional filter for which data is retrieved. #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Signatures** (object) - A collection of sender signature details. #### Response Example ```json { "SenderSignatures": [ { "ID": 456, "ServerID": 789, "Email": "sender@example.com", "Name": "My Sender Name", "Verified": true, "Domain": "example.com" } ], "TotalCount": 1 } ``` ``` -------------------------------- ### Get template by ID Source: https://github.com/activecampaign/postmark.js/wiki/Templates Retrieves a specific template using its unique ID. ```APIDOC ## GET /templates/{templateId} ### Description Retrieves a specific template by its ID. ### Method GET ### Endpoint /templates/{templateId} ### Parameters #### Path Parameters - **templateId** (integer) - Required - The ID of the template to retrieve. ### Response #### Success Response (200) - **Active** (boolean) - Indicates if the template is active. - **AssociatedServerId** (integer) - The ID of the server associated with the template. - **TemplateId** (integer) - The unique identifier for the template. - **Subject** (string) - The subject line of the template. ### Response Example ```json { "Active": true, "AssociatedServerId": 123, "TemplateId": 12345, "Subject": "Welcome!" } ``` ``` -------------------------------- ### Push Templates Between Servers with AccountClient Source: https://context7.com/activecampaign/postmark.js/llms.txt Use the AccountClient to copy templates from one server to another. Set 'PerformChanges' to false for a dry run. ```javascript accountClient.pushTemplates({ SourceServerID: 1234, DestinationServerID: 5678, PerformChanges: false // Set to true to actually perform the push }).then(result => { console.log("Templates to push:", result.TotalCount); result.Templates.forEach(template => { console.log(`- ${template.Name} (${template.Action})`); console.log(" Alias:", template.Alias); console.log(" Template ID:", template.TemplateId); }); }).catch(error => { console.error("Push error:", error.message); }); ``` -------------------------------- ### setClientOptions Source: https://github.com/activecampaign/postmark.js/blob/main/docs/classes/ServerClient.html Configures the client options for Postmark.js. ```APIDOC ## PUT /setClientOptions ### Description Configures the client options. ### Method PUT ### Endpoint /setClientOptions ### Parameters #### Request Body - **configOptions** (Configuration) - Required - Client configuration options. ### Response #### Success Response (200) - **void** - This method does not return a value. ``` -------------------------------- ### Get message stream Source: https://github.com/activecampaign/postmark.js/wiki/Message-Streams Retrieves details for a specific message stream by its ID. ```APIDOC ## GET /message-streams/{streamId} ### Description Retrieves the details of a specific message stream identified by its ID. ### Method GET ### Endpoint /message-streams/{streamId} ### Path Parameters - **streamId** (string) - Required - The unique identifier of the message stream. ### Response #### Success Response (200) - **Name** (string) - The name of the message stream. - **Description** (string) - The description of the message stream. - **SubscriptionManagementConfiguration** (object) - Configuration for subscription management. - **UnsubscribeHandlingType** (string) - The type of handling for unsubscribes. ### Response Example { "Name": "Default Outbound Stream", "Description": "Handles all outbound transactional emails.", "SubscriptionManagementConfiguration": { "UnsubscribeHandlingType": "Postmark" } } ``` -------------------------------- ### List All Servers Source: https://context7.com/activecampaign/postmark.js/llms.txt Retrieves a list of all servers configured in your Postmark account using the AccountClient. Displays total count and details for each server. ```javascript accountClient.getServers().then(result => { console.log("Total servers:", result.TotalCount); result.Servers.forEach(server => { console.log(`${server.Name} (ID: ${server.ID})`); console.log(` Color: ${server.Color}`); console.log(` SMTP Activated: ${server.SmtpApiActivated}`); }); }); ``` -------------------------------- ### Get Sender Signature Details Source: https://context7.com/activecampaign/postmark.js/llms.txt Retrieve detailed information about a specific sender signature. ```APIDOC ## Get Sender Signature Details ### Description Retrieve detailed information about a specific sender signature. ### Method GET ### Endpoint /api/sender-signatures/{ID} ### Parameters #### Path Parameters - **ID** (integer) - Required - The ID of the sender signature to retrieve. ### Request Example ```javascript accountClient.getSenderSignature(1234567).then(result => { console.log("Name:", result.Name); console.log("Email:", result.EmailAddress); console.log("Reply To:", result.ReplyToEmailAddress); console.log("Confirmed:", result.Confirmed); console.log("Domain:", result.Domain); console.log("SPF Verified:", result.SPFVerified); console.log("DKIM Verified:", result.DKIMVerified); }); ``` ### Response #### Success Response (200) - **Name** (string) - The name associated with the sender signature. - **EmailAddress** (string) - The verified sending email address. - **ReplyToEmailAddress** (string) - The reply-to email address for the signature. - **Confirmed** (boolean) - Indicates if the sender signature is confirmed. - **Domain** (string) - The domain of the sending email address. - **SPFVerified** (boolean) - Indicates if SPF verification is successful for the signature. - **DKIMVerified** (boolean) - Indicates if DKIM verification is successful for the signature. #### Response Example ```json { "Name": "John Doe", "EmailAddress": "john.doe@example.com", "ReplyToEmailAddress": "support@example.com", "Confirmed": true, "Domain": "example.com", "SPFVerified": true, "DKIMVerified": true } ``` ```