Commit ea4d20b
authored
feat: slack support (#4)
* feat: add Slack bot support via Socket Mode
Implement Slack as a second messaging platform alongside Telegram.
Uses slack-bolt with Socket Mode (WebSocket, no public URL needed).
Handles text, image, and audio messages. Adds generalized
platform_images table for cross-platform image retrieval, setup wizard
and CLI command (`memclaw slack`), and updated documentation.
* docs: note Slack App Home Messages Tab requirement
Without this toggle, DMs to the bot show "Sending messages to this app has been turned off" with no clear path to fix.
* docs: add Slack app manifest for one-click setup
Lets users create the Slack app via "From a manifest" instead of
clicking through scopes, events, and the App Home toggles by hand.
* feat: constrain agent replies to messaging-app-safe markdown
Messaging clients render different (or no) markdown dialects, so the
agent's full markdown output (`**bold**`, `# headings`, fenced code) was
leaking as literal characters in Slack and WhatsApp. Pin the agent to a
minimal common syntax — single-asterisk bold, underscore italic, plain
dashes for bullets, no headings or backticks — that renders cleanly
across Slack mrkdwn, WhatsApp, and Telegram.
Also flip the Telegram handler to parse_mode="Markdown" so `*bold*` and
`_italic_` actually render, with a plain-text fallback if the agent
emits something the legacy parser rejects.
* fix: enforce channel-scoped tokens as required during their channel's setup
`memclaw slack` was prompting SLACK_BOT_TOKEN and SLACK_APP_TOKEN as
"(optional)" even though the CLI immediately errored out after setup if
they were missing — so the wizard happily accepted blank input that the
bot couldn't run with. Same lie applied to TELEGRAM_BOT_TOKEN.
Mark those tokens required=True and extend the wizard so a channel-scoped
required key enforces only when invoked via that channel; `memclaw
configure` still lets users edit anything without forcing slack/telegram
keys on telegram-only/slack-only users.
Also drop the duplicate ", optional" suffix from the SLACK_ALLOWED_CHANNELS
label that was rendering as "... optional) (optional):".
* docs: tell the agent it can fetch and save links
Handlers already pre-fetch and summarise URLs into a `[Link summary]`
block, but the agent's capability list never mentioned it — so it
wouldn't surface the feature when users asked what it can do.
* test: update reply_text assertion for new parse_mode argument
Telegram handler now passes parse_mode="Markdown" so the agent's
single-asterisk bold actually renders. The handler test was still
asserting the old plain-text call signature.1 parent 2ff9ba2 commit ea4d20b
12 files changed
Lines changed: 543 additions & 16 deletions
File tree
- memclaw
- bot
- defaults
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
91 | 162 | | |
92 | 163 | | |
93 | 164 | | |
94 | 165 | | |
95 | 166 | | |
96 | 167 | | |
97 | | - | |
| 168 | + | |
98 | 169 | | |
99 | 170 | | |
100 | 171 | | |
| |||
117 | 188 | | |
118 | 189 | | |
119 | 190 | | |
| 191 | + | |
120 | 192 | | |
121 | 193 | | |
122 | 194 | | |
| |||
233 | 305 | | |
234 | 306 | | |
235 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
236 | 311 | | |
237 | 312 | | |
238 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
28 | 40 | | |
29 | 41 | | |
30 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| |||
0 commit comments