@sendhoney/cli 0.1.14 → 0.1.15
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/README.md +97 -1
- package/bin/sendhoney +8 -2
- package/endpoints.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,6 +61,9 @@ sendhoney credentials add --type postiz --json @postiz-credential.json
|
|
|
61
61
|
sendhoney credentials update --id CREDENTIAL_ID --json @rotated-credential.json
|
|
62
62
|
sendhoney credentials validate --secret-refs @secret-refs.json
|
|
63
63
|
|
|
64
|
+
# Enable contact center and other modules for an organization
|
|
65
|
+
sendhoney resources enable-modules --org-id ORG_ID --modules contact_center,crm
|
|
66
|
+
|
|
64
67
|
# Log in and resolve the current workspace organization automatically
|
|
65
68
|
sendhoney login
|
|
66
69
|
sendhoney resources current
|
|
@@ -92,7 +95,7 @@ sendhoney widget install --org-id ORG_ID --widget-type both --file ./dist/index.
|
|
|
92
95
|
| `whoami` | Return the authenticated user profile |
|
|
93
96
|
| `auth status` | Show authenticated state, expiry, user, organization, and resolved org ID without tokens |
|
|
94
97
|
| `menu [--operator]` | Interactive resource menu grouped by domain |
|
|
95
|
-
| `resources list \| current` | List organization modules / current org |
|
|
98
|
+
| `resources list \| current \| enable-modules` | List organization modules / current org / enable modules |
|
|
96
99
|
| `endpoints list` | List published API endpoints |
|
|
97
100
|
| `billing balance [--org-id ID]` | Organization billing balance |
|
|
98
101
|
| `billing ledger [--org-id ID]` | Organization billing ledger |
|
|
@@ -108,6 +111,60 @@ sendhoney widget install --org-id ORG_ID --widget-type both --file ./dist/index.
|
|
|
108
111
|
| `thundercompute catalog\|health\|models\|status\|pull\|ensure\|chat` | ThunderCompute / RunPod AI model operations |
|
|
109
112
|
| `release check [--platform android\|ios\|all]` | Check mobile release readiness |
|
|
110
113
|
|
|
114
|
+
## Module management
|
|
115
|
+
|
|
116
|
+
Organizations must explicitly enable modules (e.g., CRM, Contact Center, Inventory) before they appear in the mobile app or web dashboard. Use the CLI to enable modules for an organization:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Enable contact center and CRM modules
|
|
120
|
+
sendhoney resources enable-modules --org-id ORG_ID --modules contact_center,crm
|
|
121
|
+
|
|
122
|
+
# Enable multiple modules at once
|
|
123
|
+
sendhoney resources enable-modules --org-id ORG_ID --modules contact_center,crm,inventory,books
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Available module slugs
|
|
127
|
+
|
|
128
|
+
Use these exact slugs with `--modules` (comma-separated, no spaces):
|
|
129
|
+
|
|
130
|
+
| Module | Slug | Description |
|
|
131
|
+
|--------|------|-------------|
|
|
132
|
+
| CRM | `crm` | Accounts, contacts, opportunities, cases |
|
|
133
|
+
| Contact Center | `contact_center` | Team inboxes, AI assist, voice/WebRTC |
|
|
134
|
+
| Inventory | `inventory` | Warehouse, stock, goods receipt |
|
|
135
|
+
| Books/Finance | `books` | Accounting, billing, payments |
|
|
136
|
+
| HR | `hr` | Recruitment, payroll, workforce |
|
|
137
|
+
| Logistics | `logistics` | Fleet, delivery, field ops |
|
|
138
|
+
| Healthcare | `healthcare` | Facilities, patients, standards |
|
|
139
|
+
| FMCG | `fmcg` | Fast-moving consumer goods workflows |
|
|
140
|
+
| Storage | `storage` | Document/object storage |
|
|
141
|
+
| Incentive Schemes | `incentive_schemes` | Loyalty, rewards, commissions |
|
|
142
|
+
|
|
143
|
+
### Troubleshooting: Contact Center not visible in mobile app
|
|
144
|
+
|
|
145
|
+
If the Contact Center module doesn't appear for a user (e.g., `graham@decoded.africa`):
|
|
146
|
+
|
|
147
|
+
1. **Find the organization ID**:
|
|
148
|
+
```bash
|
|
149
|
+
sendhoney auth status
|
|
150
|
+
# Look for "orgId" in the output
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
2. **Enable the Contact Center module**:
|
|
154
|
+
```bash
|
|
155
|
+
sendhoney resources enable-modules --org-id <ORG_ID> --modules contact_center
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
3. **Verify modules are active**:
|
|
159
|
+
```bash
|
|
160
|
+
sendhoney resources list
|
|
161
|
+
# Should show contact_center in the enabled modules
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
4. **Restart the mobile app** to refresh the module list (it caches for 5 minutes).
|
|
165
|
+
|
|
166
|
+
The mobile app normalizes module names (e.g., `contact-center-team-inboxes` → `contact_center`), so enabling `contact_center` activates all contact center sub-modules.
|
|
167
|
+
|
|
111
168
|
---
|
|
112
169
|
|
|
113
170
|
## Authentication
|
|
@@ -116,6 +173,45 @@ sendhoney widget install --org-id ORG_ID --widget-type both --file ./dist/index.
|
|
|
116
173
|
|
|
117
174
|
Credentials are stored in `$XDG_CONFIG_HOME/sendhoney/config.json` (or `~/.config/sendhoney/config.json`) with mode `0600`; tokens are never printed by the CLI. After browser login, the CLI exchanges the PKCE code, hydrates the Keycloak user profile and current organization, and stores the resolved `orgId` in the local session. `sendhoney widget install` can therefore use the saved organization without a second ID lookup.
|
|
118
175
|
|
|
176
|
+
### Troubleshooting organization resolution
|
|
177
|
+
|
|
178
|
+
If `sendhoney auth status` shows `"workspaceState": "AUTHENTICATED_WORKSPACE_PENDING"` and `"organization": { "error": "unauthorized" }` after successful login, the Keycloak access token is missing the `email` claim. The gateway requires this claim to call `/api/v1/org/me` and resolve your organization.
|
|
179
|
+
|
|
180
|
+
**Fix**: In Keycloak admin console, for the `sendhoney-cli` client in the `users` realm:
|
|
181
|
+
1. Go to **Clients** → `sendhoney-cli` → **Mappers**
|
|
182
|
+
2. Click **Create** → Select **User Property** mapper
|
|
183
|
+
3. Configure:
|
|
184
|
+
- **Name**: `email`
|
|
185
|
+
- **User Property**: `email`
|
|
186
|
+
- **Token Claim Name**: `email`
|
|
187
|
+
- **Claim JSON Type**: `String`
|
|
188
|
+
- **Add to access token**: ON
|
|
189
|
+
- **Add to ID token**: ON
|
|
190
|
+
- **Add to userinfo**: ON
|
|
191
|
+
4. Save and re-run `sendhoney login`
|
|
192
|
+
|
|
193
|
+
Verify the fix by decoding your access token (e.g., at jwt.io) — it should contain `"email": "your@email.com"`.
|
|
194
|
+
|
|
195
|
+
### Troubleshooting: Modules not visible in mobile app
|
|
196
|
+
|
|
197
|
+
If a user (e.g., `graham@decoded.africa`) logs into the mobile app but doesn't see activated modules (including Contact Center):
|
|
198
|
+
|
|
199
|
+
1. **The organization must have modules explicitly enabled** — modules are not enabled by default
|
|
200
|
+
2. **Use the CLI to enable modules**:
|
|
201
|
+
```bash
|
|
202
|
+
sendhoney resources enable-modules --org-id <ORG_ID> --modules contact_center,crm
|
|
203
|
+
```
|
|
204
|
+
3. **Contact Center sub-modules** (`contact-center-team-inboxes`, `contact-center-ai-assist`, `contact-center-voice-webrtc`) are all activated by enabling the parent `contact_center` slug
|
|
205
|
+
4. **Mobile app caches modules for 5 minutes** — restart the app or pull-to-refresh after enabling
|
|
206
|
+
|
|
207
|
+
### Diagnostic command
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
sendhoney auth status
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Shows authenticated state, token expiry, user profile, organization data, and resolved `orgId` without printing tokens.
|
|
214
|
+
|
|
119
215
|
---
|
|
120
216
|
|
|
121
217
|
## Credentials
|
package/bin/sendhoney
CHANGED
|
@@ -413,11 +413,17 @@ async function curated(args, subcommand) {
|
|
|
413
413
|
const orgId = args['org-id'] || loadConfig().orgId
|
|
414
414
|
if (subcommand === 'list') return request('GET', '/api/organization/modules', args)
|
|
415
415
|
if (subcommand === 'current') return request('GET', '/api/v1/org/me', args)
|
|
416
|
+
if (subcommand === 'enable-modules') {
|
|
417
|
+
if (!orgId) die('resources enable-modules requires --org-id or workspace selection')
|
|
418
|
+
const modules = args.modules ? String(args.modules).split(',').map(s => s.trim()) : []
|
|
419
|
+
if (!modules.length) die('resources enable-modules requires --modules comma-separated list')
|
|
420
|
+
return request('PUT', '/api/organization/access-profile', { ...args, json: { tenantId: orgId, enabledModules: modules } })
|
|
421
|
+
}
|
|
416
422
|
if (subcommand === 'endpoints') return json(catalog().filter((entry) => entry.auth !== 'service' && entry.auth !== 'admin'))
|
|
417
423
|
if (subcommand === 'balance') { if (!orgId) die('billing balance requires --org-id or workspace selection'); return request('GET', `/api/billing/balance/${encodeURIComponent(orgId)}`, args) }
|
|
418
424
|
if (subcommand === 'ledger') { if (!orgId) die('billing ledger requires --org-id or workspace selection'); return request('GET', `/api/billing/ledger/${encodeURIComponent(orgId)}`, args) }
|
|
419
425
|
if (subcommand === 'rates') return request('GET', '/api/billing/rate', args)
|
|
420
|
-
die('use resources list|current, endpoints list, or billing balance|ledger|rates')
|
|
426
|
+
die('use resources list|current|enable-modules, endpoints list, or billing balance|ledger|rates')
|
|
421
427
|
}
|
|
422
428
|
|
|
423
429
|
async function login(args) {
|
|
@@ -452,7 +458,7 @@ async function main() {
|
|
|
452
458
|
}
|
|
453
459
|
if (!command && stdin.isTTY && stdout.isTTY) return interactiveMenu(args)
|
|
454
460
|
if (!command || command === 'help' || args.help) {
|
|
455
|
-
process.stdout.write('SendHoney CLI\n\nCommands: login, logout, whoami, menu, resources, endpoints, billing, api, crud, credentials, widget, thundercompute, release\n\n`login` opens a Keycloak PKCE browser login when no token/password is supplied.\nresources list\nresources current\nendpoints list\nbilling balance [--org-id ID]\nbilling ledger [--org-id ID]\nbilling rates\napi request METHOD PATH [--json JSON] | api get|post|put|patch|delete PATH\napi catalog [--search TEXT] [--method GET]\ncrud PATH list|create|update|delete [--id ID] [--json JSON] [--yes]\ncredentials list [--tenant-id ID]\ncredentials add [--type TYPE] [--json JSON|@FILE]\ncredentials update --id ID [--json JSON|@FILE]\ncredentials validate --secret-refs @FILE | --secret-ref REF\nwidget install [--org-id ID] [--next-app path/to/app] [--file path/to/index.html] [--widget-type chat|video|both]\nSecret payloads are sent to the API and are never printed by these commands.\nthundercompute catalog|health|models|status|pull|ensure|chat\nrelease check [--platform android|ios|all]\n')
|
|
461
|
+
process.stdout.write('SendHoney CLI\n\nCommands: login, logout, whoami, menu, resources, endpoints, billing, api, crud, credentials, widget, thundercompute, release\n\n`login` opens a Keycloak PKCE browser login when no token/password is supplied.\nresources list\nresources current\nresources enable-modules --org-id ID --modules contact_center,crm\nendpoints list\nbilling balance [--org-id ID]\nbilling ledger [--org-id ID]\nbilling rates\napi request METHOD PATH [--json JSON] | api get|post|put|patch|delete PATH\napi catalog [--search TEXT] [--method GET]\ncrud PATH list|create|update|delete [--id ID] [--json JSON] [--yes]\ncredentials list [--tenant-id ID]\ncredentials add [--type TYPE] [--json JSON|@FILE]\ncredentials update --id ID [--json JSON|@FILE]\ncredentials validate --secret-refs @FILE | --secret-ref REF\nwidget install [--org-id ID] [--next-app path/to/app] [--file path/to/index.html] [--widget-type chat|video|both]\nSecret payloads are sent to the API and are never printed by these commands.\nthundercompute catalog|health|models|status|pull|ensure|chat\nrelease check [--platform android|ios|all]\n')
|
|
456
462
|
return
|
|
457
463
|
}
|
|
458
464
|
if (command === 'login') {
|