@slnka/cli
v1.0.0-beta.1
Published
SLNKA CLI - Manage links, webhooks, deep links & analytics from the terminal
Maintainers
Readme
@slnka/cli
SLNKA CLI -- manage links, webhooks, deep links, and analytics from the terminal.
Installation
Homebrew (macOS)
brew tap slnka/tap
brew install slnkanpm
npm install -g @slnka/cliOr use without installing:
npx @slnka/cli links listAuthentication
# Login with API key
slnka auth login --api-key lsk_live_your_key --workspace ws-your-workspace
# Login interactively (prompts for API key)
slnka auth login
# Check authentication status
slnka auth status
# Logout (clears ~/.slnkarc)
slnka auth logoutYou can also set environment variables (legacy SLNK_* names still work for backward compatibility, but SLNKA_* takes precedence):
export SLNKA_API_KEY=lsk_live_your_key
export SLNKA_WORKSPACE=ws-your-workspace
export SLNKA_SERVER_URL=https://your-instance.slnka.ma # RequiredLinks
# Create a short link
slnka links create --url https://example.com/long-page
slnka links create --url https://example.com --alias my-custom-slug
slnka links create --url https://example.com --tags marketing,campaign-q1
# List links
slnka links list
slnka links list --tag marketing
slnka links list --format json
# Get link details
slnka links info abc1234
# Delete a link
slnka links delete abc1234Analytics
# Live event stream (polls every 2s)
slnka analytics live
slnka analytics live --events page_view,purchase
slnka analytics live --interval 5000
# Analytics summary
slnka analytics summary
slnka analytics summary --format jsonDeep Links
# Test deep link resolution
slnka deeplinks test https://slnka.ma/abc1234 --platform ios
slnka deeplinks test https://slnka.ma/abc1234 --platform android --verboseThis verifies:
- Apple App Site Association (AASA) file for iOS
- Asset Links file for Android
- Link resolution via SLNKA API
- Deep link path and parameters
Webhooks
# Start a local webhook listener
slnka webhooks listen
slnka webhooks listen --port 8888
slnka webhooks listen --events link.clicked,link.createdRegister http://localhost:9876/ in the SLNKA dashboard webhook settings, then watch events stream in real-time.
Migration
Import links from other platforms:
# From Bitly (live API)
slnka migrate --from bitly --api-key YOUR_BITLY_TOKEN
# From Firebase Dynamic Links (file export)
slnka migrate --from firebase --file exported-links.csv
# From Segment (guided migration)
slnka migrate --from segment
# Dry run (preview without importing)
slnka migrate --from bitly --api-key TOKEN --dry-runSupported sources
| Source | Method | Notes | |--------|--------|-------| | Bitly | Live API or CSV | Fetches all bitlinks from your account | | Firebase | CSV export | Firebase Dynamic Links deprecated Aug 2025 | | Segment | Guided | Recommends @slnka/compat-segment for code-level migration |
Configuration
The CLI stores configuration in ~/.slnkarc (legacy ~/.slnkrc is still read for backward compatibility):
{
"apiKey": "lsk_live_xxx",
"defaultWorkspace": "ws-xxx",
"serverUrl": "https://your-instance.slnka.ma"
}Environment variable precedence
Environment variables take precedence over the config file. The new SLNKA_* variables are preferred; legacy SLNK_* variables are still read for backward compatibility.
| Variable | Description |
|----------|-------------|
| SLNKA_API_KEY (fallback: SLNK_API_KEY) | API key |
| SLNKA_WORKSPACE (fallback: SLNK_WORKSPACE) | Default workspace ID |
| SLNKA_SERVER_URL (fallback: SLNK_SERVER_URL) | API server URL |
| SLNKA_DEBUG (fallback: SLNK_DEBUG) | Set to 1 for debug logging |
Output Formats
Most commands support --format with two options:
table(default): Human-readable table formatjson: Machine-readable JSON for scripting
# Pipe JSON output to jq
slnka links list --format json | jq '.content[].shortCode'License
MIT
