### 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' => '
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; } ```