Skip to main content
Use attachment() to send files. Pass a file path, a URL, or a Buffer. MIME types are detected from the file extension. Override with options.mimeType when you already have the bytes.
If the MIME type can’t be inferred from the name and you didn’t pass options.mimeType, attachment() throws when the content is built.

Attachment IDs

Every resolved attachment carries a stable id. When the attachment originates from a provider, the ID preserves the provider-native identifier, such as an iMessage GUID, Slack file ID, or WhatsApp media ID. For outbound attachments built with attachment(), Spectrum assigns a random UUID unless you pass options.id:
Use the resolved and accepted input types in your own signatures: