agent-messenger 2.20.4 → 2.21.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.
Files changed (115) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +8 -5
  3. package/bun.lock +2 -2
  4. package/dist/package.json +10 -2
  5. package/dist/src/cli.d.ts.map +1 -1
  6. package/dist/src/cli.js +3 -0
  7. package/dist/src/cli.js.map +1 -1
  8. package/dist/src/platforms/webexbot/cli.d.ts +5 -0
  9. package/dist/src/platforms/webexbot/cli.d.ts.map +1 -0
  10. package/dist/src/platforms/webexbot/cli.js +30 -0
  11. package/dist/src/platforms/webexbot/cli.js.map +1 -0
  12. package/dist/src/platforms/webexbot/client.d.ts +41 -0
  13. package/dist/src/platforms/webexbot/client.d.ts.map +1 -0
  14. package/dist/src/platforms/webexbot/client.js +66 -0
  15. package/dist/src/platforms/webexbot/client.js.map +1 -0
  16. package/dist/src/platforms/webexbot/commands/auth.d.ts +28 -0
  17. package/dist/src/platforms/webexbot/commands/auth.d.ts.map +1 -0
  18. package/dist/src/platforms/webexbot/commands/auth.js +166 -0
  19. package/dist/src/platforms/webexbot/commands/auth.js.map +1 -0
  20. package/dist/src/platforms/webexbot/commands/index.d.ts +7 -0
  21. package/dist/src/platforms/webexbot/commands/index.d.ts.map +1 -0
  22. package/dist/src/platforms/webexbot/commands/index.js +7 -0
  23. package/dist/src/platforms/webexbot/commands/index.js.map +1 -0
  24. package/dist/src/platforms/webexbot/commands/listen.d.ts +12 -0
  25. package/dist/src/platforms/webexbot/commands/listen.d.ts.map +1 -0
  26. package/dist/src/platforms/webexbot/commands/listen.js +85 -0
  27. package/dist/src/platforms/webexbot/commands/listen.js.map +1 -0
  28. package/dist/src/platforms/webexbot/commands/member.d.ts +19 -0
  29. package/dist/src/platforms/webexbot/commands/member.d.ts.map +1 -0
  30. package/dist/src/platforms/webexbot/commands/member.js +33 -0
  31. package/dist/src/platforms/webexbot/commands/member.js.map +1 -0
  32. package/dist/src/platforms/webexbot/commands/message.d.ts +37 -0
  33. package/dist/src/platforms/webexbot/commands/message.d.ts.map +1 -0
  34. package/dist/src/platforms/webexbot/commands/message.js +142 -0
  35. package/dist/src/platforms/webexbot/commands/message.js.map +1 -0
  36. package/dist/src/platforms/webexbot/commands/shared.d.ts +9 -0
  37. package/dist/src/platforms/webexbot/commands/shared.d.ts.map +1 -0
  38. package/dist/src/platforms/webexbot/commands/shared.js +13 -0
  39. package/dist/src/platforms/webexbot/commands/shared.js.map +1 -0
  40. package/dist/src/platforms/webexbot/commands/space.d.ts +28 -0
  41. package/dist/src/platforms/webexbot/commands/space.d.ts.map +1 -0
  42. package/dist/src/platforms/webexbot/commands/space.js +61 -0
  43. package/dist/src/platforms/webexbot/commands/space.js.map +1 -0
  44. package/dist/src/platforms/webexbot/commands/whoami.d.ts +16 -0
  45. package/dist/src/platforms/webexbot/commands/whoami.d.ts.map +1 -0
  46. package/dist/src/platforms/webexbot/commands/whoami.js +29 -0
  47. package/dist/src/platforms/webexbot/commands/whoami.js.map +1 -0
  48. package/dist/src/platforms/webexbot/credential-manager.d.ts +17 -0
  49. package/dist/src/platforms/webexbot/credential-manager.d.ts.map +1 -0
  50. package/dist/src/platforms/webexbot/credential-manager.js +120 -0
  51. package/dist/src/platforms/webexbot/credential-manager.js.map +1 -0
  52. package/dist/src/platforms/webexbot/index.d.ts +9 -0
  53. package/dist/src/platforms/webexbot/index.d.ts.map +1 -0
  54. package/dist/src/platforms/webexbot/index.js +6 -0
  55. package/dist/src/platforms/webexbot/index.js.map +1 -0
  56. package/dist/src/platforms/webexbot/listener.d.ts +44 -0
  57. package/dist/src/platforms/webexbot/listener.d.ts.map +1 -0
  58. package/dist/src/platforms/webexbot/listener.js +214 -0
  59. package/dist/src/platforms/webexbot/listener.js.map +1 -0
  60. package/dist/src/platforms/webexbot/types.d.ts +60 -0
  61. package/dist/src/platforms/webexbot/types.d.ts.map +1 -0
  62. package/dist/src/platforms/webexbot/types.js +28 -0
  63. package/dist/src/platforms/webexbot/types.js.map +1 -0
  64. package/dist/src/platforms/webexbot/wdm-discovery.d.ts +4 -0
  65. package/dist/src/platforms/webexbot/wdm-discovery.d.ts.map +1 -0
  66. package/dist/src/platforms/webexbot/wdm-discovery.js +36 -0
  67. package/dist/src/platforms/webexbot/wdm-discovery.js.map +1 -0
  68. package/docs/content/docs/cli/meta.json +1 -0
  69. package/docs/content/docs/cli/webexbot.mdx +290 -0
  70. package/docs/content/docs/sdk/meta.json +1 -0
  71. package/docs/content/docs/sdk/webexbot.mdx +340 -0
  72. package/docs/src/app/page.tsx +115 -19
  73. package/package.json +10 -2
  74. package/skills/agent-channeltalk/SKILL.md +1 -1
  75. package/skills/agent-channeltalkbot/SKILL.md +1 -1
  76. package/skills/agent-discord/SKILL.md +1 -1
  77. package/skills/agent-discordbot/SKILL.md +1 -1
  78. package/skills/agent-instagram/SKILL.md +1 -1
  79. package/skills/agent-kakaotalk/SKILL.md +1 -1
  80. package/skills/agent-line/SKILL.md +1 -1
  81. package/skills/agent-slack/SKILL.md +1 -1
  82. package/skills/agent-slackbot/SKILL.md +1 -1
  83. package/skills/agent-teams/SKILL.md +1 -1
  84. package/skills/agent-telegram/SKILL.md +1 -1
  85. package/skills/agent-telegrambot/SKILL.md +1 -1
  86. package/skills/agent-webex/SKILL.md +1 -1
  87. package/skills/agent-webexbot/SKILL.md +361 -0
  88. package/skills/agent-webexbot/references/authentication.md +225 -0
  89. package/skills/agent-webexbot/references/common-patterns.md +590 -0
  90. package/skills/agent-wechatbot/SKILL.md +1 -1
  91. package/skills/agent-whatsapp/SKILL.md +1 -1
  92. package/skills/agent-whatsappbot/SKILL.md +1 -1
  93. package/src/cli.ts +4 -0
  94. package/src/platforms/webex/typings/webex-message-handler.d.ts +360 -29
  95. package/src/platforms/webexbot/cli.ts +42 -0
  96. package/src/platforms/webexbot/client.ts +87 -0
  97. package/src/platforms/webexbot/commands/auth.test.ts +185 -0
  98. package/src/platforms/webexbot/commands/auth.ts +210 -0
  99. package/src/platforms/webexbot/commands/index.ts +6 -0
  100. package/src/platforms/webexbot/commands/listen.test.ts +20 -0
  101. package/src/platforms/webexbot/commands/listen.ts +104 -0
  102. package/src/platforms/webexbot/commands/member.ts +51 -0
  103. package/src/platforms/webexbot/commands/message.ts +197 -0
  104. package/src/platforms/webexbot/commands/shared.ts +22 -0
  105. package/src/platforms/webexbot/commands/space.ts +88 -0
  106. package/src/platforms/webexbot/commands/whoami.ts +43 -0
  107. package/src/platforms/webexbot/credential-manager.test.ts +182 -0
  108. package/src/platforms/webexbot/credential-manager.ts +149 -0
  109. package/src/platforms/webexbot/index.ts +8 -0
  110. package/src/platforms/webexbot/listener.test.ts +234 -0
  111. package/src/platforms/webexbot/listener.ts +255 -0
  112. package/src/platforms/webexbot/types.test.ts +87 -0
  113. package/src/platforms/webexbot/types.ts +72 -0
  114. package/src/platforms/webexbot/wdm-discovery.test.ts +97 -0
  115. package/src/platforms/webexbot/wdm-discovery.ts +43 -0
