Safe Operating Workflows
Some CLI commands require internal IDs (e.g.,contactId, tagId, flowId, customFieldId, or inboxId). Find and verify these IDs before executing commands that modify data:
Verify target Contact
Inspect the contact details by email or phone number to confirm you have the correct record:
Testing Actions Safely
For commands that send messages, trigger Flows, or update bulk records, always run the command on a test Contact first:Common Automation Examples
Combine the CLI’s--json option and jq to automate common workflows in shell scripts:
1. Tag a contact by tag name (resolving ID dynamically)
Find the ID of a tag by its name, then apply it to a contact:2. Send a specific Flow to a contact
Find the ID of a flow by its name, then trigger it for a contact:3. Set a Custom Field value on a contact
Find the ID of a custom field, then update its value for a contact:4. Send a message and verify history
Send a direct message and inspect history to confirm delivery:CLI Help and Cache Management
The CLI caches the OpenAPI spec at~/.chatbotX/openapi-cache.json for 1 hour. If your self-hosted system recently added new APIs, force the CLI to refresh the spec:
--help at any group or sub-command level to inspect syntax:
Common Issues
| Issue | Common Cause | Fix |
|---|---|---|
401 or 403 | Token is incorrect, expired, or missing permissions. | Create a new Workspace token and update configuration. See Authentication |
| CLI does not show a new command | OpenAPI spec cache is stale. | Run the command with --refresh-spec option. |
| TLS certificate error | Self-hosted server uses a self-signed certificate. | Enable --allowSelfSignedCert or CHATBOTX_ALLOW_SELF_SIGNED_CERT=true. See Authentication |
| Contact not found | Identifier format is incorrect. | Use explicit prefix: id:<value>, email:<value>, or phone:<value>. |
References
- ChatbotX CLI on npm: Official npm package details.