### Install Ecomail PHP Wrapper Source: https://github.com/ecomailcz/ecomail-php/blob/master/README.md Use Composer to install the Ecomail PHP package. ```shell composer require ecomailcz/ecomail ``` -------------------------------- ### showList(string $list_id) - Get a single list Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches detailed information for a specific contact list using its unique ID. ```APIDOC ### `showList(string $list_id)` — Get a single list Fetches details for one specific contact list by its ID. ```php showList('1'); // $list => ['id' => 1, 'name' => 'Newsletter', 'subscribers_count' => 1540, ...] ``` ``` -------------------------------- ### Get Subscriber by Email Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves all list memberships for a given email address across the entire account. Requires an initialized Ecomail client. ```php getSubscriberByEmail('jane@example.com'); // $info => ['email' => 'jane@example.com', 'lists' => [...], ...] ``` -------------------------------- ### Get Pipeline Statistics - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns aggregate statistics for an automation pipeline. Requires the pipeline ID. ```php getPipelineStats('7'); // $stats => ['enrolled' => 300, 'completed' => 210, ...] ?> ``` -------------------------------- ### Get Detailed Pipeline Statistics - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns per-contact detail rows for a pipeline with optional query parameters. Requires the pipeline ID and an array of query parameters. ```php getPipelineStatsDetail('7', ['status' => 'completed']); ?> ``` -------------------------------- ### Get Double Opt-In Transactional Statistics - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns statistics specifically for DOI (double opt-in confirmation) emails. No parameters are required. ```php getTransactionalStatsDOI(); ?> ``` -------------------------------- ### Get Campaign Statistics Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves aggregate statistics for a campaign, including sent, opened, clicked, and bounced counts. ```php getCampaignStats(123); // $stats => ['sent' => 1540, 'opened' => 420, 'clicked' => 95, ...] ``` -------------------------------- ### Get Transactional Email Statistics - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns aggregate delivery statistics for all transactional emails. No parameters are required. ```php getTransactionalStats(); // $stats => ['sent' => 5000, 'delivered' => 4950, 'bounced' => 50, ...] ?> ``` -------------------------------- ### Get Details of a Single Contact List Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches detailed information for a specific contact list using its ID. The returned object includes metadata like 'id', 'name', and 'subscribers_count'. ```php showList('1'); // $list => ['id' => 1, 'name' => 'Newsletter', 'subscribers_count' => 1540, ...] ``` -------------------------------- ### Get Detailed Campaign Statistics Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches detailed statistics for a campaign, such as per-recipient or per-event data. Supports filtering by type. ```php getCampaignStatsDetail(123, ['type' => 'opens']); foreach ($detail as $row) { echo $row['email'] . ' opened at ' . $row['timestamp'] . PHP_EOL; } ``` -------------------------------- ### updateTransaction Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Modifies an existing transaction record, for example to mark it as refunded or shipped. ```APIDOC ## updateTransaction(string $transaction_id, array $data) ### Description Modifies an existing transaction record, for example to mark it as refunded or shipped. ### Method `updateTransaction` ### Parameters #### `$transaction_id` (string) - Required The ID of the transaction to update. #### `$data` (array) - Required An array containing the updated transaction details. ### Request Example ```php $ecomail->updateTransaction('ORD-10042', [ 'transaction' => ['status' => 'shipped'], ]); ``` ``` -------------------------------- ### Get a Specific Subscriber in a List Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches the details of a single subscriber within a given contact list, identified by their email address. Returns subscriber information including their status. ```php getSubscriber('1', 'jane@example.com'); // $sub => ['email' => 'jane@example.com', 'status' => 'subscribed', ...] ``` -------------------------------- ### getSubscriber(string $list_id, string $email) - Get one subscriber in a list Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches the data for a single subscriber within a specific list, identified by the list ID and the subscriber's email address. ```APIDOC ### `getSubscriber(string $list_id, string $email)` — Get one subscriber in a list Returns subscriber data within the context of a specific list. ```php getSubscriber('1', 'jane@example.com'); // $sub => ['email' => 'jane@example.com', 'status' => 'subscribed', ...] ``` ``` -------------------------------- ### Initialize Ecomail Wrapper Source: https://github.com/ecomailcz/ecomail-php/blob/master/README.md Instantiate the Ecomail class with your API key to begin making requests. ```php $ecomail = new Ecomail('API_KEY'); $ecomail->getListsCollection(); ``` -------------------------------- ### Constructor - new Ecomail($key, $response, $server, $query) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Instantiates the Ecomail API client. The API key is mandatory. Optional arguments control response decoding (arrays, objects, or plain text). ```APIDOC ## Constructor — `new Ecomail($key, $response, $server, $query)` Instantiates the API client. The only required argument is the API key found under **Integrations** in the Ecomail dashboard. The optional `$response` constant controls how JSON responses are decoded (`Ecomail::JSONArray` decodes to PHP arrays, `Ecomail::JSONObject` decodes to `stdClass`, `Ecomail::PlainText` returns the raw string). ```php addListCollection([ 'name' => 'VIP Customers', 'from_name' => 'My Shop', 'from_email' => 'hello@myshop.com', 'reply_to' => 'support@myshop.com', 'reminder_text' => 'You signed up at myshop.com', ]); // $newList => ['id' => 42, 'name' => 'VIP Customers', ...] ``` -------------------------------- ### Instantiate Ecomail API Client Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Initialize the Ecomail API client with your API key. You can configure response decoding to PHP arrays, stdClass objects, or plain text. ```php triggerAutomation('7', [ 'email' => 'jane@example.com', ]); ?> ``` -------------------------------- ### addCampaign Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Creates a new email campaign draft. ```APIDOC ## addCampaign(array $data) ### Description Creates a new email campaign draft. ### Method Signature `addCampaign(array $data)` ### Parameters #### Request Body - **name** (string) - Required - The name of the campaign. - **subject** (string) - Required - The subject line of the email campaign. - **from_name** (string) - Required - The name displayed as the sender. - **from_email** (string) - Required - The email address displayed as the sender. - **reply_to** (string) - Required - The email address to which replies should be sent. - **list_id** (int) - Required - The ID of the list to which the campaign will be sent. - **template_id** (int) - Required - The ID of the template to use for the campaign. ``` -------------------------------- ### listDomains() Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns all verified sending domains configured in the account. No parameters are required. ```APIDOC ## listDomains() ### Description Returns all verified sending domains configured in the account. ### Response #### Success Response (200) - **domain** (string) - The sending domain name. - **verified** (boolean) - Indicates if the domain is verified. ### Request Example ```php $domains = $ecomail->listDomains(); ``` ``` -------------------------------- ### createDomain(array $data) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Registers a new domain for email sending. Requires an array containing the domain name. ```APIDOC ## createDomain(array $data) ### Description Registers a new domain for email sending. ### Parameters #### Request Body - **data** (array) - Required - An array containing the domain details. - **domain** (string) - Required - The domain name to register. ### Request Example ```php $domain = $ecomail->createDomain(['domain' => 'newsletter.myshop.com']); ``` ``` -------------------------------- ### List Sending Domains - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns all verified sending domains configured in the account. No parameters are required. ```php listDomains(); foreach ($domains as $domain) { echo $domain['domain'] . ' — verified: ' . ($domain['verified'] ? 'yes' : 'no') . PHP_EOL; } ?> ``` -------------------------------- ### createBulkTransactions Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Imports multiple historical transactions in a single call. ```APIDOC ## createBulkTransactions(array $data) ### Description Imports multiple historical transactions in a single call. ### Method `createBulkTransactions` ### Parameters #### `$data` (array) - Required An array containing multiple transaction details. ### Request Example ```php $ecomail->createBulkTransactions([ 'transactions' => [ ['order_id' => 'ORD-001', 'email' => 'alice@example.com', 'amount' => 29.99, /* ... */], ['order_id' => 'ORD-002', 'email' => 'bob@example.com', 'amount' => 15.00, /* ... */], ], ]); ``` ``` -------------------------------- ### Create Campaign Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Creates a new email campaign draft. Requires details such as name, subject, sender information, list ID, and template ID. ```php addCampaign([ 'name' => 'Summer Sale 2024', 'subject' => '🌞 Up to 50% off this weekend!', 'from_name' => 'My Shop', 'from_email' => 'deals@myshop.com', 'reply_to' => 'support@myshop.com', 'list_id' => 1, 'template_id' => 5, ]); // $campaign => ['id' => 123, ...] ``` -------------------------------- ### List Automation Pipelines Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves a list of all automation pipelines defined within the Ecomail account. Displays their IDs and names. ```php listAutomations(); foreach ($automations as $pipeline) { echo $pipeline['id'] . ': ' . $pipeline['name'] . PHP_EOL; } ``` -------------------------------- ### triggerAutomation(string $automation_id, array $data) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Enrolls a subscriber in an automation pipeline. Requires the automation ID and an array containing subscriber data, typically including their email. ```APIDOC ## triggerAutomation(string $automation_id, array $data) ### Description Enrolls a subscriber in an automation pipeline. ### Parameters #### Path Parameters - **automation_id** (string) - Required - The ID of the automation to trigger. #### Request Body - **data** (array) - Required - An array containing subscriber information. Must include 'email'. - **email** (string) - Required - The email address of the subscriber. ### Request Example ```php $ecomail->triggerAutomation('7', [ 'email' => 'jane@example.com', ]); ``` ``` -------------------------------- ### Create Sending Domain - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Registers a new domain for email sending. Requires an array containing the domain name. ```php createDomain(['domain' => 'newsletter.myshop.com']); ?> ``` -------------------------------- ### listCampaigns Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns all campaigns, optionally filtered by status. ```APIDOC ## listCampaigns(?string $filters) ### Description Returns all campaigns, optionally filtered by status string. ### Method Signature `listCampaigns(?string $filters)` ### Parameters #### Query Parameters - **filters** (string) - Optional - A string representing the status to filter campaigns by (e.g., 'sent'). ``` -------------------------------- ### Pagination - page(int $page) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns a new immutable client instance that appends `?page=N` to subsequent requests, facilitating iteration through paginated results. ```APIDOC ## Pagination — `page(int $page)` Returns a new immutable client instance that appends `?page=N` to every subsequent request. Use the `last_page` value from a paginated response to iterate through all results. ```php getListsCollection(); $lastPage = $page1['last_page'] ?? 1; // Fetch remaining pages for ($p = 2; $p <= $lastPage; $p++) { $result = $ecomail->page($p)->getListsCollection(); // process $result } ``` ``` -------------------------------- ### getCampaignStats Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns aggregate open, click, bounce, and unsubscribe statistics for a campaign. ```APIDOC ## getCampaignStats(int $campaign_id) ### Description Returns aggregate open, click, bounce, and unsubscribe statistics for a campaign. ### Method Signature `getCampaignStats(int $campaign_id)` ### Parameters #### Path Parameters - **campaign_id** (int) - Required - The ID of the campaign for which to retrieve statistics. ``` -------------------------------- ### Import Discount Coupons - Ecomail PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Uploads a batch of discount codes to Ecomail for use in campaigns and automations. Requires a pool ID and an array of coupon codes. ```php importCoupons([ 'pool_id' => 'summer_sale_2024', 'coupons' => [ ['code' => 'SUMMER10'], ['code' => 'SUMMER20'], ['code' => 'SUMMER30'], ], ]); ``` -------------------------------- ### Send Campaign Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Enqueues a campaign for immediate delivery. This action is irreversible and cannot be undone. ```php sendCampaign(123); // $response => ['status' => 'queued', ...] ``` -------------------------------- ### List Campaigns Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves a list of all campaigns, with an option to filter by status (e.g., 'sent'). ```php listCampaigns(); // Only sent campaigns $sent = $ecomail->listCampaigns('sent'); ``` -------------------------------- ### refreshProductFeed Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Triggers a re-import of a product catalog feed, keeping recommendations up to date. ```APIDOC ## refreshProductFeed(string $feedId) ### Description Triggers a re-import of a product catalog feed, keeping recommendations up to date. ### Method `refreshProductFeed` ### Parameters #### `$feedId` (string) - Required The ID of the product feed to refresh. ### Request Example ```php $ecomail->refreshProductFeed('feed_123'); ``` ``` -------------------------------- ### sendCampaign Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Enqueues the campaign for immediate delivery. ```APIDOC ## sendCampaign(int $campaign_id) ### Description Enqueues the campaign for immediate delivery. This action cannot be undone. ### Method Signature `sendCampaign(int $campaign_id)` ### Parameters #### Path Parameters - **campaign_id** (int) - Required - The ID of the campaign to send. ``` -------------------------------- ### importCoupons Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Uploads a batch of discount codes to Ecomail for use in campaigns and automations. ```APIDOC ## importCoupons(array $data) ### Description Uploads a batch of discount codes to Ecomail for use in campaigns and automations. ### Method `importCoupons` ### Parameters #### `$data` (array) - Required An array containing coupon pool ID and coupon details. ### Request Example ```php $ecomail->importCoupons([ 'pool_id' => 'summer_sale_2024', 'coupons' => [ ['code' => 'SUMMER10'], ['code' => 'SUMMER20'], ['code' => 'SUMMER30'], ], ]); ``` ``` -------------------------------- ### getTransactionalStatsDOI() Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns statistics specifically for DOI (double opt-in confirmation) emails. No parameters are required. ```APIDOC ## getTransactionalStatsDOI() ### Description Returns statistics specifically for DOI (double opt-in confirmation) emails. ### Response #### Success Response (200) - **doiStats** (object) - An object containing DOI statistics. Specific fields are not detailed in the source. ### Request Example ```php $doiStats = $ecomail->getTransactionalStatsDOI(); ``` ``` -------------------------------- ### getPipelineStatsDetail(string $pipelineId, array $queryParams) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns per-contact detail rows for a pipeline with optional query parameters. Requires the pipeline ID and an array of query parameters. ```APIDOC ## getPipelineStatsDetail(string $pipelineId, array $queryParams) ### Description Returns per-contact detail rows for a pipeline with optional query parameters. ### Parameters #### Path Parameters - **pipelineId** (string) - Required - The ID of the pipeline to get detailed statistics for. #### Query Parameters - **queryParams** (array) - Optional - An array of query parameters to filter the results. Example: `['status' => 'completed']`. ### Request Example ```php $detail = $ecomail->getPipelineStatsDetail('7', ['status' => 'completed']); ``` ``` -------------------------------- ### createTemplate(array $data) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Saves an HTML email template for reuse in campaigns and transactional emails. Requires an array containing template details like name, HTML content, and subject. ```APIDOC ## createTemplate(array $data) ### Description Saves an HTML email template for reuse in campaigns and transactional emails. ### Parameters #### Request Body - **data** (array) - Required - An array containing the template details. - **name** (string) - Required - The name of the template. - **html** (string) - Required - The HTML content of the template. - **subject** (string) - Required - The subject line of the template. ### Response #### Success Response (200) - **id** (integer) - The ID of the newly created template. - **name** (string) - The name of the template. ### Request Example ```php $template = $ecomail->createTemplate([ 'name' => 'Order Confirmation', 'html' => '