@@ -0,0 +1,590 @@
1
+ # Common Patterns
2
+
3
+ ## Overview
4
+
5
+ This guide covers typical workflows for AI agents interacting with Cisco Webex using `agent-webexbot`.
6
+
7
+ **Note**: Webex uses opaque Base64-encoded IDs for spaces, messages, and people. You can't guess them. Always get IDs from `space list` first. The bot can only interact with spaces it has been added to.
8
+
9
+ ## Auth Patterns
10
+
11
+ ### Pattern 1: Authenticate
12
+
13
+ **Use case**: First-time setup
14
+
15
+ ```bash
16
+ #!/bin/bash
17
+
18
+ # Set bot token (validates against Webex API)
19
+ agent-webexbot auth set YOUR_BOT_TOKEN
20
+
21
+ # Or with a custom identifier for multi-bot setups
22
+ agent-webexbot auth set YOUR_BOT_TOKEN --bot deploy
23
+ ```
24
+
25
+ **When to use**: Before any other command, if not already authenticated.
26
+
27
+ ### Pattern 2: Check Auth Status
28
+
29
+ **Use case**: Verify authentication before running operations
30
+
31
+ ```bash
32
+ #!/bin/bash
33
+
34
+ STATUS=$(agent-webexbot auth status)
35
+
36
+ if echo "$STATUS" | jq -e '.error' > /dev/null 2>&1; then
37
+ echo "Not authenticated. Run 'auth set <token>' first."
38
+ exit 1
39
+ fi
40
+
41
+ BOT_NAME=$(echo "$STATUS" | jq -r '.bot_name')
42
+ echo "Authenticated as: $BOT_NAME"
43
+ ```
44
+
45
+ **When to use**: Start of any script or workflow.
46
+
47
+ ## Space Patterns
48
+
49
+ ### Pattern 3: List All Spaces
50
+
51
+ **Use case**: Discover spaces the bot is a member of
52
+
53
+ ```bash
54
+ #!/bin/bash
55
+
56
+ # List all spaces
57
+ SPACES=$(agent-webexbot space list)
58
+ echo "$SPACES" | jq -r '.spaces[] | "\(.title) (\(.id))"'
59
+ ```
60
+
61
+ ### Pattern 4: Filter Spaces by Type
62
+
63
+ **Use case**: Show only group spaces or direct messages
64
+
65
+ ```bash
66
+ #!/bin/bash
67
+
68
+ # Group spaces only
69
+ agent-webexbot space list --type group
70
+
71
+ # Direct messages only
72
+ agent-webexbot space list --type direct
73
+
74
+ # Limit results
75
+ agent-webexbot space list --type group --max 10
76
+ ```
77
+
78
+ ### Pattern 5: Get Space Info
79
+
80
+ **Use case**: Look up details for a specific space
81
+
82
+ ```bash
83
+ #!/bin/bash
84
+
85
+ SPACE_ID="Y2lzY29zcGFyazovL..."
86
+
87
+ INFO=$(agent-webexbot space info "$SPACE_ID")
88
+ TITLE=$(echo "$INFO" | jq -r '.title')
89
+ TYPE=$(echo "$INFO" | jq -r '.type')
90
+
91
+ echo "Space: $TITLE ($TYPE)"
92
+ ```
93
+
94
+ ### Pattern 6: Find Space by Title
95
+
96
+ **Use case**: Get a space ID from its title
97
+
98
+ ```bash
99
+ #!/bin/bash
100
+
101
+ find_space_id() {
102
+ local title=$1
103
+
104
+ SPACES=$(agent-webexbot space list)
105
+ SPACE_ID=$(echo "$SPACES" | jq -r --arg t "$title" '.spaces[] | select(.title==$t) | .id')
106
+
107
+ if [ -z "$SPACE_ID" ]; then
108
+ echo "Space '$title' not found" >&2
109
+ return 1
110
+ fi
111
+
112
+ echo "$SPACE_ID"
113
+ }
114
+
115
+ # Usage
116
+ ENG_ID=$(find_space_id "Engineering")
117
+ if [ $? -eq 0 ]; then
118
+ agent-webexbot message send "$ENG_ID" "Hello Engineering!"
119
+ fi
120
+ ```
121
+
122
+ **When to use**: When you know the space title but need the ID.
123
+
124
+ ## Message Patterns
125
+
126
+ ### Pattern 7: Send a Simple Message
127
+
128
+ **Use case**: Post a notification or update
129
+
130
+ ```bash
131
+ #!/bin/bash
132
+
133
+ SPACE_ID="Y2lzY29zcGFyazovL..."
134
+
135
+ RESULT=$(agent-webexbot message send "$SPACE_ID" "Deployment completed successfully!")
136
+
137
+ if echo "$RESULT" | jq -e '.id' > /dev/null 2>&1; then
138
+ echo "Message sent!"
139
+ else
140
+ echo "Failed: $(echo "$RESULT" | jq -r '.error')"
141
+ exit 1
142
+ fi
143
+ ```
144
+
145
+ ### Pattern 8: Send a Markdown Message
146
+
147
+ **Use case**: Rich formatting in messages
148
+
149
+ ```bash
150
+ #!/bin/bash
151
+
152
+ SPACE_ID="Y2lzY29zcGFyazovL..."
153
+
154
+ agent-webexbot message send "$SPACE_ID" "**Build Status**
155
+ - Branch: \`main\`
156
+ - Tests: 142 passed, 0 failed
157
+ - Coverage: 94.2%" --markdown
158
+ ```
159
+
160
+ ### Pattern 9: Send a Direct Message
161
+
162
+ **Use case**: Message someone directly by email, without finding a space ID first
163
+
164
+ ```bash
165
+ #!/bin/bash
166
+
167
+ # Send a DM by email
168
+ agent-webexbot message dm alice@example.com "Hey, quick question about the PR"
169
+
170
+ # Send a DM with markdown
171
+ agent-webexbot message dm alice@example.com "**Build failed** - can you check?" --markdown
172
+ ```
173
+
174
+ **When to use**: Quick 1:1 messages when you know the recipient's email.
175
+
176
+ ### Pattern 10: Send and Track a Message
177
+
178
+ **Use case**: Send a message and save its ID for later editing
179
+
180
+ ```bash
181
+ #!/bin/bash
182
+
183
+ SPACE_ID="Y2lzY29zcGFyazovL..."
184
+
185
+ # Send initial status
186
+ RESULT=$(agent-webexbot message send "$SPACE_ID" "Deploying v2.1.0...")
187
+ MSG_ID=$(echo "$RESULT" | jq -r '.id')
188
+
189
+ # ... do work ...
190
+ sleep 5
191
+
192
+ # Update the message with final status
193
+ agent-webexbot message edit "$MSG_ID" "$SPACE_ID" "Deployed v2.1.0 successfully!"
194
+ ```
195
+
196
+ ### Pattern 11: List Recent Messages
197
+
198
+ **Use case**: Read conversation history
199
+
200
+ ```bash
201
+ #!/bin/bash
202
+
203
+ SPACE_ID="Y2lzY29zcGFyazovL..."
204
+
205
+ # Get last 10 messages
206
+ MESSAGES=$(agent-webexbot message list "$SPACE_ID" --max 10)
207
+
208
+ echo "$MESSAGES" | jq -r '.messages[] | "[\(.created)] \(.personEmail): \(.text)"'
209
+ ```
210
+
211
+ ### Pattern 12: Delete a Message
212
+
213
+ **Use case**: Remove a message the bot sent
214
+
215
+ ```bash
216
+ #!/bin/bash
217
+
218
+ MESSAGE_ID="Y2lzY29zcGFyazovL..."
219
+
220
+ agent-webexbot message delete "$MESSAGE_ID"
221
+ ```
222
+
223
+ ## Member Patterns
224
+
225
+ ### Pattern 13: List Space Members
226
+
227
+ **Use case**: See who's in a space
228
+
229
+ ```bash
230
+ #!/bin/bash
231
+
232
+ SPACE_ID="Y2lzY29zcGFyazovL..."
233
+
234
+ MEMBERS=$(agent-webexbot member list "$SPACE_ID")
235
+ echo "$MEMBERS" | jq -r '.members[] | "\(.personDisplayName) (\(.personEmail))"'
236
+ ```
237
+
238
+ ### Pattern 14: Find a Specific Member
239
+
240
+ **Use case**: Look up a person in a space
241
+
242
+ ```bash
243
+ #!/bin/bash
244
+
245
+ SPACE_ID="Y2lzY29zcGFyazovL..."
246
+ SEARCH_NAME="alice"
247
+
248
+ MEMBERS=$(agent-webexbot member list "$SPACE_ID")
249
+ MATCH=$(echo "$MEMBERS" | jq -r --arg name "$SEARCH_NAME" \
250
+ 'first(.members[] | select(.personDisplayName | ascii_downcase | contains($name | ascii_downcase)))')
251
+
252
+ if [ -z "$MATCH" ] || [ "$MATCH" = "null" ]; then
253
+ echo "No member matching '$SEARCH_NAME'"
254
+ exit 1
255
+ fi
256
+
257
+ echo "Found: $(echo "$MATCH" | jq -r '.personDisplayName') ($(echo "$MATCH" | jq -r '.personEmail'))"
258
+ ```
259
+
260
+ ## Real-Time Event Patterns
261
+
262
+ ### Pattern 15: Stream All Events
263
+
264
+ **Use case**: Monitor a bot's activity in real time
265
+
266
+ ```bash
267
+ #!/bin/bash
268
+
269
+ # Stream events as NDJSON (Ctrl+C to stop)
270
+ agent-webexbot listen
271
+ ```
272
+
273
+ ### Pattern 16: Filter to Specific Events
274
+
275
+ **Use case**: Only care about new messages
276
+
277
+ ```bash
278
+ #!/bin/bash
279
+
280
+ agent-webexbot listen --events message_created
281
+ ```
282
+
283
+ ### Pattern 17: React to Messages
284
+
285
+ **Use case**: Respond to keywords in real time
286
+
287
+ ```bash
288
+ #!/bin/bash
289
+
290
+ agent-webexbot listen --events message_created | while read -r line; do
291
+ TEXT=$(echo "$line" | jq -r '.payload.text // ""')
292
+ SPACE=$(echo "$line" | jq -r '.payload.roomId // ""')
293
+
294
+ if echo "$TEXT" | grep -qi "status"; then
295
+ agent-webexbot message send "$SPACE" "All systems operational."
296
+ fi
297
+
298
+ if echo "$TEXT" | grep -qi "help"; then
299
+ agent-webexbot message send "$SPACE" "Available commands: \`status\`, \`help\`"
300
+ fi
301
+ done
302
+ ```
303
+
304
+ ### Pattern 18: Log Events to File
305
+
306
+ **Use case**: Audit trail of bot activity
307
+
308
+ ```bash
309
+ #!/bin/bash
310
+
311
+ LOG_FILE="/var/log/webexbot-events.ndjson"
312
+
313
+ agent-webexbot listen >> "$LOG_FILE"
314
+ ```
315
+
316
+ ## Pipeline Patterns
317
+
318
+ ### Pattern 19: Send to Multiple Spaces
319
+
320
+ **Use case**: Broadcast a message across spaces
321
+
322
+ ```bash
323
+ #!/bin/bash
324
+
325
+ MESSAGE="System maintenance in 30 minutes"
326
+ SPACE_NAMES=("Engineering" "Product" "General")
327
+
328
+ # Get all spaces once
329
+ SPACES=$(agent-webexbot space list)
330
+
331
+ for name in "${SPACE_NAMES[@]}"; do
332
+ SPACE_ID=$(echo "$SPACES" | jq -r --arg t "$name" '.spaces[] | select(.title==$t) | .id')
333
+
334
+ if [ -z "$SPACE_ID" ]; then
335
+ echo "Space '$name' not found, skipping"
336
+ continue
337
+ fi
338
+
339
+ echo "Posting to $name..."
340
+ RESULT=$(agent-webexbot message send "$SPACE_ID" "$MESSAGE")
341
+
342
+ if echo "$RESULT" | jq -e '.id' > /dev/null 2>&1; then
343
+ echo " Sent to $name"
344
+ else
345
+ echo " Failed: $(echo "$RESULT" | jq -r '.error')"
346
+ fi
347
+
348
+ # Rate limit: don't spam the API
349
+ sleep 1
350
+ done
351
+ ```
352
+
353
+ ### Pattern 20: Conditional Messaging
354
+
355
+ **Use case**: Send different messages based on conditions
356
+
357
+ ```bash
358
+ #!/bin/bash
359
+
360
+ SPACE_ID="Y2lzY29zcGFyazovL..."
361
+ BUILD_STATUS=$1 # "success" or "failure"
362
+
363
+ if [ "$BUILD_STATUS" = "success" ]; then
364
+ agent-webexbot message send "$SPACE_ID" "Build passed. All tests green." --markdown
365
+ else
366
+ agent-webexbot message send "$SPACE_ID" "**Build failed.** Check CI logs for details." --markdown
367
+ fi
368
+ ```
369
+
370
+ ### Pattern 21: Error Handling with Retry
371
+
372
+ **Use case**: Robust message sending for production scripts
373
+
374
+ ```bash
375
+ #!/bin/bash
376
+
377
+ send_with_retry() {
378
+ local space_id=$1
379
+ local message=$2
380
+ local max_attempts=3
381
+ local attempt=1
382
+
383
+ while [ $attempt -le $max_attempts ]; do
384
+ RESULT=$(agent-webexbot message send "$space_id" "$message")
385
+
386
+ if echo "$RESULT" | jq -e '.id' > /dev/null 2>&1; then
387
+ echo "Message sent successfully!"
388
+ return 0
389
+ fi
390
+
391
+ ERROR=$(echo "$RESULT" | jq -r '.error // "Unknown error"')
392
+ echo "Attempt $attempt failed: $ERROR"
393
+
394
+ # Don't retry on auth errors
395
+ if echo "$ERROR" | grep -qi "401\|unauthorized\|not authenticated\|no credentials"; then
396
+ echo "Authentication error. Fix credentials and try again."
397
+ return 1
398
+ fi
399
+
400
+ # Don't retry on not-found errors
401
+ if echo "$ERROR" | grep -qi "not found\|404"; then
402
+ echo "Resource not found. Check your IDs."
403
+ return 1
404
+ fi
405
+
406
+ if [ $attempt -lt $max_attempts ]; then
407
+ SLEEP_TIME=$((attempt * 2))
408
+ echo "Retrying in ${SLEEP_TIME}s..."
409
+ sleep $SLEEP_TIME
410
+ fi
411
+
412
+ attempt=$((attempt + 1))
413
+ done
414
+
415
+ echo "Failed after $max_attempts attempts"
416
+ return 1
417
+ }
418
+
419
+ # Usage
420
+ SPACE_ID="Y2lzY29zcGFyazovL..."
421
+ send_with_retry "$SPACE_ID" "Important notification!"
422
+ ```
423
+
424
+ ### Pattern 22: Daily Summary Report
425
+
426
+ **Use case**: Generate a workspace activity summary
427
+
428
+ ```bash
429
+ #!/bin/bash
430
+
431
+ SPACE_ID="Y2lzY29zcGFyazovL..."
432
+
433
+ # Get recent messages
434
+ MESSAGES=$(agent-webexbot message list "$SPACE_ID" --max 50)
435
+ MSG_COUNT=$(echo "$MESSAGES" | jq '.messages | length')
436
+
437
+ # Get members
438
+ MEMBERS=$(agent-webexbot member list "$SPACE_ID")
439
+ MEMBER_COUNT=$(echo "$MEMBERS" | jq '.members | length')
440
+
441
+ # Get unique authors from recent messages
442
+ AUTHORS=$(echo "$MESSAGES" | jq -r '[.messages[].personEmail] | unique | length')
443
+
444
+ SUMMARY="**Daily Summary**
445
+ - Messages (last 50): $MSG_COUNT
446
+ - Active authors: $AUTHORS
447
+ - Total members: $MEMBER_COUNT"
448
+
449
+ agent-webexbot message send "$SPACE_ID" "$SUMMARY" --markdown
450
+ ```
451
+
452
+ ### Pattern 23: Multi-Bot Deployment Workflow
453
+
454
+ **Use case**: Use different bots for different environments
455
+
456
+ ```bash
457
+ #!/bin/bash
458
+
459
+ ENVIRONMENT=$1 # "staging" or "production"
460
+ SPACE_ID="Y2lzY29zcGFyazovL..."
461
+
462
+ if [ "$ENVIRONMENT" = "production" ]; then
463
+ agent-webexbot --bot prod-alerts message send "$SPACE_ID" "Production deploy started"
464
+ else
465
+ agent-webexbot --bot staging-alerts message send "$SPACE_ID" "Staging deploy started"
466
+ fi
467
+ ```
468
+
469
+ ## Best Practices
470
+
471
+ ### 1. Always Check for Success
472
+
473
+ ```bash
474
+ # Good
475
+ RESULT=$(agent-webexbot message send "$SPACE_ID" "Hello")
476
+ if echo "$RESULT" | jq -e '.id' > /dev/null 2>&1; then
477
+ echo "Success!"
478
+ else
479
+ echo "Failed: $(echo "$RESULT" | jq -r '.error')"
480
+ fi
481
+
482
+ # Bad
483
+ agent-webexbot message send "$SPACE_ID" "Hello" # No error checking
484
+ ```
485
+
486
+ ### 2. Cache Space Lists
487
+
488
+ ```bash
489
+ # Good - fetch once, reuse
490
+ SPACES=$(agent-webexbot space list)
491
+ for title in "${SPACE_TITLES[@]}"; do
492
+ id=$(echo "$SPACES" | jq -r --arg t "$title" '.spaces[] | select(.title==$t) | .id')
493
+ agent-webexbot message send "$id" "$MESSAGE"
494
+ done
495
+
496
+ # Bad - fetch repeatedly
497
+ for title in "${SPACE_TITLES[@]}"; do
498
+ SPACES=$(agent-webexbot space list) # Wasteful!
499
+ id=$(echo "$SPACES" | jq -r --arg t "$title" '.spaces[] | select(.title==$t) | .id')
500
+ agent-webexbot message send "$id" "$MESSAGE"
501
+ done
502
+ ```
503
+
504
+ ### 3. Rate Limit Your Requests
505
+
506
+ ```bash
507
+ # Good - respect Webex API limits (~600 req/min)
508
+ for space_id in "${SPACE_IDS[@]}"; do
509
+ agent-webexbot message send "$space_id" "$MESSAGE"
510
+ sleep 1
511
+ done
512
+
513
+ # Bad - rapid-fire requests
514
+ for space_id in "${SPACE_IDS[@]}"; do
515
+ agent-webexbot message send "$space_id" "$MESSAGE"
516
+ done
517
+ ```
518
+
519
+ ### 4. Use the Listen Command for Real-Time Needs
520
+
521
+ ```bash
522
+ # Good - event-driven, no polling
523
+ agent-webexbot listen --events message_created | while read -r line; do
524
+ # handle event
525
+ done
526
+
527
+ # Bad - polling wastes API quota and adds latency
528
+ while true; do
529
+ agent-webexbot message list "$SPACE_ID" --max 1
530
+ sleep 5
531
+ done
532
+ ```
533
+
534
+ ### 5. Don't Spam Spaces
535
+
536
+ ```bash
537
+ # Bad - sends 100 messages
538
+ for i in {1..100}; do
539
+ agent-webexbot message send "$SPACE_ID" "Item $i"
540
+ done
541
+
542
+ # Good - batch into single message
543
+ MESSAGE="Updates:"
544
+ for i in {1..100}; do
545
+ MESSAGE="$MESSAGE\n$i. Item $i"
546
+ done
547
+ agent-webexbot message send "$SPACE_ID" "$MESSAGE"
548
+ ```
549
+
550
+ ## Anti-Patterns
551
+
552
+ ### Don't Ignore Auth Errors
553
+
554
+ ```bash
555
+ # Bad
556
+ agent-webexbot message send "$SPACE_ID" "Hello"
557
+ # Continues even if not authenticated
558
+
559
+ # Good
560
+ RESULT=$(agent-webexbot message send "$SPACE_ID" "Hello")
561
+ if echo "$RESULT" | grep -qi "401\|unauthorized\|no credentials"; then
562
+ echo "Auth failed. Run 'auth set <token>' to re-authenticate."
563
+ exit 1
564
+ fi
565
+ ```
566
+
567
+ ### Don't Hardcode IDs Without Context
568
+
569
+ ```bash
570
+ # Bad - mystery ID
571
+ agent-webexbot message send "Y2lzY29zcGFyazovL..." "Hello"
572
+
573
+ # Good - document what the ID refers to
574
+ ENGINEERING_SPACE="Y2lzY29zcGFyazovL..." # Engineering space
575
+ agent-webexbot message send "$ENGINEERING_SPACE" "Hello"
576
+ ```
577
+
578
+ ### Don't Use agent-webexbot for User-Level Access
579
+
580
+ ```bash
581
+ # Wrong tool for the job
582
+ agent-webexbot auth set YOUR_USER_TOKEN # Will fail - not a bot token
583
+
584
+ # Right tool
585
+ agent-webex auth login # For user-level access
586
+ ```
587
+
588
+ ## See Also
589
+
590
+ - [Authentication Guide](authentication.md) - Token types, storage, and troubleshooting
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-wechatbot
3
3
  description: Interact with WeChat Official Account using API credentials - send messages, manage templates, list followers
