@rozek/nanoclaw 1.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.json +1 -0
- package/.claude/skills/add-compact/SKILL.md +135 -0
- package/.claude/skills/add-discord/SKILL.md +203 -0
- package/.claude/skills/add-gmail/SKILL.md +220 -0
- package/.claude/skills/add-image-vision/SKILL.md +94 -0
- package/.claude/skills/add-ollama-tool/SKILL.md +153 -0
- package/.claude/skills/add-parallel/SKILL.md +290 -0
- package/.claude/skills/add-pdf-reader/SKILL.md +104 -0
- package/.claude/skills/add-reactions/SKILL.md +117 -0
- package/.claude/skills/add-slack/SKILL.md +207 -0
- package/.claude/skills/add-telegram/SKILL.md +222 -0
- package/.claude/skills/add-telegram-swarm/SKILL.md +384 -0
- package/.claude/skills/add-voice-transcription/SKILL.md +148 -0
- package/.claude/skills/add-whatsapp/SKILL.md +372 -0
- package/.claude/skills/convert-to-apple-container/SKILL.md +175 -0
- package/.claude/skills/customize/SKILL.md +110 -0
- package/.claude/skills/debug/SKILL.md +349 -0
- package/.claude/skills/get-qodo-rules/SKILL.md +122 -0
- package/.claude/skills/get-qodo-rules/references/output-format.md +41 -0
- package/.claude/skills/get-qodo-rules/references/pagination.md +33 -0
- package/.claude/skills/get-qodo-rules/references/repository-scope.md +26 -0
- package/.claude/skills/qodo-pr-resolver/SKILL.md +326 -0
- package/.claude/skills/qodo-pr-resolver/resources/providers.md +329 -0
- package/.claude/skills/setup/SKILL.md +218 -0
- package/.claude/skills/update-nanoclaw/SKILL.md +235 -0
- package/.claude/skills/update-skills/SKILL.md +130 -0
- package/.claude/skills/use-local-whisper/SKILL.md +152 -0
- package/.claude/skills/x-integration/SKILL.md +417 -0
- package/.claude/skills/x-integration/agent.ts +243 -0
- package/.claude/skills/x-integration/host.ts +159 -0
- package/.claude/skills/x-integration/lib/browser.ts +148 -0
- package/.claude/skills/x-integration/lib/config.ts +62 -0
- package/.claude/skills/x-integration/scripts/like.ts +56 -0
- package/.claude/skills/x-integration/scripts/post.ts +66 -0
- package/.claude/skills/x-integration/scripts/quote.ts +80 -0
- package/.claude/skills/x-integration/scripts/reply.ts +74 -0
- package/.claude/skills/x-integration/scripts/retweet.ts +62 -0
- package/.claude/skills/x-integration/scripts/setup.ts +87 -0
- package/.env.example +1 -0
- package/.github/CODEOWNERS +10 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- package/.github/workflows/bump-version.yml +32 -0
- package/.github/workflows/ci.yml +25 -0
- package/.github/workflows/merge-forward-skills.yml +160 -0
- package/.github/workflows/update-tokens.yml +42 -0
- package/.husky/pre-commit +1 -0
- package/.mcp.json +3 -0
- package/.nvmrc +1 -0
- package/.prettierrc +3 -0
- package/CHANGELOG.md +8 -0
- package/CLAUDE.md +64 -0
- package/CONTRIBUTING.md +23 -0
- package/CONTRIBUTORS.md +15 -0
- package/LICENSE +21 -0
- package/NanoClaw_with_Web-Support.md +290 -0
- package/README.md +261 -0
- package/README_zh.md +200 -0
- package/assets/nanoclaw-favicon.png +0 -0
- package/assets/nanoclaw-icon.png +0 -0
- package/assets/nanoclaw-logo-dark.png +0 -0
- package/assets/nanoclaw-logo.png +0 -0
- package/assets/nanoclaw-profile.jpeg +0 -0
- package/assets/nanoclaw-sales.png +0 -0
- package/assets/social-preview.jpg +0 -0
- package/config-examples/mount-allowlist.json +25 -0
- package/container/Dockerfile +70 -0
- package/container/agent-runner/package-lock.json +1524 -0
- package/container/agent-runner/package.json +21 -0
- package/container/agent-runner/src/index.ts +558 -0
- package/container/agent-runner/src/ipc-mcp-stdio.ts +338 -0
- package/container/agent-runner/tsconfig.json +15 -0
- package/container/build.sh +23 -0
- package/container/skills/agent-browser/SKILL.md +159 -0
- package/container/skills/capabilities/SKILL.md +100 -0
- package/container/skills/status/SKILL.md +104 -0
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js +9 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/channels/registry.d.ts +13 -0
- package/dist/channels/registry.d.ts.map +1 -0
- package/dist/channels/registry.js +11 -0
- package/dist/channels/registry.js.map +1 -0
- package/dist/channels/registry.test.d.ts +2 -0
- package/dist/channels/registry.test.d.ts.map +1 -0
- package/dist/channels/registry.test.js +32 -0
- package/dist/channels/registry.test.js.map +1 -0
- package/dist/channels/web.d.ts +2 -0
- package/dist/channels/web.d.ts.map +1 -0
- package/dist/channels/web.js +1738 -0
- package/dist/channels/web.js.map +1 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +182 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +36 -0
- package/dist/config.js.map +1 -0
- package/dist/container-runner.d.ts +44 -0
- package/dist/container-runner.d.ts.map +1 -0
- package/dist/container-runner.js +467 -0
- package/dist/container-runner.js.map +1 -0
- package/dist/container-runner.test.d.ts +2 -0
- package/dist/container-runner.test.d.ts.map +1 -0
- package/dist/container-runner.test.js +150 -0
- package/dist/container-runner.test.js.map +1 -0
- package/dist/container-runtime.d.ts +22 -0
- package/dist/container-runtime.d.ts.map +1 -0
- package/dist/container-runtime.js +96 -0
- package/dist/container-runtime.js.map +1 -0
- package/dist/container-runtime.test.d.ts +2 -0
- package/dist/container-runtime.test.d.ts.map +1 -0
- package/dist/container-runtime.test.js +93 -0
- package/dist/container-runtime.test.js.map +1 -0
- package/dist/credential-proxy.d.ts +21 -0
- package/dist/credential-proxy.d.ts.map +1 -0
- package/dist/credential-proxy.js +95 -0
- package/dist/credential-proxy.js.map +1 -0
- package/dist/credential-proxy.test.d.ts +2 -0
- package/dist/credential-proxy.test.d.ts.map +1 -0
- package/dist/credential-proxy.test.js +134 -0
- package/dist/credential-proxy.test.js.map +1 -0
- package/dist/db.d.ts +115 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +549 -0
- package/dist/db.js.map +1 -0
- package/dist/db.test.d.ts +2 -0
- package/dist/db.test.d.ts.map +1 -0
- package/dist/db.test.js +360 -0
- package/dist/db.test.js.map +1 -0
- package/dist/env.d.ts +8 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +42 -0
- package/dist/env.js.map +1 -0
- package/dist/formatting.test.d.ts +2 -0
- package/dist/formatting.test.d.ts.map +1 -0
- package/dist/formatting.test.js +183 -0
- package/dist/formatting.test.js.map +1 -0
- package/dist/group-folder.d.ts +5 -0
- package/dist/group-folder.d.ts.map +1 -0
- package/dist/group-folder.js +44 -0
- package/dist/group-folder.js.map +1 -0
- package/dist/group-folder.test.d.ts +2 -0
- package/dist/group-folder.test.d.ts.map +1 -0
- package/dist/group-folder.test.js +29 -0
- package/dist/group-folder.test.js.map +1 -0
- package/dist/group-queue.d.ts +34 -0
- package/dist/group-queue.d.ts.map +1 -0
- package/dist/group-queue.js +263 -0
- package/dist/group-queue.js.map +1 -0
- package/dist/group-queue.test.d.ts +2 -0
- package/dist/group-queue.test.d.ts.map +1 -0
- package/dist/group-queue.test.js +341 -0
- package/dist/group-queue.test.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +518 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc-auth.test.d.ts +2 -0
- package/dist/ipc-auth.test.d.ts.map +1 -0
- package/dist/ipc-auth.test.js +434 -0
- package/dist/ipc-auth.test.js.map +1 -0
- package/dist/ipc.d.ts +32 -0
- package/dist/ipc.d.ts.map +1 -0
- package/dist/ipc.js +311 -0
- package/dist/ipc.js.map +1 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +14 -0
- package/dist/logger.js.map +1 -0
- package/dist/mount-security.d.ts +34 -0
- package/dist/mount-security.d.ts.map +1 -0
- package/dist/mount-security.js +325 -0
- package/dist/mount-security.js.map +1 -0
- package/dist/remote-control.d.ts +32 -0
- package/dist/remote-control.d.ts.map +1 -0
- package/dist/remote-control.js +185 -0
- package/dist/remote-control.js.map +1 -0
- package/dist/remote-control.test.d.ts +2 -0
- package/dist/remote-control.test.d.ts.map +1 -0
- package/dist/remote-control.test.js +321 -0
- package/dist/remote-control.test.js.map +1 -0
- package/dist/router.d.ts +8 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +37 -0
- package/dist/router.js.map +1 -0
- package/dist/routing.test.d.ts +2 -0
- package/dist/routing.test.d.ts.map +1 -0
- package/dist/routing.test.js +81 -0
- package/dist/routing.test.js.map +1 -0
- package/dist/sender-allowlist.d.ts +14 -0
- package/dist/sender-allowlist.d.ts.map +1 -0
- package/dist/sender-allowlist.js +79 -0
- package/dist/sender-allowlist.js.map +1 -0
- package/dist/sender-allowlist.test.d.ts +2 -0
- package/dist/sender-allowlist.test.d.ts.map +1 -0
- package/dist/sender-allowlist.test.js +186 -0
- package/dist/sender-allowlist.test.js.map +1 -0
- package/dist/session-commands.d.ts +47 -0
- package/dist/session-commands.d.ts.map +1 -0
- package/dist/session-commands.js +102 -0
- package/dist/session-commands.js.map +1 -0
- package/dist/session-commands.test.d.ts +2 -0
- package/dist/session-commands.test.d.ts.map +1 -0
- package/dist/session-commands.test.js +190 -0
- package/dist/session-commands.test.js.map +1 -0
- package/dist/task-scheduler.d.ts +22 -0
- package/dist/task-scheduler.d.ts.map +1 -0
- package/dist/task-scheduler.js +210 -0
- package/dist/task-scheduler.js.map +1 -0
- package/dist/task-scheduler.test.d.ts +2 -0
- package/dist/task-scheduler.test.d.ts.map +1 -0
- package/dist/task-scheduler.test.js +107 -0
- package/dist/task-scheduler.test.js.map +1 -0
- package/dist/timezone.d.ts +6 -0
- package/dist/timezone.d.ts.map +1 -0
- package/dist/timezone.js +17 -0
- package/dist/timezone.js.map +1 -0
- package/dist/timezone.test.d.ts +2 -0
- package/dist/timezone.test.d.ts.map +1 -0
- package/dist/timezone.test.js +23 -0
- package/dist/timezone.test.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/docs/APPLE-CONTAINER-NETWORKING.md +90 -0
- package/docs/DEBUG_CHECKLIST.md +143 -0
- package/docs/REQUIREMENTS.md +196 -0
- package/docs/SDK_DEEP_DIVE.md +643 -0
- package/docs/SECURITY.md +122 -0
- package/docs/SPEC.md +785 -0
- package/docs/docker-sandboxes.md +359 -0
- package/docs/nanoclaw-architecture-final.md +1063 -0
- package/docs/nanorepo-architecture.md +168 -0
- package/docs/skills-as-branches.md +662 -0
- package/groups/global/CLAUDE.md +58 -0
- package/groups/main/CLAUDE.md +246 -0
- package/launchd/com.nanoclaw.plist +32 -0
- package/package.json +45 -0
- package/repo-tokens/README.md +113 -0
- package/repo-tokens/action.yml +186 -0
- package/repo-tokens/badge.svg +23 -0
- package/repo-tokens/examples/green.svg +14 -0
- package/repo-tokens/examples/red.svg +14 -0
- package/repo-tokens/examples/yellow-green.svg +14 -0
- package/repo-tokens/examples/yellow.svg +14 -0
- package/scripts/run-migrations.ts +105 -0
- package/setup/container.ts +144 -0
- package/setup/environment.test.ts +121 -0
- package/setup/environment.ts +94 -0
- package/setup/groups.ts +229 -0
- package/setup/index.ts +58 -0
- package/setup/mounts.ts +115 -0
- package/setup/platform.test.ts +120 -0
- package/setup/platform.ts +132 -0
- package/setup/register.test.ts +257 -0
- package/setup/register.ts +177 -0
- package/setup/service.test.ts +187 -0
- package/setup/service.ts +362 -0
- package/setup/status.ts +16 -0
- package/setup/verify.ts +192 -0
- package/setup.sh +161 -0
- package/src/channels/index.ts +12 -0
- package/src/channels/registry.test.ts +42 -0
- package/src/channels/registry.ts +32 -0
- package/src/channels/web.ts +1856 -0
- package/src/cli.ts +209 -0
- package/src/config.ts +73 -0
- package/src/container-runner.test.ts +210 -0
- package/src/container-runner.ts +707 -0
- package/src/container-runtime.test.ts +149 -0
- package/src/container-runtime.ts +127 -0
- package/src/credential-proxy.test.ts +192 -0
- package/src/credential-proxy.ts +125 -0
- package/src/db.test.ts +484 -0
- package/src/db.ts +803 -0
- package/src/env.ts +42 -0
- package/src/formatting.test.ts +256 -0
- package/src/group-folder.test.ts +43 -0
- package/src/group-folder.ts +44 -0
- package/src/group-queue.test.ts +484 -0
- package/src/group-queue.ts +365 -0
- package/src/index.ts +731 -0
- package/src/ipc-auth.test.ts +679 -0
- package/src/ipc.ts +461 -0
- package/src/logger.ts +16 -0
- package/src/mount-security.ts +419 -0
- package/src/remote-control.test.ts +397 -0
- package/src/remote-control.ts +224 -0
- package/src/router.ts +52 -0
- package/src/routing.test.ts +170 -0
- package/src/sender-allowlist.test.ts +216 -0
- package/src/sender-allowlist.ts +128 -0
- package/src/session-commands.test.ts +247 -0
- package/src/session-commands.ts +163 -0
- package/src/task-scheduler.test.ts +129 -0
- package/src/task-scheduler.ts +295 -0
- package/src/timezone.test.ts +29 -0
- package/src/timezone.ts +16 -0
- package/src/types.ts +107 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +7 -0
- package/vitest.skills.config.ts +7 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-slack
|
|
3
|
+
description: Add Slack as a channel. Can replace WhatsApp entirely or run alongside it. Uses Socket Mode (no public URL needed).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Add Slack Channel
|
|
7
|
+
|
|
8
|
+
This skill adds Slack support to NanoClaw, then walks through interactive setup.
|
|
9
|
+
|
|
10
|
+
## Phase 1: Pre-flight
|
|
11
|
+
|
|
12
|
+
### Check if already applied
|
|
13
|
+
|
|
14
|
+
Check if `src/channels/slack.ts` exists. If it does, skip to Phase 3 (Setup). The code changes are already in place.
|
|
15
|
+
|
|
16
|
+
### Ask the user
|
|
17
|
+
|
|
18
|
+
**Do they already have a Slack app configured?** If yes, collect the Bot Token and App Token now. If no, we'll create one in Phase 3.
|
|
19
|
+
|
|
20
|
+
## Phase 2: Apply Code Changes
|
|
21
|
+
|
|
22
|
+
### Ensure channel remote
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git remote -v
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If `slack` is missing, add it:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git remote add slack https://github.com/qwibitai/nanoclaw-slack.git
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Merge the skill branch
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git fetch slack main
|
|
38
|
+
git merge slack/main || {
|
|
39
|
+
git checkout --theirs package-lock.json
|
|
40
|
+
git add package-lock.json
|
|
41
|
+
git merge --continue
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This merges in:
|
|
46
|
+
- `src/channels/slack.ts` (SlackChannel class with self-registration via `registerChannel`)
|
|
47
|
+
- `src/channels/slack.test.ts` (46 unit tests)
|
|
48
|
+
- `import './slack.js'` appended to the channel barrel file `src/channels/index.ts`
|
|
49
|
+
- `@slack/bolt` npm dependency in `package.json`
|
|
50
|
+
- `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN` in `.env.example`
|
|
51
|
+
|
|
52
|
+
If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.
|
|
53
|
+
|
|
54
|
+
### Validate code changes
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install
|
|
58
|
+
npm run build
|
|
59
|
+
npx vitest run src/channels/slack.test.ts
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
All tests must pass (including the new Slack tests) and build must be clean before proceeding.
|
|
63
|
+
|
|
64
|
+
## Phase 3: Setup
|
|
65
|
+
|
|
66
|
+
### Create Slack App (if needed)
|
|
67
|
+
|
|
68
|
+
If the user doesn't have a Slack app, share [SLACK_SETUP.md](SLACK_SETUP.md) which has step-by-step instructions with screenshots guidance, troubleshooting, and a token reference table.
|
|
69
|
+
|
|
70
|
+
Quick summary of what's needed:
|
|
71
|
+
1. Create a Slack app at [api.slack.com/apps](https://api.slack.com/apps)
|
|
72
|
+
2. Enable Socket Mode and generate an App-Level Token (`xapp-...`)
|
|
73
|
+
3. Subscribe to bot events: `message.channels`, `message.groups`, `message.im`
|
|
74
|
+
4. Add OAuth scopes: `chat:write`, `channels:history`, `groups:history`, `im:history`, `channels:read`, `groups:read`, `users:read`
|
|
75
|
+
5. Install to workspace and copy the Bot Token (`xoxb-...`)
|
|
76
|
+
|
|
77
|
+
Wait for the user to provide both tokens.
|
|
78
|
+
|
|
79
|
+
### Configure environment
|
|
80
|
+
|
|
81
|
+
Add to `.env`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
SLACK_BOT_TOKEN=xoxb-your-bot-token
|
|
85
|
+
SLACK_APP_TOKEN=xapp-your-app-token
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Channels auto-enable when their credentials are present — no extra configuration needed.
|
|
89
|
+
|
|
90
|
+
Sync to container environment:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mkdir -p data/env && cp .env data/env/env
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The container reads environment from `data/env/env`, not `.env` directly.
|
|
97
|
+
|
|
98
|
+
### Build and restart
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm run build
|
|
102
|
+
launchctl kickstart -k gui/$(id -u)/com.nanoclaw
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Phase 4: Registration
|
|
106
|
+
|
|
107
|
+
### Get Channel ID
|
|
108
|
+
|
|
109
|
+
Tell the user:
|
|
110
|
+
|
|
111
|
+
> 1. Add the bot to a Slack channel (right-click channel → **View channel details** → **Integrations** → **Add apps**)
|
|
112
|
+
> 2. In that channel, the channel ID is in the URL when you open it in a browser: `https://app.slack.com/client/T.../C0123456789` — the `C...` part is the channel ID
|
|
113
|
+
> 3. Alternatively, right-click the channel name → **Copy link** — the channel ID is the last path segment
|
|
114
|
+
>
|
|
115
|
+
> The JID format for NanoClaw is: `slack:C0123456789`
|
|
116
|
+
|
|
117
|
+
Wait for the user to provide the channel ID.
|
|
118
|
+
|
|
119
|
+
### Register the channel
|
|
120
|
+
|
|
121
|
+
The channel ID, name, and folder name are needed. Use `npx tsx setup/index.ts --step register` with the appropriate flags.
|
|
122
|
+
|
|
123
|
+
For a main channel (responds to all messages):
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx tsx setup/index.ts --step register -- --jid "slack:<channel-id>" --name "<channel-name>" --folder "slack_main" --trigger "@${ASSISTANT_NAME}" --channel slack --no-trigger-required --is-main
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
For additional channels (trigger-only):
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npx tsx setup/index.ts --step register -- --jid "slack:<channel-id>" --name "<channel-name>" --folder "slack_<channel-name>" --trigger "@${ASSISTANT_NAME}" --channel slack
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Phase 5: Verify
|
|
136
|
+
|
|
137
|
+
### Test the connection
|
|
138
|
+
|
|
139
|
+
Tell the user:
|
|
140
|
+
|
|
141
|
+
> Send a message in your registered Slack channel:
|
|
142
|
+
> - For main channel: Any message works
|
|
143
|
+
> - For non-main: `@<assistant-name> hello` (using the configured trigger word)
|
|
144
|
+
>
|
|
145
|
+
> The bot should respond within a few seconds.
|
|
146
|
+
|
|
147
|
+
### Check logs if needed
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
tail -f logs/nanoclaw.log
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Troubleshooting
|
|
154
|
+
|
|
155
|
+
### Bot not responding
|
|
156
|
+
|
|
157
|
+
1. Check `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN` are set in `.env` AND synced to `data/env/env`
|
|
158
|
+
2. Check channel is registered: `sqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE 'slack:%'"`
|
|
159
|
+
3. For non-main channels: message must include trigger pattern
|
|
160
|
+
4. Service is running: `launchctl list | grep nanoclaw`
|
|
161
|
+
|
|
162
|
+
### Bot connected but not receiving messages
|
|
163
|
+
|
|
164
|
+
1. Verify Socket Mode is enabled in the Slack app settings
|
|
165
|
+
2. Verify the bot is subscribed to the correct events (`message.channels`, `message.groups`, `message.im`)
|
|
166
|
+
3. Verify the bot has been added to the channel
|
|
167
|
+
4. Check that the bot has the required OAuth scopes
|
|
168
|
+
|
|
169
|
+
### Bot not seeing messages in channels
|
|
170
|
+
|
|
171
|
+
By default, bots only see messages in channels they've been explicitly added to. Make sure to:
|
|
172
|
+
1. Add the bot to each channel you want it to monitor
|
|
173
|
+
2. Check the bot has `channels:history` and/or `groups:history` scopes
|
|
174
|
+
|
|
175
|
+
### "missing_scope" errors
|
|
176
|
+
|
|
177
|
+
If the bot logs `missing_scope` errors:
|
|
178
|
+
1. Go to **OAuth & Permissions** in your Slack app settings
|
|
179
|
+
2. Add the missing scope listed in the error message
|
|
180
|
+
3. **Reinstall the app** to your workspace — scope changes require reinstallation
|
|
181
|
+
4. Copy the new Bot Token (it changes on reinstall) and update `.env`
|
|
182
|
+
5. Sync: `mkdir -p data/env && cp .env data/env/env`
|
|
183
|
+
6. Restart: `launchctl kickstart -k gui/$(id -u)/com.nanoclaw`
|
|
184
|
+
|
|
185
|
+
### Getting channel ID
|
|
186
|
+
|
|
187
|
+
If the channel ID is hard to find:
|
|
188
|
+
- In Slack desktop: right-click channel → **Copy link** → extract the `C...` ID from the URL
|
|
189
|
+
- In Slack web: the URL shows `https://app.slack.com/client/TXXXXXXX/C0123456789`
|
|
190
|
+
- Via API: `curl -s -H "Authorization: Bearer $SLACK_BOT_TOKEN" "https://slack.com/api/conversations.list" | jq '.channels[] | {id, name}'`
|
|
191
|
+
|
|
192
|
+
## After Setup
|
|
193
|
+
|
|
194
|
+
The Slack channel supports:
|
|
195
|
+
- **Public channels** — Bot must be added to the channel
|
|
196
|
+
- **Private channels** — Bot must be invited to the channel
|
|
197
|
+
- **Direct messages** — Users can DM the bot directly
|
|
198
|
+
- **Multi-channel** — Can run alongside WhatsApp or other channels (auto-enabled by credentials)
|
|
199
|
+
|
|
200
|
+
## Known Limitations
|
|
201
|
+
|
|
202
|
+
- **Threads are flattened** — Threaded replies are delivered to the agent as regular channel messages. The agent sees them but has no awareness they originated in a thread. Responses always go to the channel, not back into the thread. Users in a thread will need to check the main channel for the bot's reply. Full thread-aware routing (respond in-thread) requires pipeline-wide changes: database schema, `NewMessage` type, `Channel.sendMessage` interface, and routing logic.
|
|
203
|
+
- **No typing indicator** — Slack's Bot API does not expose a typing indicator endpoint. The `setTyping()` method is a no-op. Users won't see "bot is typing..." while the agent works.
|
|
204
|
+
- **Message splitting is naive** — Long messages are split at a fixed 4000-character boundary, which may break mid-word or mid-sentence. A smarter split (on paragraph or sentence boundaries) would improve readability.
|
|
205
|
+
- **No file/image handling** — The bot only processes text content. File uploads, images, and rich message blocks are not forwarded to the agent.
|
|
206
|
+
- **Channel metadata sync is unbounded** — `syncChannelMetadata()` paginates through all channels the bot is a member of, but has no upper bound or timeout. Workspaces with thousands of channels may experience slow startup.
|
|
207
|
+
- **Workspace admin policies not detected** — If the Slack workspace restricts bot app installation, the setup will fail at the "Install to Workspace" step with no programmatic detection or guidance. See SLACK_SETUP.md troubleshooting section.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-telegram
|
|
3
|
+
description: Add Telegram as a channel. Can replace WhatsApp entirely or run alongside it. Also configurable as a control-only channel (triggers actions) or passive channel (receives notifications only).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Add Telegram Channel
|
|
7
|
+
|
|
8
|
+
This skill adds Telegram support to NanoClaw, then walks through interactive setup.
|
|
9
|
+
|
|
10
|
+
## Phase 1: Pre-flight
|
|
11
|
+
|
|
12
|
+
### Check if already applied
|
|
13
|
+
|
|
14
|
+
Check if `src/channels/telegram.ts` exists. If it does, skip to Phase 3 (Setup). The code changes are already in place.
|
|
15
|
+
|
|
16
|
+
### Ask the user
|
|
17
|
+
|
|
18
|
+
Use `AskUserQuestion` to collect configuration:
|
|
19
|
+
|
|
20
|
+
AskUserQuestion: Do you have a Telegram bot token, or do you need to create one?
|
|
21
|
+
|
|
22
|
+
If they have one, collect it now. If not, we'll create one in Phase 3.
|
|
23
|
+
|
|
24
|
+
## Phase 2: Apply Code Changes
|
|
25
|
+
|
|
26
|
+
### Ensure channel remote
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git remote -v
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If `telegram` is missing, add it:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git remote add telegram https://github.com/qwibitai/nanoclaw-telegram.git
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Merge the skill branch
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git fetch telegram main
|
|
42
|
+
git merge telegram/main || {
|
|
43
|
+
git checkout --theirs package-lock.json
|
|
44
|
+
git add package-lock.json
|
|
45
|
+
git merge --continue
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This merges in:
|
|
50
|
+
- `src/channels/telegram.ts` (TelegramChannel class with self-registration via `registerChannel`)
|
|
51
|
+
- `src/channels/telegram.test.ts` (unit tests with grammy mock)
|
|
52
|
+
- `import './telegram.js'` appended to the channel barrel file `src/channels/index.ts`
|
|
53
|
+
- `grammy` npm dependency in `package.json`
|
|
54
|
+
- `TELEGRAM_BOT_TOKEN` in `.env.example`
|
|
55
|
+
|
|
56
|
+
If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.
|
|
57
|
+
|
|
58
|
+
### Validate code changes
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install
|
|
62
|
+
npm run build
|
|
63
|
+
npx vitest run src/channels/telegram.test.ts
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
All tests must pass (including the new Telegram tests) and build must be clean before proceeding.
|
|
67
|
+
|
|
68
|
+
## Phase 3: Setup
|
|
69
|
+
|
|
70
|
+
### Create Telegram Bot (if needed)
|
|
71
|
+
|
|
72
|
+
If the user doesn't have a bot token, tell them:
|
|
73
|
+
|
|
74
|
+
> I need you to create a Telegram bot:
|
|
75
|
+
>
|
|
76
|
+
> 1. Open Telegram and search for `@BotFather`
|
|
77
|
+
> 2. Send `/newbot` and follow prompts:
|
|
78
|
+
> - Bot name: Something friendly (e.g., "Andy Assistant")
|
|
79
|
+
> - Bot username: Must end with "bot" (e.g., "andy_ai_bot")
|
|
80
|
+
> 3. Copy the bot token (looks like `123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11`)
|
|
81
|
+
|
|
82
|
+
Wait for the user to provide the token.
|
|
83
|
+
|
|
84
|
+
### Configure environment
|
|
85
|
+
|
|
86
|
+
Add to `.env`:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
TELEGRAM_BOT_TOKEN=<their-token>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Channels auto-enable when their credentials are present — no extra configuration needed.
|
|
93
|
+
|
|
94
|
+
Sync to container environment:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
mkdir -p data/env && cp .env data/env/env
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The container reads environment from `data/env/env`, not `.env` directly.
|
|
101
|
+
|
|
102
|
+
### Disable Group Privacy (for group chats)
|
|
103
|
+
|
|
104
|
+
Tell the user:
|
|
105
|
+
|
|
106
|
+
> **Important for group chats**: By default, Telegram bots only see @mentions and commands in groups. To let the bot see all messages:
|
|
107
|
+
>
|
|
108
|
+
> 1. Open Telegram and search for `@BotFather`
|
|
109
|
+
> 2. Send `/mybots` and select your bot
|
|
110
|
+
> 3. Go to **Bot Settings** > **Group Privacy** > **Turn off**
|
|
111
|
+
>
|
|
112
|
+
> This is optional if you only want trigger-based responses via @mentioning the bot.
|
|
113
|
+
|
|
114
|
+
### Build and restart
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm run build
|
|
118
|
+
launchctl kickstart -k gui/$(id -u)/com.nanoclaw # macOS
|
|
119
|
+
# Linux: systemctl --user restart nanoclaw
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Phase 4: Registration
|
|
123
|
+
|
|
124
|
+
### Get Chat ID
|
|
125
|
+
|
|
126
|
+
Tell the user:
|
|
127
|
+
|
|
128
|
+
> 1. Open your bot in Telegram (search for its username)
|
|
129
|
+
> 2. Send `/chatid` — it will reply with the chat ID
|
|
130
|
+
> 3. For groups: add the bot to the group first, then send `/chatid` in the group
|
|
131
|
+
|
|
132
|
+
Wait for the user to provide the chat ID (format: `tg:123456789` or `tg:-1001234567890`).
|
|
133
|
+
|
|
134
|
+
### Register the chat
|
|
135
|
+
|
|
136
|
+
The chat ID, name, and folder name are needed. Use `npx tsx setup/index.ts --step register` with the appropriate flags.
|
|
137
|
+
|
|
138
|
+
For a main chat (responds to all messages):
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npx tsx setup/index.ts --step register -- --jid "tg:<chat-id>" --name "<chat-name>" --folder "telegram_main" --trigger "@${ASSISTANT_NAME}" --channel telegram --no-trigger-required --is-main
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For additional chats (trigger-only):
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx tsx setup/index.ts --step register -- --jid "tg:<chat-id>" --name "<chat-name>" --folder "telegram_<group-name>" --trigger "@${ASSISTANT_NAME}" --channel telegram
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Phase 5: Verify
|
|
151
|
+
|
|
152
|
+
### Test the connection
|
|
153
|
+
|
|
154
|
+
Tell the user:
|
|
155
|
+
|
|
156
|
+
> Send a message to your registered Telegram chat:
|
|
157
|
+
> - For main chat: Any message works
|
|
158
|
+
> - For non-main: `@Andy hello` or @mention the bot
|
|
159
|
+
>
|
|
160
|
+
> The bot should respond within a few seconds.
|
|
161
|
+
|
|
162
|
+
### Check logs if needed
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
tail -f logs/nanoclaw.log
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Troubleshooting
|
|
169
|
+
|
|
170
|
+
### Bot not responding
|
|
171
|
+
|
|
172
|
+
Check:
|
|
173
|
+
1. `TELEGRAM_BOT_TOKEN` is set in `.env` AND synced to `data/env/env`
|
|
174
|
+
2. Chat is registered in SQLite (check with: `sqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE 'tg:%'"`)
|
|
175
|
+
3. For non-main chats: message includes trigger pattern
|
|
176
|
+
4. Service is running: `launchctl list | grep nanoclaw` (macOS) or `systemctl --user status nanoclaw` (Linux)
|
|
177
|
+
|
|
178
|
+
### Bot only responds to @mentions in groups
|
|
179
|
+
|
|
180
|
+
Group Privacy is enabled (default). Fix:
|
|
181
|
+
1. `@BotFather` > `/mybots` > select bot > **Bot Settings** > **Group Privacy** > **Turn off**
|
|
182
|
+
2. Remove and re-add the bot to the group (required for the change to take effect)
|
|
183
|
+
|
|
184
|
+
### Getting chat ID
|
|
185
|
+
|
|
186
|
+
If `/chatid` doesn't work:
|
|
187
|
+
- Verify token: `curl -s "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getMe"`
|
|
188
|
+
- Check bot is started: `tail -f logs/nanoclaw.log`
|
|
189
|
+
|
|
190
|
+
## After Setup
|
|
191
|
+
|
|
192
|
+
If running `npm run dev` while the service is active:
|
|
193
|
+
```bash
|
|
194
|
+
# macOS:
|
|
195
|
+
launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist
|
|
196
|
+
npm run dev
|
|
197
|
+
# When done testing:
|
|
198
|
+
launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist
|
|
199
|
+
# Linux:
|
|
200
|
+
# systemctl --user stop nanoclaw
|
|
201
|
+
# npm run dev
|
|
202
|
+
# systemctl --user start nanoclaw
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Agent Swarms (Teams)
|
|
206
|
+
|
|
207
|
+
After completing the Telegram setup, use `AskUserQuestion`:
|
|
208
|
+
|
|
209
|
+
AskUserQuestion: Would you like to add Agent Swarm support? Without it, Agent Teams still work — they just operate behind the scenes. With Swarm support, each subagent appears as a different bot in the Telegram group so you can see who's saying what and have interactive team sessions.
|
|
210
|
+
|
|
211
|
+
If they say yes, invoke the `/add-telegram-swarm` skill.
|
|
212
|
+
|
|
213
|
+
## Removal
|
|
214
|
+
|
|
215
|
+
To remove Telegram integration:
|
|
216
|
+
|
|
217
|
+
1. Delete `src/channels/telegram.ts` and `src/channels/telegram.test.ts`
|
|
218
|
+
2. Remove `import './telegram.js'` from `src/channels/index.ts`
|
|
219
|
+
3. Remove `TELEGRAM_BOT_TOKEN` from `.env`
|
|
220
|
+
4. Remove Telegram registrations from SQLite: `sqlite3 store/messages.db "DELETE FROM registered_groups WHERE jid LIKE 'tg:%'"`
|
|
221
|
+
5. Uninstall: `npm uninstall grammy`
|
|
222
|
+
6. Rebuild: `npm run build && launchctl kickstart -k gui/$(id -u)/com.nanoclaw` (macOS) or `npm run build && systemctl --user restart nanoclaw` (Linux)
|