I'm trying to use the Canvas REST API to automate the sending of emails on student progress, that is sending "Conversations" to users. I can do so successfully without attachments, but when I try to include an attachment, which has been uploaded to my “conversation attachments” folder, it gives me a response 500 error.
To try to make sure that I'm doing this correctly, I've done the following.
1. I first manually send a test email and attach an attachment which is a png file of size roughly 20KB. The attachment gets uploaded to my "conversation attachments" folder. I can then query it using the REST API and find its id and other attributes. The test email is sent correctly.
2. I upload a similar attachment file to my "conversations attachments" folder using the REST API and checked that it appears in the folder and has identical attributes (e.g. mime_class, hidden, etc.) So both the attachment in 1, and the REST API uploaded attachment, are in the same "conversations attachments" folder and do not seem to have any obvious differences between them.
3. If I try to send an message using the API "Create a conversation", it works fine with no attachment, but with using either the attachment id of the attachment created in 1, or using 2 as explained above, the email does not get sent and I get a response 500 error and the email is not sent. The body of the POST that I send has as its body:
Any help trying to understand what I'm doing wrong would be greatly appreciated!