Skip to content

Commit 970fc17

Browse files
fix: Allow Ampersands in RCS From field. (#321)
1 parent f83f91c commit 970fc17

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

messages/src/vonage_messages/models/rcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class BaseRcs(BaseMessage):
3030
"""
3131

3232
to: PhoneNumber
33-
from_: str = Field(..., serialization_alias='from', pattern='^[a-zA-Z0-9-_]+$')
33+
from_: str = Field(..., serialization_alias='from', pattern='^[a-zA-Z0-9-_&]+$')
3434
ttl: Optional[int] = Field(None, ge=300, le=259200)
3535
channel: ChannelType = ChannelType.RCS
3636

messages/tests/test_rcs_models.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@ def test_create_rcs_text():
2525
assert rcs_model.model_dump(by_alias=True, exclude_none=True) == rcs_dict
2626

2727

28+
def test_create_rcs_text_with_ampersand():
29+
"""Tests that RCS from fields will allow an ampersand (&) character.
30+
31+
See also: DEVX-10155
32+
"""
33+
rcs_model = RcsText(
34+
to='1234567890',
35+
from_='Acme&SonsCo',
36+
text='Hello, World!',
37+
)
38+
rcs_dict = {
39+
'to': '1234567890',
40+
'from': 'Acme&SonsCo',
41+
'text': 'Hello, World!',
42+
'channel': 'rcs',
43+
'message_type': 'text',
44+
}
45+
46+
assert rcs_model.model_dump(by_alias=True, exclude_none=True) == rcs_dict
47+
48+
2849
def test_create_rcs_text_all_fields():
2950
rcs_model = RcsText(
3051
to='1234567890',

0 commit comments

Comments
 (0)