Skip to main content
Optimize your command line operations by following safety best practices and resolving common CLI errors.

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:
1

List resources to retrieve IDs

Find target IDs by running lookup commands, for example:
2

Verify target Contact

Inspect the contact details by email or phone number to confirm you have the correct record:
3

Perform the action

Execute the command using the retrieved IDs:
4

Confirm results

Verify the changes were applied successfully:

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:
Use --help at any group or sub-command level to inspect syntax:

Common Issues

References