Thank you for your order!

', 'subject' => 'Your order #{{order_id}} is confirmed', ]); ``` ``` -------------------------------- ### Paginate through Ecomail API Results Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Use the `page()` method to fetch subsequent pages of results. The `last_page` value from a paginated response is used to determine the total number of pages. ```php getListsCollection(); $lastPage = $page1['last_page'] ?? 1; // Fetch remaining pages for ($p = 2; $p <= $lastPage; $p++) { $result = $ecomail->page($p)->getListsCollection(); // process $result } ``` -------------------------------- ### Paginate Ecomail API Requests Source: https://github.com/ecomailcz/ecomail-php/blob/master/README.md When more results are available, use the 'page' method to retrieve subsequent pages of data from the Ecomail API. ```php $ecomail->page(2)->getListsCollection(); ``` -------------------------------- ### Refresh a Product Feed - Ecomail PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Triggers a re-import of a product catalog feed. This keeps product recommendations up to date. ```php refreshProductFeed('feed_123'); ``` -------------------------------- ### List Subscribers in a Contact List Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves all subscribers within a specified contact list. Supports pagination, allowing you to fetch subscribers page by page. The subscriber data is available under the 'data' key in the response. ```php getSubscribers('1'); foreach ($subscribers['data'] as $sub) { echo $sub['email'] . PHP_EOL; } // Page 2 $page2 = $ecomail->page(2)->getSubscribers('1'); ``` -------------------------------- ### getPipelineStats(string $pipelineId) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns aggregate statistics for an automation pipeline. Requires the pipeline ID. ```APIDOC ## getPipelineStats(string $pipelineId) ### Description Returns aggregate statistics for an automation pipeline. ### Parameters #### Path Parameters - **pipelineId** (string) - Required - The ID of the pipeline to get statistics for. ### Response #### Success Response (200) - **enrolled** (integer) - The number of subscribers enrolled in the pipeline. - **completed** (integer) - The number of subscribers who have completed the pipeline. ### Request Example ```php $stats = $ecomail->getPipelineStats('7'); ``` ``` -------------------------------- ### updateCampaign Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Modifies a campaign draft before it is sent. ```APIDOC ## updateCampaign(int $campaign_id, array $data) ### Description Modifies a campaign draft before it is sent. ### Method Signature `updateCampaign(int $campaign_id, array $data)` ### Parameters #### Path Parameters - **campaign_id** (int) - Required - The ID of the campaign to update. #### Request Body - **subject** (string) - Optional - The new subject line for the campaign. ``` -------------------------------- ### Create Email Template - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Saves an HTML email template for reuse in campaigns and transactional emails. Requires an array containing the template's name, HTML content, and subject. ```php createTemplate([ 'name' => 'Order Confirmation', 'html' => '

