TextNow CLI
A command-line interface for TextNow SMS messaging using cookie-based authentication.
Installation
cd /path/to/textnow-integration/cli
npm install
npm link # Makes 'textnow' available globally
Authentication
Before using the CLI, you need to authenticate with your TextNow account cookies:
textnow auth
This will guide you through extracting cookies from your browser:
- Log into https://textnow.com
- Open DevTools (F12 or Cmd+Option+I)
- Go to the Console tab
- Run:
document.cookie - Copy the entire output
- Paste when prompted
Credentials are stored in ~/.textnow/credentials.json.
Commands
Check Authentication
textnow whoami
Shows your username and phone number.
Send SMS
textnow send "+1234567890" "Hello, world!"
textnow send "555-123-4567" "Your message here"
Send Image
textnow send-image "+1234567890" ./photo.jpg
textnow send-image "555-123-4567" ~/Pictures/image.png --caption "Check this out!"
List Recent Messages
textnow messages
textnow messages --limit 50
Credentials
Credentials are stored at ~/.textnow/credentials.json and include:
- Your browser cookies (full cookie string)
- Parsed auth tokens (connect.sid, _csrf, XSRF-TOKEN)
- Username (if extracted or manually entered)
- Timestamp
Troubleshooting
Session Expired
If you get 401/403 errors, your session has expired. Run textnow auth again with fresh cookies.
API Errors
TextNow's API may change. If commands stop working, check for updates to this CLI or file an issue.
Security Note
Your cookies contain sensitive session data. The credentials file is stored locally and should be kept secure.