Reference
CLI Reference
Command line interface for Unhook
Installation
Install the Unhook CLI globally using your preferred package manager:
Quick Start
- Initialize your project:
- Start the webhook:
- Use the generated webhook URL in your provider’s settings:
Core Commands
Start Webhook
Initialize Project
Command Line Options
Option | Alias | Description | Required | Default |
---|---|---|---|---|
--port | -p | Local service port | Yes* | - |
--webhook-id | -t | Webhook ID | Yes* | - |
--client-id | -c | Unique client ID | No | Auto-generated |
--redirect | -r | Redirect URL | Yes* | - |
--debug | -d | Enable debug logs | No | false |
--ping | - | Health check config | No | true |
--help | -h | Show help | No | - |
--version | -v | Show version | No | - |
* Either --port
or --redirect
must be provided, but not both.
Configuration
Configuration File
Create an unhook.yaml
in your project root:
Environment Variables
All CLI options can be set via environment variables:
Interactive UI
The CLI includes an interactive terminal UI that shows:
- Connection status
- Webhook activity
- Error messages
- Debug information (when enabled)
UI Elements
- Status Bar: Shows connection status and client ID
- Activity Log: Real-time webhook request log
- Debug Panel: Detailed debug information (visible with
--debug
) - Error Messages: Highlighted in red for visibility
Health Checks
The --ping
option configures connection health monitoring:
Authentication
Authentication data is stored locally at ~/.unhook/auth-storage.json
:
- Authentication state
- User tokens
- Organization ID
- Basic user info
To clear auth data:
Exit Codes
Code | Description |
---|---|
0 | Success |
1 | General error |
2 | Invalid configuration |
3 | Network error |
4 | Authentication error |
Examples
Basic Development Setup
Team Development
Production Redirect
Custom Health Checks
Best Practices
- Use Client IDs: Always specify a meaningful client ID in team environments
- Enable Debug Logging: Use
--debug
when troubleshooting issues - Health Checks: Configure appropriate health checks for your setup
- Environment Variables: Use env vars for sensitive information
- Configuration Files: Use config files for consistent settings
Troubleshooting
Common Issues
-
Connection Issues
- Check your internet connection
- Verify the webhook ID is correct
- Ensure the port is available
-
Authentication Problems
- Clear auth data:
rm ~/.unhook/auth-storage.json
- Re-run initialization:
npx @unhook/cli init
- Clear auth data:
-
Debug Mode
- Enable debug logging:
unhook listen --debug
- Check the debug panel for detailed information
- Enable debug logging: