(20250807) - Fixed Number validation issue for whatsapp nimbus whatsapp send - for value recipientNo.
This commit is contained in:
@@ -177,6 +177,12 @@ class NimbusWhatsappSendMessageResponse(BaseModel):
|
||||
default = None
|
||||
)
|
||||
|
||||
countryCode : str | None = Field(
|
||||
description="",
|
||||
frozen=True,
|
||||
default="91"
|
||||
)
|
||||
|
||||
# ┏┓ ┏•
|
||||
# ┃ ┏┓┏┓╋┓┏┓
|
||||
# ┗┛┗┛┛┗┛┗┗┫
|
||||
@@ -198,6 +204,16 @@ class NimbusWhatsappSendMessageResponse(BaseModel):
|
||||
if isinstance(value, str): value = [value]
|
||||
return value
|
||||
|
||||
# @field_validator("countryCode", mode="before")
|
||||
# def validate_country_code(cls, value):
|
||||
# if not isinstance(value, str):
|
||||
# raise ValueError("Country code must be a string.")
|
||||
#
|
||||
# if any(c.alpha2 == value for c in countries):
|
||||
# return value
|
||||
#
|
||||
# raise ValueError(f"Invalid country code: {value}")
|
||||
|
||||
# ┏┓ ┏┓
|
||||
# ┃ ┓┏┏╋┏┓┏┳┓ ┣ ┓┏┏┓┏┏
|
||||
# ┗┛┗┻┛┗┗┛┛┗┗ ┻ ┗┻┛┗┗┛
|
||||
@@ -222,6 +238,9 @@ class NimbusWhatsappSendMessageResponse(BaseModel):
|
||||
timezone = date_time.TIMEZONE_IST
|
||||
).strftime("%Y%m%d%H%M")
|
||||
|
||||
# For country code:
|
||||
if self.countryCode: api_input["country"] = self.countryCode
|
||||
|
||||
# Done here:
|
||||
return api_input
|
||||
|
||||
|
||||
Reference in New Issue
Block a user