fix: apply phone alias to recipients lists - #41
Open
Arshgill01 wants to merge 2 commits into
Open
Arshgill01 wants to merge 2 commits into
Arshgill01 wants to merge 2 commits into
Conversation
Author
cursor
Bot
force-pushed
the
fix/recipients-phone-alias
branch
3 times, most recently
from
September 24, 2026 04:04
0bf9fbe to
7c83c92
Compare
Map every recipients= item through _normalize_recipient so phone becomes phones, matching recipient=. On the 1.0 single-target API the resolved number is submitted as phone. Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Arshdeep singh <arshgill6120@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebased onto SDK 1.0
main.client.calls.create()now acceptsrecipient=/recipients=dicts in addition tophone=, and a dict written with the TypeScript-stylephonekey is aliased tophonesbefore the number is resolved. Whatever the input shape, the request sent toPOST /v2/callsuses the 1.0 single-target body with onephonefield.What changed
src/calle/calls.pycreate():phoneis now optional, andrecipient: JsonObject | Noneandrecipients: list[JsonObject] | Nonewere added.recipient=/recipients=item goes through_normalize_recipient, which rewrites{"phone": x}to{"phones": [x]}. Items that already havephonesare left as they are._target_from_recipientstakes the single normalized item and returns(phone, region, locale): the first entry inphones, plus the item'sregion/localeunless the explicitregion=/locale=kwargs are set, in which case the kwargs win.create()raisesValueErrorwhen:recipientandrecipientsare both passedphoneis passed together withrecipientorrecipientsrecipientsholds anything other than exactly one item ("The Calls API does not support batch recipients.")CHANGELOG.md: adds an[Unreleased]/Fixedentry.1.0 wire format
In 1.0 the endpoint is
/v2/callsand takes a singlephone. This PR does not send arecipientsarray. For example,recipients=[{"phone": "+14155550100", "region": "US", "locale": "en-US"}]produces a body with"phone": "+14155550100", "region": "US", "locale": "en-US"and norecipientskey. If you pass more than one recipient, the SDK raises before any request is made.Tests
New tests in
tests/test_calls.py, run offline against arespxmock (no live calls):test_create_call_aliases_phone_on_recipients_listtest_create_call_aliases_phone_on_singular_recipienttest_normalize_recipient_aliases_phone_to_phonesThe first two check that the posted body has the resolved
phone,regionandlocale, and has norecipientskey.Run on the rebased head
efad48a:Source
From the CALL-E hackathon feedback lab: https://github.com/Arshgill01/ExactRef/blob/main/docs/feedback/lab/XR-110-python-recipients-skip-phone-alias.md