publ betaReference (MCP guide)
Open publ console

messenger_media_upload_apply

# messenger_media_upload_apply

Upload one chat media file in the Messenger app (pApp D00003). From this computer: target.upload {kind:"local-file", filename, byteLength, sha256} returns one presigned PUT with its headers and the console room link; send the file, then apply again with the same request and upload {kind:"complete", uploadId, parts:[{partNumber:1, etag}]}. The server never receives the file or downloads a link. Requires the target of messenger_media_upload_get, change {action:"upload"}. The room must be open; as in the console attach menu, the operator media switches of the room are not checked. Write: uploads to storage only and sends no message. A VIDEO next needs messenger_media_encode_apply. A lost receipt stays pending and is never resent; task_resume only observes, and prepared work needs the identical apply. Called without confirmToken it previews and returns a confirmToken; repeating the same input with it executes once.

## Inputs

| Field | Required here | Contract |
| --- | --- | --- |
| `target` | Yes | object |
| `target.destination` | Yes | one of: `room`, `promotion` (by `kind`); The chat room the media is for (DIRECT or GROUP), or {kind:"promotion"} for a Send to All image (PNG or JPEG only, with the promotion extension Z00003). |
| `target.destination.roomUuid` | Yes | When `target.destination.kind` is `room`: string; pattern `^[A-Za-z0-9_-]{1,200}$` |
| `target.destination.roomType` | Yes | When `target.destination.kind` is `room`: `DIRECT`, `GROUP` |
| `target.messageType` | Yes | `IMAGE`, `ATTACHMENT`, `VIDEO`; IMAGE (PNG/JPEG/GIF up to 10 MB, uploaded unchanged; metadata is not removed), ATTACHMENT (PDF, DOC, DOCX, DOCM or ZIP up to 30 MB) or VIDEO (MP4, MOV, M4V, AVI, WMV or MKV up to 100 MB; then encode). Voice recordings are not hosted. |
| `target.upload` | Yes | one of: `local-file`, `more-parts`, `complete`, `cancel` (by `kind`); Upload the file from this computer, as the console room uploader does: {kind:"local-file", filename, byteLength, sha256} on the apply returns one presigned PUT with its headers (size, type and SHA-256 signed) and the console room link; send the file, then apply again with the same requestId and upload {kind:"complete", uploadId, parts:[{partNumber:1, etag}]}. A Google Drive or other link must be downloaded to this computer first; the server never receives the file or downloads a link. |
| `target.upload.filename` | Yes | When `target.upload.kind` is `local-file`: string; min length 1; max length 240; pattern `^[^/\\:\x00-\x1f\x7f]+$`; The name of the file on this computer, with its extension. |
| `target.upload.byteLength` | Yes | When `target.upload.kind` is `local-file`: integer; greater than 0; The exact file size in bytes (for example from `wc -c < FILE` or `stat`). |
| `target.upload.sha256` | No | When `target.upload.kind` is `local-file`: string; pattern `^[0-9a-f]{64}$`; The SHA-256 of the file in lowercase hex (shasum -a 256 FILE). Required when the upload answers UPLOAD_CHECKSUM_REQUIRED. |
| `target.upload.uploadId` | Yes | When `target.upload.kind` is `more-parts`: string; pattern `^upl_[A-Za-z0-9_-]{22}$` |
| `target.upload.fromPart` | Yes | When `target.upload.kind` is `more-parts`: integer; minimum 1; maximum 10000 |
| `target.upload.uploadId` | Yes | When `target.upload.kind` is `complete`: string; pattern `^upl_[A-Za-z0-9_-]{22}$` |
| `target.upload.parts` | Yes | When `target.upload.kind` is `complete`: array; min items 1; max items 10000 |
| `target.upload.parts[].partNumber` | Yes | When `target.upload.kind` is `complete`: integer; minimum 1; maximum 10000 |
| `target.upload.parts[].etag` | Yes | When `target.upload.kind` is `complete`: string; min length 1; max length 200 |
| `target.upload.measured` | No | When `target.upload.kind` is `complete`: object; What the video measures on this computer, read with measureCommand. |
| `target.upload.measured.durationSeconds` | Yes | When `target.upload.kind` is `complete`: number; maximum 1000000; greater than 0; Video duration in seconds (ffprobe format.duration). |
| `target.upload.measured.frameRate` | Yes | When `target.upload.kind` is `complete`: number; maximum 1000; greater than 0; Frames per second (ffprobe avg_frame_rate, for example 30000/1001 = 29.97). |
| `target.upload.measured.width` | Yes | When `target.upload.kind` is `complete`: integer; maximum 100000; greater than 0 |
| `target.upload.measured.height` | Yes | When `target.upload.kind` is `complete`: integer; maximum 100000; greater than 0 |
| `target.upload.measured.frameRateMode` | No | When `target.upload.kind` is `complete`: `CFR`, `VFR`; Constant or variable frame rate, when the tool reports it. |
| `target.upload.measured.minFrameRate` | No | When `target.upload.kind` is `complete`: number; maximum 1000; greater than 0 |
| `target.upload.measured.maxFrameRate` | No | When `target.upload.kind` is `complete`: number; maximum 1000; greater than 0 |
| `target.upload.uploadId` | Yes | When `target.upload.kind` is `cancel`: string; pattern `^upl_[A-Za-z0-9_-]{22}$` |
| `change` | Yes | object |
| `change.action` | Yes | `upload` |
| `confirmToken` | No | string; pattern `^ct[a-f\d]{32}$`; The confirmToken from this tool's preview result. Omit it to preview; repeat the same input with it to execute. |