Message Service#
The Message Service is a component at the service layer of the BDK which aims to cover the Messages part of the REST API documentation. More precisely:
How to use#
The central component for the Message Service is the MessageService class.
This class exposes the user-friendly service APIs which serve all the services mentioned above
and is accessible from the SymphonyBdk object by calling the messages() method:
import asyncio
from symphony.bdk.core.config.loader import BdkConfigLoader
from symphony.bdk.core.service.message.model import Message
from symphony.bdk.core.symphony_bdk import SymphonyBdk
class MessageMain:
    @staticmethod
    async def run():
        stream_id_1 = "stream-id-1"
        bdk_config = BdkConfigLoader.load_from_file("path/to/config.yaml")
    
        async with SymphonyBdk(bdk_config) as bdk:
            message_service = bdk.messages()
            with open("/path/to/attachment1", "rb") as file1, \
                    open("/path/to/attachment2", "rb") as file2:
                await message_service.send_message(
                    stream_id_1,
                    Message(content="<messageML>Hello, World!</messageML>", attachments=[file1, file2])
                )
if __name__ == "__main__":
    asyncio.run(MessageMain.run())