care.utils.sms.message module

class TextMessage(content: str = '', sender: str | None = None, recipients: list[str] | None = None, backend: type[SmsBackendBase] | None = None, fail_silently: bool = False)

Bases: object

Represents a text message for transmission to one or more recipients.

__init__(content: str = '', sender: str | None = None, recipients: list[str] | None = None, backend: type[SmsBackendBase] | None = None, fail_silently: bool = False) None

Initialize a TextMessage instance.

Parameters:
  • content (str) – The message content.

  • sender (Optional[str]) – The sender’s phone number.

  • recipients (Optional[List[str]]) – List of recipient phone numbers.

  • backend (Optional[SmsBackendBase]) – Backend for sending the message.

dispatch(fail_silently: bool = False) int

Send the message to all designated recipients.

Parameters:

fail_silently (bool) – Whether to suppress errors during message sending.

Returns:

Count of successfully sent messages.

Return type:

int