GetExternalContactAction json mapping for phone lookup

How do I correctly to pass dynamic phone number into GetExternalContactAction in cxone architect? im trying to map contact.phoneNumber to the request body but getting 400 bad request. my payload looks like { "number": "{{contact.phoneNumber}}" } but the endpoint expects e164 format. is there a native transformation step i can add inside the action config or do i need a separate data action first? this feels like a broken flow for basic lookups.

Check your data types. The action expects a string, not an object. Use this mapping in the Data Action configuration:

"number": "{{ToString(contact.phoneNumber)}}"

The root of the issue is that ToString does not enforce E.164 formatting, which causes the 400 error when the source data lacks the leading +.

Cause:
The GetExternalContactAction validates against strict E.164 regex. If contact.phoneNumber is stored as 1234567890 or 07123456789, the API rejects it regardless of the string cast.

Solution:
Use a Data Action with FormatPhoneNumber before the lookup. This ensures the value matches the required schema.

# Architect Data Action Configuration
action: FormatPhoneNumber
inputs:
 input: "{{contact.phoneNumber}}"
 format: "E.164"
outputs:
 normalizedNumber: "{{result}}"

Map {{normalizedNumber}} to the GetExternalContactAction payload. This validates the structure before invocation, preventing the 400 bad request.