Skip to content

MediaUploadInput

MediaUploadInput = Blob | { file: MediaBytes; filename?: string; type?: string; }

Defined in: src/types/media.ts:21

Input accepted by MediaResource.upload.

Either a Blob/File directly (its type is used as the content type), or an object wrapping raw bytes with an explicit content type and optional display filename. When bytes carry no inferable content type and none is supplied, upload throws WhatsAppValidationError.

Blob


{ file: MediaBytes; filename?: string; type?: string; }

file: MediaBytes

File contents as a Blob/File, Uint8Array, or ArrayBuffer.

optional filename?: string

Display filename for the uploaded file part.

optional type?: string

MIME content type, e.g. image/jpeg. Required when it can’t be inferred.

Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.