@sendly/cli
v3.5.2
Published
Sendly CLI - Send SMS from your terminal
Downloads
2,503
Readme
@sendly/cli
Official command-line interface for the Sendly SMS API.
Installation
npm install -g @sendly/cliQuick Start
# Login to your Sendly account
sendly login
# Send an SMS
sendly sms send --to "+15551234567" --text "Hello from Sendly CLI!"
# Check your credit balance
sendly credits balanceAuthentication
The CLI supports two authentication methods:
Browser Login (Recommended)
sendly loginThis opens your browser to authenticate via Sendly's secure login flow. After authorization, your credentials are stored locally.
API Key Login
sendly login --api-key sk_test_v1_your_keyOr interactively:
sendly login -iCheck Authentication Status
sendly whoamiLogout
sendly logoutCommands
SMS Commands
Send a Message
sendly sms send --to "+15551234567" --text "Hello!"
# With sender ID (international)
sendly sms send --to "+447700900000" --text "Hello!" --from "MyBrand"List Messages
sendly sms list
# Filter by status
sendly sms list --status delivered
# Limit results
sendly sms list --limit 10Get Message Details
sendly sms get msg_abc123Send Batch Messages
# From a JSON file
sendly sms batch --file messages.json
# From a CSV file (phone-only with shared text)
sendly sms batch --file phones.csv --text "Your order is ready!"
# Multiple recipients inline
sendly sms batch --to "+15551234567,+15559876543" --text "Hello everyone!"
# Preview before sending (dry run) - validates without sending
sendly sms batch --file messages.json --dry-run
# Dry run output includes:
# - Per-country breakdown with credit costs
# - Blocked messages and reasons
# - Your messaging access (domestic/international)
# - Credit balance checkSchedule a Message
sendly sms schedule --to "+15551234567" --text "Reminder!" --at "2025-12-25T10:00:00Z"List Scheduled Messages
sendly sms scheduledCancel a Scheduled Message
sendly sms cancel sched_abc123API Key Commands
List API Keys
sendly keys listCreate a New Key
sendly keys create --name "Production Key" --type liveRevoke a Key
sendly keys revoke key_abc123Credit Commands
Check Balance
sendly credits balanceOutput includes:
- Current balance
- Reserved credits
- Estimated messages remaining
View Transaction History
sendly credits history
# Limit results
sendly credits history --limit 20Webhook Commands
List Webhooks
sendly webhooks listListen for Webhooks Locally
Start a local tunnel to receive webhook events during development (similar to Stripe CLI):
sendly webhooks listen
# Forward to a specific URL
sendly webhooks listen --forward http://localhost:3000/webhook
# Listen for specific events
sendly webhooks listen --events message.delivered,message.failedThis creates a secure tunnel and displays:
- Tunnel URL
- Webhook secret for signature verification
- Real-time event stream
Logs Commands
Tail Logs
Stream real-time API activity:
sendly logs tail
# Filter by status
sendly logs tail --status errorConfiguration Commands
Get Configuration Value
sendly config get baseUrlSet Configuration Value
sendly config set baseUrl https://api.sendly.liveList All Configuration
sendly config listDiagnostics
Run diagnostics to check your setup:
sendly doctorThis checks:
- Authentication status
- API connectivity
- Configuration validity
- Network issues
Environment Variables
Override CLI configuration with environment variables:
| Variable | Description |
|----------|-------------|
| SENDLY_API_KEY | API key for authentication |
| SENDLY_BASE_URL | API base URL (default: https://sendly.live) |
| SENDLY_OUTPUT_FORMAT | Output format: text or json |
| SENDLY_NO_COLOR | Disable colored output |
| SENDLY_TIMEOUT | Request timeout in milliseconds |
| SENDLY_MAX_RETRIES | Maximum retry attempts |
Output Formats
Text (Default)
Human-readable formatted output with colors.
JSON
Machine-readable JSON output for scripting:
sendly sms list --json
sendly credits balance --jsonCI/CD Usage
For non-interactive environments:
# Set API key via environment variable
export SENDLY_API_KEY=sk_live_v1_your_key
# Or pass directly
sendly sms send --api-key sk_live_v1_your_key --to "+15551234567" --text "Hello!"
# Use JSON output for parsing
sendly credits balance --json | jq '.balance'Configuration Storage
Configuration is stored in:
- macOS/Linux:
~/.sendly/config.json - Windows:
%USERPROFILE%\.sendly\config.json
Webhook Signature Verification
When using sendly webhooks listen, verify signatures in your app:
import crypto from 'crypto';
function verifyWebhook(payload, signature, secret) {
const expectedSig = 'v1=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expectedSig)
);
}Requirements
- Node.js 18.0.0 or higher
- A Sendly account (sign up free)
Documentation
Support
License
MIT