Thank you for your order!

', 'subject' => 'Your order #{{order_id}} is confirmed', ]); // $template => ['id' => 5, 'name' => 'Order Confirmation', ...] ?> ``` -------------------------------- ### getCampaignStatsDetail Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns per-recipient or per-event detail rows for a campaign, with optional query filtering. ```APIDOC ## getCampaignStatsDetail(int $campaignId, array $queryParams) ### Description Returns per-recipient or per-event detail rows for a campaign, with optional query filtering. ### Method Signature `getCampaignStatsDetail(int $campaignId, array $queryParams)` ### Parameters #### Path Parameters - **campaignId** (int) - Required - The ID of the campaign. #### Query Parameters - **type** (string) - Optional - The type of statistics to retrieve (e.g., 'opens', 'clicks', 'bounces'). ``` -------------------------------- ### addListCollection(array $data) - Create a new contact list Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Creates a new contact list with the provided data and returns the newly created list object, including its ID. ```APIDOC ### `addListCollection(array $data)` — Create a new contact list Creates a new list and returns the created list object. ```php addListCollection([ 'name' => 'VIP Customers', 'from_name' => 'My Shop', 'from_email' => 'hello@myshop.com', 'reply_to' => 'support@myshop.com', 'reminder_text' => 'You signed up at myshop.com', ]); // $newList => ['id' => 42, 'name' => 'VIP Customers', ...] ``` ``` -------------------------------- ### getListsCollection() - Retrieve all contact lists Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves all contact lists associated with the account. The response is a PHP array containing details for each list. ```APIDOC ### `getListsCollection()` — Retrieve all contact lists Returns every contact list in the account. ```php getListsCollection(); // $lists => [ ['id' => 1, 'name' => 'Newsletter', ...], ... ] foreach ($lists as $list) { echo $list['id'] . ': ' . $list['name'] . PHP_EOL; } ``` ``` -------------------------------- ### Record Multiple Transactions at Once - Ecomail PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Imports multiple historical transactions in a single call. This is efficient for bulk data operations. ```php createBulkTransactions([ 'transactions' => [ ['order_id' => 'ORD-001', 'email' => 'alice@example.com', 'amount' => 29.99, /* ... */], ['order_id' => 'ORD-002', 'email' => 'bob@example.com', 'amount' => 15.00, /* ... */], ], ]); ``` -------------------------------- ### Bulk Add Subscribers to List Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Adds multiple subscribers to a list in a single API call. Supports options for resubscribing, triggering autoresponders, and updating existing contacts. ```php addSubscriberBulk('1', [ 'subscriber_data' => [ ['email' => 'alice@example.com', 'name' => 'Alice'], ['email' => 'bob@example.com', 'name' => 'Bob'], ], 'resubscribe' => false, 'trigger_autoresponders' => false, 'update_existing' => true, ]); ``` -------------------------------- ### createNewTransaction Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Stores a single e-commerce transaction for a contact, enabling revenue attribution and product recommendations. ```APIDOC ## createNewTransaction(array $data) ### Description Stores a single e-commerce transaction for a contact, enabling revenue attribution and product recommendations. ### Method `createNewTransaction` ### Parameters #### `$data` (array) - Required An array containing the transaction details. ### Request Example ```php $ecomail->createNewTransaction([ 'transaction' => [ 'order_id' => 'ORD-10042', 'email' => 'jane@example.com', 'shop' => 'myshop.com', 'amount' => 49.99, 'tax' => 8.50, 'shipping' => 5.00, 'city' => 'Prague', 'country_code' => 'CZ', 'timestamp' => date('Y-m-d H:i:s'), 'items' => [ [ 'code' => 'SKU-001', 'title' => 'Blue T-Shirt', 'category' => 'Apparel', 'price' => 24.99, 'amount' => 2, 'timestamp' => date('Y-m-d H:i:s'), ], ], ], ]); ``` ``` -------------------------------- ### getTransactionalStats() Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Returns aggregate delivery statistics for all transactional emails. No parameters are required. ```APIDOC ## getTransactionalStats() ### Description Returns aggregate delivery statistics for all transactional emails. ### Response #### Success Response (200) - **sent** (integer) - The total number of transactional emails sent. - **delivered** (integer) - The number of transactional emails successfully delivered. - **bounced** (integer) - The number of transactional emails that bounced. ### Request Example ```php $stats = $ecomail->getTransactionalStats(); ``` ``` -------------------------------- ### Update a Contact List Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Updates the metadata of an existing contact list, such as its name and sender information. Returns the updated list object. ```php updateList('1', [ 'name' => 'Newsletter 2024', 'from_name' => 'My Brand', 'from_email' => 'news@mybrand.com', ]); ``` -------------------------------- ### addSubscriberBulk Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Adds multiple subscribers to a list in one API call. ```APIDOC ## addSubscriberBulk(string $list_id, array $data) ### Description Adds multiple subscribers to a list in one API call. ### Method Signature `addSubscriberBulk(string $list_id, array $data)` ### Parameters #### Path Parameters - **list_id** (string) - Required - The ID of the list to which the subscribers will be added. #### Request Body - **subscriber_data** (array) - Required - An array of subscriber data objects. Each object should contain at least an 'email' field. - **email** (string) - Required - The email address of the subscriber. - **name** (string) - Optional - The first name of the subscriber. - **resubscribe** (boolean) - Optional - Whether to re-subscribe contacts if they are already unsubscribed. - **trigger_autoresponders** (boolean) - Optional - Whether to trigger autoresponders for these subscriptions. - **update_existing** (boolean) - Optional - Whether to update existing subscribers if they are found. ``` -------------------------------- ### getTransactions Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches stored transactions with optional filtering parameters. ```APIDOC ## getTransactions(array $queryParams) ### Description Fetches stored transactions with optional filtering parameters. ### Method `getTransactions` ### Parameters #### `$queryParams` (array) - Optional An array of query parameters for filtering transactions. ### Request Example ```php $transactions = $ecomail->getTransactions([ 'email' => 'jane@example.com', 'date_from' => '2024-01-01', 'date_to' => '2024-12-31', ]); ``` ``` -------------------------------- ### addSubscriber Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Adds or re-subscribes a single contact to a list. ```APIDOC ## addSubscriber(string $list_id, array $data) ### Description Adds or re-subscribes a single contact to a list. ### Method Signature `addSubscriber(string $list_id, array $data)` ### Parameters #### Path Parameters - **list_id** (string) - Required - The ID of the list to which the subscriber will be added. #### Request Body - **subscriber_data** (array) - Required - Contains subscriber details like email, name, surname, and tags. - **email** (string) - Required - The email address of the subscriber. - **name** (string) - Optional - The first name of the subscriber. - **surname** (string) - Optional - The last name of the subscriber. - **tags** (array) - Optional - An array of tags to associate with the subscriber. - **resubscribe** (boolean) - Optional - Whether to re-subscribe the contact if they are already unsubscribed. - **trigger_autoresponders** (boolean) - Optional - Whether to trigger autoresponders for this subscription. ``` -------------------------------- ### Record a Purchase Transaction - Ecomail PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Stores a single e-commerce transaction for a contact. Ensure all required fields are populated for accurate revenue attribution and product recommendations. ```php createNewTransaction([ 'transaction' => [ 'order_id' => 'ORD-10042', 'email' => 'jane@example.com', 'shop' => 'myshop.com', 'amount' => 49.99, 'tax' => 8.50, 'shipping' => 5.00, 'city' => 'Prague', 'country_code' => 'CZ', 'timestamp' => date('Y-m-d H:i:s'), 'items' => [ [ 'code' => 'SKU-001', 'title' => 'Blue T-Shirt', 'category' => 'Apparel', 'price' => 24.99, 'amount' => 2, 'timestamp' => date('Y-m-d H:i:s'), ], ], ], ]); ``` -------------------------------- ### Retrieve All Contact Lists Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches all contact lists in your Ecomail account. The response is an array of list objects, each containing details like 'id' and 'name'. ```php getListsCollection(); // $lists => [ ['id' => 1, 'name' => 'Newsletter', ...], ... ] foreach ($lists as $list) { echo $list['id'] . ': ' . $list['name'] . PHP_EOL; } ``` -------------------------------- ### search Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Performs a full-text search for contacts across all lists by name, email, or custom fields. ```APIDOC ## search(string $query) ### Description Performs a full-text search for contacts across all lists by name, email, or custom fields. ### Method `search` ### Parameters #### `$query` (string) - Required The search query string. ### Request Example ```php $results = $ecomail->search('jane@example.com'); foreach ($results as $contact) { echo $contact['email'] . PHP_EOL; } ``` ``` -------------------------------- ### getSubscribers(string $list_id) - List subscribers in a list Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves all subscribers within a specified contact list. This method supports pagination. ```APIDOC ### `getSubscribers(string $list_id)` — List subscribers in a list Retrieves all subscribers for the given list (supports pagination). ```php getSubscribers('1'); foreach ($subscribers['data'] as $sub) { echo $sub['email'] . PHP_EOL; } // Page 2 $page2 = $ecomail->page(2)->getSubscribers('1'); ``` ``` -------------------------------- ### Send Transactional Email Using Template - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Sends a transactional email rendered from a saved template ID with merge variables. Requires an array specifying the template ID, subject, sender, recipients, and global merge variables. ```php sendTransactionalTemplate([ 'message' => [ 'template_id' => 5, 'subject' => 'Order #10042 Confirmed', 'from_name' => 'My Shop', 'from_email' => 'orders@myshop.com', 'to' => [['email' => 'jane@example.com']], 'global_merge_vars' => [ ['name' => 'order_id', 'content' => '10042'], ['name' => 'order_total', 'content' => '$49.99'], ], ], ]); ?> ``` -------------------------------- ### Add Subscriber to List Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Adds or re-subscribes a single contact to a specified list. Can trigger autoresponders and resubscribe existing contacts. ```php addSubscriber('1', [ 'subscriber_data' => [ 'email' => 'john@example.com', 'name' => 'John', 'surname' => 'Doe', 'tags' => ['customer', 'vip'], ], 'resubscribe' => true, 'trigger_autoresponders' => true, ]); ``` -------------------------------- ### Track a Custom Behavioral Event - Ecomail PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Records a custom event for a contact, such as a product view or add-to-cart action. This is used for automation triggers. ```php addEvent([ 'email' => 'jane@example.com', 'action' => 'product_viewed', 'timestamp' => time(), 'properties' => [ 'product_id' => 'SKU-001', 'product_name' => 'Blue T-Shirt', 'price' => 24.99, ], ]); ``` -------------------------------- ### addEvent Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Records a custom event for a contact (e.g., page view, product view, add-to-cart) for use in automation triggers. ```APIDOC ## addEvent(array $data) ### Description Records a custom event for a contact (e.g., page view, product view, add-to-cart) for use in automation triggers. ### Method `addEvent` ### Parameters #### `$data` (array) - Required An array containing the event details. ### Request Example ```php $ecomail->addEvent([ 'email' => 'jane@example.com', 'action' => 'product_viewed', 'timestamp' => time(), 'properties' => [ 'product_id' => 'SKU-001', 'product_name' => 'Blue T-Shirt', 'price' => 24.99, ], ]); ``` ``` -------------------------------- ### sendTransactionalTemplate(array $data) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Sends a transactional email rendered from a saved template ID with merge variables. Requires an array containing message details including template ID and merge variables. ```APIDOC ## sendTransactionalTemplate(array $data) ### Description Sends a transactional email rendered from a saved template ID with merge variables. ### Parameters #### Request Body - **data** (array) - Required - An array containing the message details. - **message** (object) - Required - The email message object. - **template_id** (integer) - Required - The ID of the template to use. - **subject** (string) - Required - The subject of the email. - **from_name** (string) - Required - The name of the sender. - **from_email** (string) - Required - The email address of the sender. - **to** (array) - Required - An array of recipients, each with 'email' and optionally 'name'. - **global_merge_vars** (array) - Optional - An array of global merge variables to be used in the template. ### Request Example ```php $result = $ecomail->sendTransactionalTemplate([ 'message' => [ 'template_id' => 5, 'subject' => 'Order #10042 Confirmed', 'from_name' => 'My Shop', 'from_email' => 'orders@myshop.com', 'to' => [['email' => 'jane@example.com']], 'global_merge_vars' => [ ['name' => 'order_id', 'content' => '10042'], ['name' => 'order_total', 'content' => '$49.99'], ], ], ]); ``` ``` -------------------------------- ### Retrieve Transaction Records - Ecomail PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Fetches stored transactions with optional filtering parameters like email and date range. The results are returned in an array. ```php getTransactions([ 'email' => 'jane@example.com', 'date_from' => '2024-01-01', 'date_to' => '2024-12-31', ]); ``` -------------------------------- ### getSubscriberByEmail Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Retrieves all list memberships for a single email address across the entire account. ```APIDOC ## getSubscriberByEmail(string $email) ### Description Returns all list memberships for a single email address across the whole account. ### Method Signature `getSubscriberByEmail(string $email)` ### Parameters #### Path Parameters - **email** (string) - Required - The email address of the subscriber to retrieve. ``` -------------------------------- ### updateList(string $list_id, array $data) - Update a list Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Updates the metadata of an existing contact list identified by its ID with the provided data. ```APIDOC ### `updateList(string $list_id, array $data)` — Update a list Updates list metadata and returns the updated list. ```php updateList('1', [ 'name' => 'Newsletter 2024', 'from_name' => 'My Brand', 'from_email' => 'news@mybrand.com', ]); ``` ``` -------------------------------- ### Delete Sending Domain - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Removes a domain from the account. Requires the ID of the domain to be deleted. ```php deleteDomain(3); ?> ``` -------------------------------- ### Send Transactional Email - PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Sends a one-off transactional email with full HTML/text body control. Requires an array containing message details such as subject, sender, recipients, and content. ```php sendTransactionalEmail([ 'message' => [ 'subject' => 'Your password has been reset', 'from_name' => 'My Shop Security', 'from_email' => 'security@myshop.com', 'to' => [ ['email' => 'jane@example.com', 'name' => 'Jane'], ], 'html' => '

Click here to set a new password.

', 'text' => 'Reset your password: {{reset_link}}', ], ]); ?> ``` -------------------------------- ### refreshDataFeed Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Triggers a re-import of a custom data feed. ```APIDOC ## refreshDataFeed(string $feedId) ### Description Triggers a re-import of a custom data feed. ### Method `refreshDataFeed` ### Parameters #### `$feedId` (string) - Required The ID of the data feed to refresh. ### Request Example ```php $ecomail->refreshDataFeed('datafeed_456'); ``` ``` -------------------------------- ### deleteDomain(int $id) Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Removes a sending domain from the account. Requires the ID of the domain to be deleted. ```APIDOC ## deleteDomain(int $id) ### Description Removes a sending domain from the account. ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the domain to remove. ### Request Example ```php $ecomail->deleteDomain(3); ``` ``` -------------------------------- ### Search Contacts Globally - Ecomail PHP Source: https://context7.com/ecomailcz/ecomail-php/llms.txt Performs a full-text search for contacts across all lists by name, email, or custom fields. Iterates through results to display email addresses. ```php search('jane@example.com'); foreach ($results as $contact) { echo $contact['email'] . PHP_EOL; } ```