xmtplabs/xmtp-agent-examples / skills/handling-attachments
handling-attachments
VerifiedFile attachment handling for XMTP agents. Use when sending or receiving images, files, or any encrypted remote attachments. Triggers on file upload, image sending, or remote attachment handling.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 1.8 KB |
| rules/receive-attachment.md | markdown | 1.2 KB |
| rules/send-remote-attachment.md | markdown | 1.1 KB |
| rules/upload-callback.md | markdown | 1.6 KB |
rules/send-remote-attachment.md
View on GitHub---
title: Send encrypted file attachments
impact: CRITICAL
tags: attachments, files, encryption, send
---
## Send encrypted file attachments
Use `sendRemoteAttachment` to send encrypted files.
**Basic usage:**
```typescript
import { type AttachmentUploadCallback } from "@xmtp/agent-sdk";
agent.on("text", async (ctx) => {
if (ctx.message.content === "/send-file") {
// Create a File object
const file = new File(["Hello, World!"], "hello.txt", {
type: "text/plain",
});
// Send the encrypted remote attachment
await ctx.conversation.sendRemoteAttachment(file, uploadCallback);
}
});
```
**Send an image:**
```typescript
import fs from "fs";
const imageBuffer = fs.readFileSync("./image.png");
const file = new File([imageBuffer], "image.png", { type: "image/png" });
await ctx.conversation.sendRemoteAttachment(file, uploadCallback);
```
**How it works:**
1. The SDK encrypts the file locally
2. Your upload callback uploads the encrypted data
3. The SDK sends a message with the URL and decryption keys
4. Recipients can download and decrypt the file
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |