Skip to content

Commit 68e71fe

Browse files
feat(opencode-router): add first-class media transport for Slack and Telegram (anomalyco#711)
1 parent 3bef68e commit 68e71fe

13 files changed

Lines changed: 1856 additions & 116 deletions

File tree

‎packages/docs/opencode-router.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ description: "What opencode-router is and when to use it"
1010
- Routes messages using `(channel, identity, peer) -> directory` bindings.
1111
- Lets teams interact with workers from Slack or Telegram.
1212
- Keeps chat surfaces mapped to the correct workspace.
13+
- Handles text, files, images, and audio as first-class message parts.
1314

1415
## Quick start
1516

@@ -38,6 +39,7 @@ opencode-router telegram list
3839
opencode-router slack list
3940
opencode-router bindings list
4041
opencode-router bindings set --channel telegram --identity default --peer <chatId> --dir /path/to/workdir
42+
opencode-router send --channel slack --identity default --to D123 --file ./report.pdf
4143
```
4244

4345
## In OpenWork UI

‎packages/opencode-router/README.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ Slack support uses Socket Mode and replies in threads when @mentioned in channel
7575
- `chat:write`
7676
- `app_mentions:read`
7777
- `im:history`
78+
- `files:read`
79+
- `files:write`
7880
4) Subscribe to events (bot events):
7981
- `app_mention`
8082
- `message.im`
@@ -115,6 +117,33 @@ curl -sS "http://127.0.0.1:${OPENCODE_ROUTER_HEALTH_PORT:-3005}/send" \
115117
-d '{"channel":"telegram","directory":"/path/to/workdir","text":"hello"}'
116118
```
117119

120+
Send text + media in one request:
121+
122+
```bash
123+
curl -sS "http://127.0.0.1:${OPENCODE_ROUTER_HEALTH_PORT:-3005}/send" \
124+
-H 'Content-Type: application/json' \
125+
-d '{
126+
"channel":"slack",
127+
"peerId":"D12345678",
128+
"text":"Here is the export",
129+
"parts":[
130+
{"type":"file","filePath":"./artifacts/report.pdf"},
131+
{"type":"image","filePath":"./artifacts/plot.png","caption":"latest trend"}
132+
]
133+
}'
134+
```
135+
136+
Supported media part types:
137+
- `image`
138+
- `audio`
139+
- `file`
140+
141+
Each media part accepts:
142+
- `filePath` (absolute path, or relative to the send directory/workspace root)
143+
- optional `caption`
144+
- optional `filename`
145+
- optional `mimeType`
146+
118147
## Commands
119148

120149
```bash
@@ -129,6 +158,10 @@ opencode-router slack add <xoxb> <xapp> --id default
129158

130159
opencode-router bindings list
131160
opencode-router bindings set --channel telegram --identity default --peer <chatId> --dir /path/to/workdir
161+
162+
opencode-router send --channel telegram --identity default --to <chatId> --message "hello"
163+
opencode-router send --channel telegram --identity default --to <chatId> --image ./plot.png --caption "plot"
164+
opencode-router send --channel slack --identity default --to D123 --file ./report.pdf
132165
```
133166

134167
## Defaults

0 commit comments

Comments
 (0)