Skip to main content

File and Image Handling

This section covers how your app receives files and inline images and reads their bytes, and how it sends images back.

Preview

The high-level file API is being rolled out incrementally. Today it supports receiving files attached to messages in personal (1:1) chats via the TypeScript, Python, and C# SDKs. Inline images use the raw activity attachments instead.

Files vs. attachments

In personal scope, activity.attachments carries every non-text part: files the user attached, inline images, Adaptive Cards, @mentions, link previews, and other content the client or the platform adds. A file is the specific subset of attachments that describes a document the user attached, one whose content_type is file.download.info.

The ctx.files accessor is the attached-file view over that raw array. It maps each attached file to a lazy handle you can download from, and skips everything else. The original activity.attachments array is always available when you need the raw payload or a non-file attachment.

An inline image is an image attachment with an authenticated download URL, commonly paired with an HTML attachment that describes where the image appeared in the composed message. Inline images are not surfaced by the high-level file API.

Sending works similarly: an image you send is an attachment whose content type is an image MIME type, which is why it renders inline rather than arriving as a document.

In this section

  • Receiving Files — read files a user attaches to a message, stream or download their bytes, and handle unsupported scopes, expired links, and agentic users.
  • Receiving Inline Images — identify images pasted into a message and download their bytes with the authenticated HTTP client.
  • Sending Inline Images — send an image that renders directly in the conversation, from a hosted URL or as base64-encoded bytes, within the platform's size and format limits.

Resources