diff --git a/changelog.md b/changelog.md index 0bf69af..80d37b4 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. - New methods in configuration-api v3.7 for canned responses: `create_canned_response`, `update_canned_response`, `list_canned_responses`, `delete_canned_response`. - New method `request_thread_summary` in agent-api v3.6 and v3.7. - New flag `name_is_default` in method `update_customer` in customer-api v3.6 and v3.7. +- New method in reports-api v3.7: report `campaigns_conversion`. ### Changed - Udated python version from 3.8 to 3.13.0 (version 3.8 was unsupported since 2024-10-07). diff --git a/livechat/reports/api/v37.py b/livechat/reports/api/v37.py index 20cc6bc..75c7b4c 100644 --- a/livechat/reports/api/v37.py +++ b/livechat/reports/api/v37.py @@ -540,3 +540,35 @@ def unique_visitors(self, return self.session.post(f'{self.api_url}/customers/unique_visitors', json=payload, headers=headers) + +# Campaigns + + def campaigns_conversion(self, + distribution: str = None, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Shows the number of campaigns sent and how many of those resulted in a chat or a goal. + + Args: + distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`. + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + payload (dict): Custom payload to be used as request's data. + It overrides all other parameters provided for the method. + headers (dict): Custom headers to be used with session headers. + They will be merged with session-level values that are set, + however, these method-level parameters will not be persisted across requests. + + Returns: + httpx.Response: The Response object from `httpx` library, + which contains a server's response to an HTTP request. + ''' + if payload is None: + payload = prepare_payload(locals()) + return self.session.post(f'{self.api_url}/campaigns/campaigns_conversion', + json=payload, + headers=headers)