cwd:// Download Actions
When an ATTACHMENT's defaultAction / downloadAction uses a cwd://<relative-path>
URI, the SDK intercepts cwd:// and fetches <botProviderEndpoint>/cwd/download
to retrieve the file and trigger a browser download, instead of window.open
(which cannot open cwd://).
This is common with sandbox / code-server style bots: the agent produces a file in
its working directory and offers a cwd:// link for the user to download.
cwd:// Download Actions
When an ATTACHMENT's defaultAction / downloadAction uses a cwd://<relative-path> URI, the SDK does not call window.open — it fetches <botProviderEndpoint>/cwd/download and triggers a browser download instead.
- The attachment shows a download icon — proving a cwd:// downloadAction (type: 'uri') is enough to render the download button; an EMIT download_file is no longer required.
- Clicking the card or the download icon fires GET <base>/cwd/download?custom_channel_id=...&relative_path=... (instead of window.open).
Highlights
- A
cwd://downloadAction(type: "uri") is enough to show the download icon — an EMITdownload_fileis no longer required. - Clicking the card or the download icon fires
GET <base>/cwd/download?custom_channel_id=...&relative_path=....
Code Example (attachment template)
template: {
type: MessageTemplateType.ATTACHMENT,
attachments: [
{
title: "sales-ranking.json",
defaultAction: { type: "uri", uri: "cwd://sales-ranking.json" },
downloadAction: { type: "uri", uri: "cwd://sales-ranking.json" },
},
],
quickReplies: [],
}
The example above runs in preview mode (
botProviderEndpoint: "skip") to show the attachment download UI; an actual download requires a Bot Provider that returnscwd://actions and serves/cwd/download.