Bulk load messages with images


I am attempting to write a script to create a bulk import file from messages exported from Element and include images (and other media files). In the Element export it looks like posts with images are treated as a message by themselves, while in the Mattermost bulk import format they are “attachments”. Bulk loading data — Mattermost documentation seems to indicate that the path to the images should be on the local filesystem, but the bulk upload is in a zipfile, so I was assuming that it would be a relative path to the images inside the zip. An example JSONL entry out of my import file looks like the following (lines broken for readability) with the images in a directory in the zipfile called ima.

      "attachments":[{"text":"image ima_04ea3d5.jpeg"}]

So this isn’t quite working–I get all the messages fine, but none of the images appear. I must be missing something with respect to actually getting the media files into Mattermost because when browsing my S3 bucket I don’t see any of the images that should be there.

How can I get the images onto the Mattermost installation and how do I need to reference them in the import file?