2026-01-28 23:00:58 -05:00

77 lines
1.7 KiB
Markdown

# TextNow CLI
A command-line interface for TextNow SMS messaging using cookie-based authentication.
## Installation
```bash
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:
```bash
textnow auth
```
This will guide you through extracting cookies from your browser:
1. Log into https://textnow.com
2. Open DevTools (F12 or Cmd+Option+I)
3. Go to the Console tab
4. Run: `document.cookie`
5. Copy the entire output
6. Paste when prompted
Credentials are stored in `~/.textnow/credentials.json`.
## Commands
### Check Authentication
```bash
textnow whoami
```
Shows your username and phone number.
### Send SMS
```bash
textnow send "+1234567890" "Hello, world!"
textnow send "555-123-4567" "Your message here"
```
### Send Image
```bash
textnow send-image "+1234567890" ./photo.jpg
textnow send-image "555-123-4567" ~/Pictures/image.png --caption "Check this out!"
```
### List Recent Messages
```bash
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.