Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
32 changes: 32 additions & 0 deletions livechat/reports/api/v37.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)