symphony.bdk.core.service.message.model.Message#
- class symphony.bdk.core.service.message.model.Message(content: str, data=None, silent=True, attachments: Optional[List[Union[IO, Tuple[IO, IO]]]] = None, version: str = '')#
Bases:
object
Class holding message information, used in
MessageService
to send a message. To know more about the format, see Create Message.- __init__(content: str, data=None, silent=True, attachments: Optional[List[Union[IO, Tuple[IO, IO]]]] = None, version: str = '')#
Builds a message.
- Parameters
content – the MessageML content to be sent. This is mandatory If there is no <messageML> tags, they will be added to the content.
data – an object (e.g. dict) that will be serialized into JSON using
json.dumps
.silent – the bool flag determine if the updated message will be marked as read (when it is true and it s the default value) or unread (when it is false)
attachments – list of attachments or list of (attachment, previews). These must be opened files either in binary or text mode. Previews are optional but if present, all attachments must have a preview.
version – Optional message version in the format “major.minor”. If empty, defaults to the latest supported version.
- Raises
MessageCreationError – if content is None, or if number of previews different than the number of attachments (in case there is at least one preview).
Methods
__init__
(content[, data, silent, ...])Builds a message.
Attributes
List of attachments
Message content
Message data
List of previews
Message silent flag
Message format version.
- property attachments: List[IO]#
List of attachments
- Returns
the list of attachments
- property content: str#
Message content
- Returns
the messageML content
- property data: str#
Message data
- Returns
the data as a JSON string
- property previews: List[IO]#
List of previews
- Returns
the list of previews
- property silent: str#
Message silent flag
- Returns
the message silent value
- property version: str#
Message format version.
- Returns
the message format version