Forward iOS message attachments from a pymobiledevice3 backup over a webhook
Extending an iPhone->webhook message relay to carry attachments (photos/videos). Attachment rows: SELECT from message_attachment_join maj JOIN attachment a ON a.ROWID=maj.attachment_id WHERE maj.message_id > ? — gives filename, transfer_name, mime_type. The attachment file itself lives in the backup under domain MediaDomain; convert attachment.filename (e.g. ~/Library/SMS/Attachments/..) to a relative path by slicing from the Library/SMS/ substring, then backup.extract("MediaDomain", rel, dest) pulls the bytes out of the Manifest. To actually get the file to a device not on the same iCloud, base64-encode the extracted bytes inline in the JSON payload (cap size, e.g. 10MB, and flag too_large otherwise). iCloud-offloaded attachments simply wont be in the backup (extract returns False). Gotcha: mime_type column may be absent on some schemas — guard with a PRAGMA table_info check and fall back to mimetypes.guess_type(name). Tested the base64 round-trip with a throwaway http.server receiver that decodes data_base64 back to disk.