agent-messenger 2.0.0 → 2.2.0
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-plugin/marketplace.json +14 -1
- package/.claude-plugin/plugin.json +4 -2
- package/.env.template +35 -17
- package/README.md +37 -33
- package/bun.lock +6 -6
- package/dist/package.json +11 -3
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +3 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js +35 -28
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.js +6 -6
- package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts +23 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.js +299 -29
- package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js +57 -49
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/ensure-auth.js +3 -3
- package/dist/src/platforms/discord/ensure-auth.js.map +1 -1
- package/dist/src/platforms/discord/token-extractor.d.ts +6 -1
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/discord/token-extractor.js +167 -14
- package/dist/src/platforms/discord/token-extractor.js.map +1 -1
- package/dist/src/platforms/instagram/client.d.ts +2 -0
- package/dist/src/platforms/instagram/client.d.ts.map +1 -1
- package/dist/src/platforms/instagram/client.js +2 -2
- package/dist/src/platforms/instagram/client.js.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.js +107 -14
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.js +57 -11
- package/dist/src/platforms/instagram/ensure-auth.js.map +1 -1
- package/dist/src/platforms/instagram/index.d.ts +1 -0
- package/dist/src/platforms/instagram/index.d.ts.map +1 -1
- package/dist/src/platforms/instagram/index.js +1 -0
- package/dist/src/platforms/instagram/index.js.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.d.ts +44 -0
- package/dist/src/platforms/instagram/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/instagram/token-extractor.js +407 -0
- package/dist/src/platforms/instagram/token-extractor.js.map +1 -0
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +2 -1
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.js +14 -13
- package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.js +2 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -1
- package/dist/src/platforms/line/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/auth.js +6 -5
- package/dist/src/platforms/line/commands/auth.js.map +1 -1
- package/dist/src/platforms/slack/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/auth.js +11 -10
- package/dist/src/platforms/slack/commands/auth.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts +9 -0
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +300 -23
- package/dist/src/platforms/slack/token-extractor.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +9 -8
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/ensure-auth.js +2 -1
- package/dist/src/platforms/teams/ensure-auth.js.map +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts +5 -0
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +161 -29
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/platforms/telegram/client.d.ts.map +1 -1
- package/dist/src/platforms/telegram/client.js +25 -7
- package/dist/src/platforms/telegram/client.js.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.js +6 -5
- package/dist/src/platforms/telegram/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/app-config.d.ts +7 -0
- package/dist/src/platforms/webex/app-config.d.ts.map +1 -0
- package/dist/src/platforms/webex/app-config.js +20 -0
- package/dist/src/platforms/webex/app-config.js.map +1 -0
- package/dist/src/platforms/webex/cli.d.ts +5 -0
- package/dist/src/platforms/webex/cli.d.ts.map +1 -0
- package/dist/src/platforms/webex/cli.js +32 -0
- package/dist/src/platforms/webex/cli.js.map +1 -0
- package/dist/src/platforms/webex/client.d.ts +55 -0
- package/dist/src/platforms/webex/client.d.ts.map +1 -0
- package/dist/src/platforms/webex/client.js +299 -0
- package/dist/src/platforms/webex/client.js.map +1 -0
- package/dist/src/platforms/webex/commands/auth.d.ts +19 -0
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/auth.js +166 -0
- package/dist/src/platforms/webex/commands/auth.js.map +1 -0
- package/dist/src/platforms/webex/commands/index.d.ts +6 -0
- package/dist/src/platforms/webex/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/index.js +6 -0
- package/dist/src/platforms/webex/commands/index.js.map +1 -0
- package/dist/src/platforms/webex/commands/member.d.ts +7 -0
- package/dist/src/platforms/webex/commands/member.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/member.js +34 -0
- package/dist/src/platforms/webex/commands/member.js.map +1 -0
- package/dist/src/platforms/webex/commands/message.d.ts +26 -0
- package/dist/src/platforms/webex/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/message.js +153 -0
- package/dist/src/platforms/webex/commands/message.js.map +1 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts +9 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/snapshot.js +72 -0
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/webex/commands/space.d.ts +11 -0
- package/dist/src/platforms/webex/commands/space.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/space.js +59 -0
- package/dist/src/platforms/webex/commands/space.js.map +1 -0
- package/dist/src/platforms/webex/credential-manager.d.ts +23 -0
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/webex/credential-manager.js +148 -0
- package/dist/src/platforms/webex/credential-manager.js.map +1 -0
- package/dist/src/platforms/webex/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/webex/ensure-auth.js +36 -0
- package/dist/src/platforms/webex/ensure-auth.js.map +1 -0
- package/dist/src/platforms/webex/index.d.ts +8 -0
- package/dist/src/platforms/webex/index.d.ts.map +1 -0
- package/dist/src/platforms/webex/index.js +6 -0
- package/dist/src/platforms/webex/index.js.map +1 -0
- package/dist/src/platforms/webex/token-extractor.d.ts +28 -0
- package/dist/src/platforms/webex/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/webex/token-extractor.js +344 -0
- package/dist/src/platforms/webex/token-extractor.js.map +1 -0
- package/dist/src/platforms/webex/types.d.ts +127 -0
- package/dist/src/platforms/webex/types.d.ts.map +1 -0
- package/dist/src/platforms/webex/types.js +64 -0
- package/dist/src/platforms/webex/types.js.map +1 -0
- package/dist/src/platforms/whatsapp/client.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/client.js +6 -2
- package/dist/src/platforms/whatsapp/client.js.map +1 -1
- package/dist/src/shared/utils/derived-key-cache.d.ts +1 -1
- package/dist/src/shared/utils/derived-key-cache.d.ts.map +1 -1
- package/dist/src/shared/utils/error-handler.d.ts +1 -1
- package/dist/src/shared/utils/error-handler.d.ts.map +1 -1
- package/dist/src/shared/utils/error-handler.js +3 -2
- package/dist/src/shared/utils/error-handler.js.map +1 -1
- package/dist/src/shared/utils/stderr.d.ts +5 -0
- package/dist/src/shared/utils/stderr.d.ts.map +1 -0
- package/dist/src/shared/utils/stderr.js +18 -0
- package/dist/src/shared/utils/stderr.js.map +1 -0
- package/dist/src/tui/adapters/webex-adapter.d.ts +14 -0
- package/dist/src/tui/adapters/webex-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/webex-adapter.js +79 -0
- package/dist/src/tui/adapters/webex-adapter.js.map +1 -0
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +2 -0
- package/dist/src/tui/app.js.map +1 -1
- package/docs/content/docs/cli/channeltalk.mdx +7 -7
- package/docs/content/docs/cli/discord.mdx +3 -3
- package/docs/content/docs/cli/instagram.mdx +28 -6
- package/docs/content/docs/cli/meta.json +1 -0
- package/docs/content/docs/cli/slack.mdx +2 -2
- package/docs/content/docs/cli/teams.mdx +6 -4
- package/docs/content/docs/cli/webex.mdx +310 -0
- package/docs/content/docs/sdk/meta.json +1 -1
- package/docs/content/docs/sdk/webex.mdx +260 -0
- package/docs/content/docs/tui.mdx +4 -3
- package/docs/src/app/page.tsx +2 -2
- package/e2e/README.md +132 -8
- package/e2e/channeltalk.e2e.test.ts +2 -7
- package/e2e/channeltalkbot.e2e.test.ts +2 -6
- package/e2e/config.ts +172 -10
- package/e2e/helpers.ts +7 -0
- package/e2e/instagram.e2e.test.ts +97 -0
- package/e2e/kakaotalk.e2e.test.ts +74 -0
- package/e2e/line.e2e.test.ts +92 -0
- package/e2e/teams.e2e.test.ts +46 -1
- package/e2e/telegram.e2e.test.ts +84 -0
- package/e2e/webex.e2e.test.ts +190 -0
- package/e2e/whatsapp.e2e.test.ts +90 -0
- package/e2e/whatsappbot.e2e.test.ts +78 -0
- package/package.json +11 -3
- package/skills/agent-channeltalk/SKILL.md +9 -9
- package/skills/agent-channeltalk/references/authentication.md +21 -18
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +5 -5
- package/skills/agent-discord/references/authentication.md +8 -8
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-instagram/SKILL.md +51 -9
- package/skills/agent-instagram/references/authentication.md +35 -3
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +5 -5
- package/skills/agent-slack/references/authentication.md +8 -8
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +6 -6
- package/skills/agent-teams/references/authentication.md +8 -8
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +406 -0
- package/skills/agent-webex/references/authentication.md +371 -0
- package/skills/agent-webex/references/common-patterns.md +726 -0
- package/skills/agent-webex/templates/monitor-space.sh +165 -0
- package/skills/agent-webex/templates/post-message.sh +170 -0
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/cli.ts +4 -0
- package/src/platforms/channeltalk/commands/auth.test.ts +5 -5
- package/src/platforms/channeltalk/commands/auth.ts +38 -32
- package/src/platforms/channeltalk/ensure-auth.test.ts +6 -6
- package/src/platforms/channeltalk/ensure-auth.ts +6 -6
- package/src/platforms/channeltalk/token-extractor.test.ts +182 -15
- package/src/platforms/channeltalk/token-extractor.ts +344 -30
- package/src/platforms/discord/commands/auth.test.ts +3 -3
- package/src/platforms/discord/commands/auth.ts +58 -54
- package/src/platforms/discord/ensure-auth.test.ts +3 -3
- package/src/platforms/discord/ensure-auth.ts +3 -3
- package/src/platforms/discord/token-extractor.test.ts +199 -27
- package/src/platforms/discord/token-extractor.ts +190 -17
- package/src/platforms/instagram/client.ts +2 -2
- package/src/platforms/instagram/commands/auth.ts +133 -14
- package/src/platforms/instagram/ensure-auth.ts +63 -12
- package/src/platforms/instagram/index.ts +1 -0
- package/src/platforms/instagram/token-extractor.test.ts +424 -0
- package/src/platforms/instagram/token-extractor.ts +478 -0
- package/src/platforms/kakaotalk/client.ts +3 -1
- package/src/platforms/kakaotalk/commands/auth.ts +14 -13
- package/src/platforms/kakaotalk/protocol/connection.ts +3 -1
- package/src/platforms/line/commands/auth.ts +7 -6
- package/src/platforms/slack/cli.test.ts +6 -5
- package/src/platforms/slack/commands/auth.test.ts +11 -7
- package/src/platforms/slack/commands/auth.ts +11 -10
- package/src/platforms/slack/token-extractor.test.ts +98 -1
- package/src/platforms/slack/token-extractor.ts +338 -26
- package/src/platforms/teams/commands/auth.ts +9 -8
- package/src/platforms/teams/ensure-auth.ts +3 -1
- package/src/platforms/teams/token-extractor.test.ts +136 -17
- package/src/platforms/teams/token-extractor.ts +182 -31
- package/src/platforms/telegram/client.test.ts +134 -0
- package/src/platforms/telegram/client.ts +27 -6
- package/src/platforms/telegram/commands/auth.ts +6 -5
- package/src/platforms/webex/app-config.test.ts +98 -0
- package/src/platforms/webex/app-config.ts +31 -0
- package/src/platforms/webex/cli.test.ts +58 -0
- package/src/platforms/webex/cli.ts +39 -0
- package/src/platforms/webex/client.test.ts +743 -0
- package/src/platforms/webex/client.ts +405 -0
- package/src/platforms/webex/commands/auth.test.ts +222 -0
- package/src/platforms/webex/commands/auth.ts +243 -0
- package/src/platforms/webex/commands/index.ts +5 -0
- package/src/platforms/webex/commands/member.test.ts +112 -0
- package/src/platforms/webex/commands/member.ts +45 -0
- package/src/platforms/webex/commands/message.test.ts +235 -0
- package/src/platforms/webex/commands/message.ts +204 -0
- package/src/platforms/webex/commands/snapshot.test.ts +105 -0
- package/src/platforms/webex/commands/snapshot.ts +91 -0
- package/src/platforms/webex/commands/space.test.ts +216 -0
- package/src/platforms/webex/commands/space.ts +74 -0
- package/src/platforms/webex/credential-manager.test.ts +314 -0
- package/src/platforms/webex/credential-manager.ts +197 -0
- package/src/platforms/webex/ensure-auth.test.ts +89 -0
- package/src/platforms/webex/ensure-auth.ts +38 -0
- package/src/platforms/webex/index.test.ts +25 -0
- package/src/platforms/webex/index.ts +19 -0
- package/src/platforms/webex/token-extractor.test.ts +327 -0
- package/src/platforms/webex/token-extractor.ts +393 -0
- package/src/platforms/webex/types.test.ts +307 -0
- package/src/platforms/webex/types.ts +129 -0
- package/src/platforms/whatsapp/client.ts +11 -7
- package/src/shared/utils/derived-key-cache.ts +1 -1
- package/src/shared/utils/error-handler.ts +4 -2
- package/src/shared/utils/stderr.ts +22 -0
- package/src/tui/adapters/webex-adapter.ts +103 -0
- package/src/tui/app.ts +2 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
# Authentication Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
agent-webex supports four authentication methods against the Webex REST API (`https://webexapis.com/v1`):
|
|
6
|
+
|
|
7
|
+
1. **Browser Token Extraction**: Extracts your first-party token from a Chromium browser where you're logged into web.webex.com. Currently supports read operations (spaces, members, auth). Zero-config.
|
|
8
|
+
2. **OAuth Device Grant** (recommended for messaging): Zero-config. Run `auth login`, approve in browser, done. Tokens refresh automatically. Supports all operations including sending messages (shows "via agent-messenger").
|
|
9
|
+
3. **Bot Token**: Pass via `auth login --token`. Never expires. Best for CI/CD.
|
|
10
|
+
4. **Personal Access Token (PAT)**: Pass via `auth login --token`. Expires in 12 hours. For quick testing.
|
|
11
|
+
|
|
12
|
+
## Token Types
|
|
13
|
+
|
|
14
|
+
### Browser Token Extraction
|
|
15
|
+
|
|
16
|
+
Extracts your first-party Webex session token from a Chromium-based browser where you're logged into web.webex.com. Currently supports read operations (authentication, listing spaces/members, snapshots). Sending messages via the REST API is not yet supported because the web client's token lacks `spark:messages_write` scope — the web client uses internal Cisco APIs for messaging instead.
|
|
17
|
+
|
|
18
|
+
- **How it works**: Run `agent-webex auth extract`. The CLI scans Chromium browser profiles for Webex localStorage data (LevelDB files). It finds the `webex-storage` key containing `Credentials.@.supertoken` and extracts the access token. No browser automation, no password prompts.
|
|
19
|
+
- **Supported browsers**: Chrome, Chrome Canary, Edge, Arc, Brave, Vivaldi, Chromium
|
|
20
|
+
- **Token lifetime**: Depends on Webex session policy (typically hours to days). Re-extract when expired.
|
|
21
|
+
- **Auto-extraction**: The CLI attempts browser extraction automatically when no valid token is stored, so you often don't need to run `auth extract` manually.
|
|
22
|
+
- **Best for**: Interactive use, sending messages as yourself without the "via" label
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Extract token from browser
|
|
26
|
+
agent-webex auth extract
|
|
27
|
+
|
|
28
|
+
# With debug output
|
|
29
|
+
agent-webex auth extract --debug
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Requirements**: You must be logged into web.webex.com in a supported Chromium browser. The browser does not need to be running — the CLI reads directly from on-disk LevelDB files.
|
|
33
|
+
|
|
34
|
+
**Limitations**: Direct messages (`message dm`) require an existing conversation with the recipient. The extracted token cannot create new 1:1 conversations — start one from the Webex app first, then use the CLI.
|
|
35
|
+
|
|
36
|
+
### OAuth Device Grant
|
|
37
|
+
|
|
38
|
+
The fallback authentication method when browser extraction is unavailable. No credentials to copy, no developer portal setup required.
|
|
39
|
+
|
|
40
|
+
- **How it works**: Run `agent-webex auth login`. The CLI requests a device code from Webex, opens your browser, and waits for you to approve. Once approved, access and refresh tokens are stored automatically.
|
|
41
|
+
- **Access token lifetime**: 14 days
|
|
42
|
+
- **Refresh token lifetime**: 90 days
|
|
43
|
+
- **Auto-refresh**: The CLI refreshes expired access tokens automatically using the stored refresh token. No manual intervention needed until the refresh token itself expires (90 days).
|
|
44
|
+
- **Permissions**: `spark:all` scope (full access to your Webex account)
|
|
45
|
+
- **Best for**: Interactive use, development, any scenario where a human can approve via browser
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
agent-webex auth login
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The CLI ships with built-in Integration credentials so this works out of the box. You can override them with your own (see [Environment Variables](#environment-variables)).
|
|
52
|
+
|
|
53
|
+
### Bot Token
|
|
54
|
+
|
|
55
|
+
A permanent token tied to a Webex bot identity.
|
|
56
|
+
|
|
57
|
+
- **Lifetime**: Never expires (unless you regenerate it)
|
|
58
|
+
- **How to get one**: Create a bot at https://developer.webex.com/my-apps/new/bot. The token is shown once at creation time. Save it immediately.
|
|
59
|
+
- **Permissions**: The bot can only interact with spaces it has been added to
|
|
60
|
+
- **Best for**: Long-running automations, CI/CD pipelines, production scripts
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
agent-webex auth login --token "YOUR_BOT_TOKEN_HERE"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Personal Access Token (PAT)
|
|
67
|
+
|
|
68
|
+
A short-lived token for development and testing.
|
|
69
|
+
|
|
70
|
+
- **Lifetime**: 12 hours from generation
|
|
71
|
+
- **How to get one**: Visit https://developer.webex.com/docs/getting-started and copy the token shown on the page
|
|
72
|
+
- **Permissions**: Full access to everything your Webex account can do
|
|
73
|
+
- **Best for**: Quick testing, one-off scripts
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
agent-webex auth login --token "YOUR_PAT_HERE"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Logging In
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Browser extraction (recommended — messages appear as you)
|
|
83
|
+
agent-webex auth extract
|
|
84
|
+
|
|
85
|
+
# Device Grant (fallback — messages show "via agent-messenger")
|
|
86
|
+
agent-webex auth login
|
|
87
|
+
|
|
88
|
+
# With custom Integration credentials
|
|
89
|
+
agent-webex auth login --client-id <id> --client-secret <secret>
|
|
90
|
+
|
|
91
|
+
# Bot token
|
|
92
|
+
agent-webex auth login --token <bot-token>
|
|
93
|
+
|
|
94
|
+
# PAT
|
|
95
|
+
agent-webex auth login --token <pat>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
When using `auth extract`, the CLI reads your Webex session from the browser's LevelDB storage. No prompts, no browser automation.
|
|
99
|
+
|
|
100
|
+
When using `--token`, the CLI validates the token against the Webex API before saving. If validation fails, you'll see an error and the token won't be stored.
|
|
101
|
+
|
|
102
|
+
When using Device Grant, the CLI prints a URL and code, opens your browser, then polls until you approve (or the code expires).
|
|
103
|
+
|
|
104
|
+
## Checking Status
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
agent-webex auth status
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Output when authenticated:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"authenticated": true,
|
|
115
|
+
"user": {
|
|
116
|
+
"id": "Y2lz...",
|
|
117
|
+
"displayName": "Alice Chen",
|
|
118
|
+
"emails": ["alice@example.com"]
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Output when not authenticated:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"error": "Not authenticated. Run \"auth login\" first."
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Logging Out
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
agent-webex auth logout
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This removes the stored credentials from disk.
|
|
138
|
+
|
|
139
|
+
## Credential Storage
|
|
140
|
+
|
|
141
|
+
### Location
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
~/.config/agent-messenger/webex-credentials.json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Format
|
|
148
|
+
|
|
149
|
+
Extracted credentials (from `auth extract`):
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"accessToken": "...",
|
|
154
|
+
"refreshToken": "...",
|
|
155
|
+
"expiresAt": 1234567890,
|
|
156
|
+
"tokenType": "extracted"
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
OAuth credentials (from Device Grant):
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"accessToken": "...",
|
|
165
|
+
"refreshToken": "...",
|
|
166
|
+
"expiresAt": 1234567890,
|
|
167
|
+
"clientId": "...",
|
|
168
|
+
"clientSecret": "...",
|
|
169
|
+
"tokenType": "oauth"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Manual credentials (from `--token`):
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"accessToken": "...",
|
|
178
|
+
"refreshToken": "",
|
|
179
|
+
"expiresAt": 0,
|
|
180
|
+
"tokenType": "manual"
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Security
|
|
185
|
+
|
|
186
|
+
- File permissions: `0600` (owner read/write only)
|
|
187
|
+
- Credentials are stored in plaintext (same approach as other agent-messenger platforms)
|
|
188
|
+
- Writes are atomic (tmp file + rename) to prevent corruption
|
|
189
|
+
- Keep this file secure. It grants access to your Webex account
|
|
190
|
+
- Built-in OAuth credentials are public bootstrap credentials, not secrets
|
|
191
|
+
- Custom client secrets (from `--client-id`/`--client-secret` or env vars) are stored in plaintext alongside tokens
|
|
192
|
+
- Bot tokens never expire. Treat them like passwords
|
|
193
|
+
- PATs auto-expire in 12 hours, which limits exposure
|
|
194
|
+
|
|
195
|
+
## Token Lifecycle
|
|
196
|
+
|
|
197
|
+
### Browser Token Extraction
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
auth extract -> Scan browser LevelDB -> Extract supertoken -> Access token (session-based)
|
|
201
|
+
|
|
|
202
|
+
Token expires
|
|
203
|
+
|
|
|
204
|
+
Re-run "auth extract"
|
|
205
|
+
(or auto-extraction on next CLI run)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Browser-extracted tokens have no refresh mechanism — when they expire, re-extract from the browser (where your active session keeps them fresh). The CLI attempts auto-extraction on each run, so manual re-extraction is rarely needed.
|
|
209
|
+
|
|
210
|
+
### OAuth Device Grant
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
auth login -> Device code -> Browser approval -> Access token (14 days) + Refresh token (90 days)
|
|
214
|
+
|
|
|
215
|
+
Token expires
|
|
216
|
+
|
|
|
217
|
+
Auto-refresh via refresh token
|
|
218
|
+
|
|
|
219
|
+
Refresh token expires (90 days)
|
|
220
|
+
|
|
|
221
|
+
Re-run "auth login"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The CLI checks token expiry before each API call and refreshes automatically when needed. You won't notice this happening.
|
|
225
|
+
|
|
226
|
+
### Bot Tokens
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
Created with bot registration -> Valid forever -> Only invalidated if you regenerate
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Bot tokens are ideal for automation. The bot must be added to each space it needs to interact with.
|
|
233
|
+
|
|
234
|
+
### Personal Access Tokens
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
Generated at developer.webex.com -> Valid for 12 hours -> Expires -> Generate a new one
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
PATs are the quickest way to get started but require manual renewal. For scripts that run longer than 12 hours, use a bot token or Device Grant.
|
|
241
|
+
|
|
242
|
+
## Environment Variables
|
|
243
|
+
|
|
244
|
+
Override the built-in Integration credentials with your own:
|
|
245
|
+
|
|
246
|
+
| Variable | Description |
|
|
247
|
+
|---|---|
|
|
248
|
+
| `AGENT_WEBEX_CLIENT_ID` | Webex Integration client ID |
|
|
249
|
+
| `AGENT_WEBEX_CLIENT_SECRET` | Webex Integration client secret |
|
|
250
|
+
|
|
251
|
+
Both must be set together. When set, `auth login` (without `--token`) uses these instead of the built-in credentials.
|
|
252
|
+
|
|
253
|
+
Legacy aliases `AGENT_MESSENGER_WEBEX_CLIENT_ID` and `AGENT_MESSENGER_WEBEX_CLIENT_SECRET` are also supported.
|
|
254
|
+
|
|
255
|
+
## Troubleshooting
|
|
256
|
+
|
|
257
|
+
### "Not authenticated"
|
|
258
|
+
|
|
259
|
+
No credentials stored. Log in first:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
agent-webex auth login
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### "401 Unauthorized"
|
|
266
|
+
|
|
267
|
+
Token is expired or invalid.
|
|
268
|
+
|
|
269
|
+
**If using Device Grant**: The CLI auto-refreshes tokens, so this usually means the refresh token has expired (after 90 days). Run `agent-webex auth login` again.
|
|
270
|
+
|
|
271
|
+
**If using a PAT**: Generate a new one at https://developer.webex.com/docs/getting-started
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
agent-webex auth login --token <new-pat>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**If using a bot token**: Bot tokens don't expire. Double-check you copied the full token. If you lost it, regenerate at https://developer.webex.com/my-apps.
|
|
278
|
+
|
|
279
|
+
### "Device authorization failed"
|
|
280
|
+
|
|
281
|
+
The device code request was rejected. Possible causes:
|
|
282
|
+
|
|
283
|
+
- Network connectivity issues
|
|
284
|
+
- Custom client ID is invalid or revoked
|
|
285
|
+
- Webex API is temporarily unavailable
|
|
286
|
+
|
|
287
|
+
### "Device authorization timed out"
|
|
288
|
+
|
|
289
|
+
You didn't approve the request in the browser before the code expired. Run `auth login` again.
|
|
290
|
+
|
|
291
|
+
### "Token validation failed"
|
|
292
|
+
|
|
293
|
+
The token was rejected by the Webex API during login. Common causes:
|
|
294
|
+
|
|
295
|
+
- Token was copied incorrectly (missing characters, extra whitespace)
|
|
296
|
+
- Token has already expired (PATs last 12 hours)
|
|
297
|
+
- Token was revoked or regenerated
|
|
298
|
+
|
|
299
|
+
### Permission errors on credentials file
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Fix permissions
|
|
303
|
+
chmod 600 ~/.config/agent-messenger/webex-credentials.json
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Token works in browser but not in CLI
|
|
307
|
+
|
|
308
|
+
Make sure you're using the actual API token, not a session cookie or CSRF token from the browser. The correct token comes from the Developer Portal's "Getting Started" page or from bot/integration creation.
|
|
309
|
+
|
|
310
|
+
## Security Considerations
|
|
311
|
+
|
|
312
|
+
### What agent-webex Can Access
|
|
313
|
+
|
|
314
|
+
With a valid token, agent-webex has the same permissions as the token owner:
|
|
315
|
+
|
|
316
|
+
- **OAuth Device Grant**: `spark:all` scope, full access to your Webex account
|
|
317
|
+
- **PAT**: Read and write to all spaces you belong to, list members, send messages
|
|
318
|
+
- **Bot**: Read and write only in spaces the bot has been added to
|
|
319
|
+
|
|
320
|
+
### What agent-webex Cannot Do
|
|
321
|
+
|
|
322
|
+
- Access spaces you (or the bot) haven't been added to
|
|
323
|
+
- Perform admin operations (unless the token owner is an admin)
|
|
324
|
+
- Create or delete spaces (not implemented in the CLI)
|
|
325
|
+
- Upload or download files (not implemented in the CLI)
|
|
326
|
+
|
|
327
|
+
### Best Practices
|
|
328
|
+
|
|
329
|
+
1. **Use browser extraction for interactive work**: Zero-config, messages appear as you, no "via" label
|
|
330
|
+
2. **Use Device Grant as fallback**: When browser extraction isn't available (no Chromium browser, headless server)
|
|
331
|
+
3. **Use bot tokens for automation**: They don't expire and have scoped access
|
|
332
|
+
3. **Protect credentials.json**: Never commit to version control
|
|
333
|
+
4. **Rotate PATs regularly**: Don't reuse expired tokens. Generate fresh ones
|
|
334
|
+
5. **Revoke compromised tokens**: Regenerate bot tokens at https://developer.webex.com/my-apps if compromised
|
|
335
|
+
6. **Use custom Integration credentials for production**: Set `AGENT_WEBEX_CLIENT_ID` and `AGENT_WEBEX_CLIENT_SECRET` instead of relying on built-in bootstrap credentials
|
|
336
|
+
|
|
337
|
+
## Manual Credential Setup (Advanced)
|
|
338
|
+
|
|
339
|
+
If you need to create the credentials file manually:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Create config directory
|
|
343
|
+
mkdir -p ~/.config/agent-messenger
|
|
344
|
+
|
|
345
|
+
# OAuth credentials
|
|
346
|
+
cat > ~/.config/agent-messenger/webex-credentials.json << 'EOF'
|
|
347
|
+
{
|
|
348
|
+
"accessToken": "YOUR_ACCESS_TOKEN",
|
|
349
|
+
"refreshToken": "YOUR_REFRESH_TOKEN",
|
|
350
|
+
"expiresAt": 1234567890000,
|
|
351
|
+
"clientId": "YOUR_CLIENT_ID",
|
|
352
|
+
"clientSecret": "YOUR_CLIENT_SECRET",
|
|
353
|
+
"tokenType": "oauth"
|
|
354
|
+
}
|
|
355
|
+
EOF
|
|
356
|
+
|
|
357
|
+
# Or manual token
|
|
358
|
+
cat > ~/.config/agent-messenger/webex-credentials.json << 'EOF'
|
|
359
|
+
{
|
|
360
|
+
"accessToken": "YOUR_TOKEN_HERE",
|
|
361
|
+
"refreshToken": "",
|
|
362
|
+
"expiresAt": 0,
|
|
363
|
+
"tokenType": "manual"
|
|
364
|
+
}
|
|
365
|
+
EOF
|
|
366
|
+
|
|
367
|
+
# Set secure permissions
|
|
368
|
+
chmod 600 ~/.config/agent-messenger/webex-credentials.json
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Always prefer `agent-webex auth login` over manual file creation. The login command validates tokens and handles the OAuth flow correctly.
|