4
- version: 2.20.4
4
+ version: 2.21.0
5
5
  allowed-tools: Bash(agent-wechatbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-whatsapp
3
3
  description: Interact with WhatsApp - send messages, read chats, manage conversations
4
- version: 2.20.4
4
+ version: 2.21.0
5
5
  allowed-tools: Bash(agent-whatsapp:*)
6
6
  metadata:
7
7
  openclaw:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-whatsappbot
3
3
  description: Interact with WhatsApp using Cloud API credentials - send messages, manage templates
4
- version: 2.20.4
4
+ version: 2.21.0
5
5
  allowed-tools: Bash(agent-whatsappbot:*)
6
6
  metadata:
7
7
  openclaw:
package/src/cli.ts CHANGED
@@ -76,6 +76,10 @@ program.command('webex', 'Interact with Cisco Webex', {
76
76
  executableFile: join(__dirname, 'platforms', 'webex', `cli${ext}`),
77
77
  })
78
78
 
79
+ program.command('webexbot', 'Interact with Cisco Webex using bot tokens', {
80
+ executableFile: join(__dirname, 'platforms', 'webexbot', `cli${ext}`),
81
+ })
82
+
79
83
  program.command('tui', 'Launch unified messenger TUI', {
80
84
  executableFile: join(__dirname, 'tui', `cli${ext}`),
81
85
  })