message.raw.attachments. Each attachment includes the filename, MIME type, and a URL to download the content.
Attachment shape
Detecting and processing attachments
Try it yourself
Attachments Example
Detects attachments and replies with a summary
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Handle inbound email attachments with the Chat SDK adapter.
message.raw.attachments. Each attachment includes the filename, MIME type, and a URL to download the content.
interface ResendAttachment {
filename: string;
contentType: string;
url?: string;
}
| Field | Type | Description |
|---|---|---|
filename | string | Original filename (e.g., invoice.pdf) |
contentType | string | MIME type (e.g., application/pdf) |
url | string | Optional download URL for the attachment content |
chat.onNewMention(async (thread, message) => {
const attachments = message.raw?.attachments ?? [];
if (attachments.length === 0) {
await thread.subscribe();
await thread.post('Got your email — no attachments found.');
return;
}
const summary = attachments
.map((a) => `${a.filename} (${a.contentType})`)
.join(', ');
await thread.subscribe();
await thread.post(`Received ${attachments.length} attachment(s): ${summary}`);
});
Was this page helpful?