diff --git a/messages/src/vonage_messages/models/rcs.py b/messages/src/vonage_messages/models/rcs.py index b0e98a1a..6ed1e7b7 100644 --- a/messages/src/vonage_messages/models/rcs.py +++ b/messages/src/vonage_messages/models/rcs.py @@ -30,7 +30,7 @@ class BaseRcs(BaseMessage): """ to: PhoneNumber - from_: str = Field(..., serialization_alias='from', pattern='^[a-zA-Z0-9-_]+$') + from_: str = Field(..., serialization_alias='from', pattern='^[a-zA-Z0-9-_&]+$') ttl: Optional[int] = Field(None, ge=300, le=259200) channel: ChannelType = ChannelType.RCS diff --git a/messages/tests/test_rcs_models.py b/messages/tests/test_rcs_models.py index 4723fa47..4114bcad 100644 --- a/messages/tests/test_rcs_models.py +++ b/messages/tests/test_rcs_models.py @@ -25,6 +25,27 @@ def test_create_rcs_text(): assert rcs_model.model_dump(by_alias=True, exclude_none=True) == rcs_dict +def test_create_rcs_text_with_ampersand(): + """Tests that RCS from fields will allow an ampersand (&) character. + + See also: DEVX-10155 + """ + rcs_model = RcsText( + to='1234567890', + from_='Acme&SonsCo', + text='Hello, World!', + ) + rcs_dict = { + 'to': '1234567890', + 'from': 'Acme&SonsCo', + 'text': 'Hello, World!', + 'channel': 'rcs', + 'message_type': 'text', + } + + assert rcs_model.model_dump(by_alias=True, exclude_none=True) == rcs_dict + + def test_create_rcs_text_all_fields(): rcs_model = RcsText( to='1234567890',