Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.ht

## [Unreleased]

### Fixed

- `recipients=[{"phone": ...}]` now applies the same `phone` → `phones` alias
as the singular `recipient=` argument.

## [0.7.1] - 2026-09-04

### Added
Expand Down
8 changes: 7 additions & 1 deletion src/calle/calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ def create(
raise ValueError("Pass either recipient or recipients, not both.")
body = {
"task": task,
"recipients": [_normalize_recipient(recipient)] if recipient is not None else recipients,
"recipients": (
[_normalize_recipient(recipient)]
if recipient is not None
else [_normalize_recipient(item) for item in recipients]
if recipients is not None
else None
),
"result_schema": result_schema,
"recipient_result_schema": recipient_result_schema,
"metadata": metadata,
Expand Down
14 changes: 14 additions & 0 deletions tests/test_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ def test_create_call_sends_auth_and_idempotency_headers() -> None:
assert "result_validation" not in call


@respx.mock
def test_create_call_aliases_phone_on_recipients_list() -> None:
route = respx.post("https://api.heycall-e.com/v1/calls").mock(return_value=httpx.Response(200, json=COMPLETED_CALL))
client = CalleClient(api_key="key_test", base_url="https://api.heycall-e.com")

client.calls.create(
task="Call.",
recipients=[{"phone": "+14155550100", "region": "US", "locale": "en-US"}],
)

payload = json.loads(route.calls.last.request.content)
assert payload["recipients"] == [{"phones": ["+14155550100"], "region": "US", "locale": "en-US"}]


@respx.mock
def test_create_call_can_send_task_only_request() -> None:
route = respx.post("https://api.heycall-e.com/v1/calls").mock(return_value=httpx.Response(200, json=COMPLETED_CALL))
Expand Down