Sending and receiving messages is demonstrated numerous times in the BDK 2.0 courses. Please refer to the demos at the end of the chapters. Attachments are an optional field in the Message object, which accepts any type of InputStream. An example using FileInputStream
would look like this:
// Java
Attachment file = new Attachment(new FileInputStream("./data.csv"), "data.csv");
Message msg = Message.builder().attachments(List.of(file)).content("Hello").build();
bdk.messages().send(streamId, msg);
# Python
with open("data.csv", "rb") as file:
await bdk.messages().send_message(stream_id, Message(content="Hello", attachments=[file]))