Skip to content

Commit b880d0d

Browse files
authored
Merge pull request #182 from livechat/re-353--campaigns-conversion-endpoint-37
feat(reports): add /campaigns/campaigns_conversion to v3.7 sdk client
2 parents 448b946 + 7eeff11 commit b880d0d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
1212
- New methods in configuration-api v3.7 for canned responses: `create_canned_response`, `update_canned_response`, `list_canned_responses`, `delete_canned_response`.
1313
- New method `request_thread_summary` in agent-api v3.6 and v3.7.
1414
- New flag `name_is_default` in method `update_customer` in customer-api v3.6 and v3.7.
15+
- New method in reports-api v3.7: report `campaigns_conversion`.
1516

1617
### Changed
1718
- Udated python version from 3.8 to 3.13.0 (version 3.8 was unsupported since 2024-10-07).

livechat/reports/api/v37.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,3 +540,35 @@ def unique_visitors(self,
540540
return self.session.post(f'{self.api_url}/customers/unique_visitors',
541541
json=payload,
542542
headers=headers)
543+
544+
# Campaigns
545+
546+
def campaigns_conversion(self,
547+
distribution: str = None,
548+
timezone: str = None,
549+
filters: dict = None,
550+
payload: dict = None,
551+
headers: dict = None) -> httpx.Response:
552+
''' Shows the number of campaigns sent and how many of those resulted in a chat or a goal.
553+
554+
Args:
555+
distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
556+
timezone (str): IANA Time Zone (e.g. America/Phoenix).
557+
Defaults to the requester's timezone.
558+
When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
559+
filters (dict): If none provided, your report will span the last seven days.
560+
payload (dict): Custom payload to be used as request's data.
561+
It overrides all other parameters provided for the method.
562+
headers (dict): Custom headers to be used with session headers.
563+
They will be merged with session-level values that are set,
564+
however, these method-level parameters will not be persisted across requests.
565+
566+
Returns:
567+
httpx.Response: The Response object from `httpx` library,
568+
which contains a server's response to an HTTP request.
569+
'''
570+
if payload is None:
571+
payload = prepare_payload(locals())
572+
return self.session.post(f'{self.api_url}/campaigns/campaigns_conversion',
573+
json=payload,
574+
headers=headers)

0 commit comments

Comments
 (0)