Skip to content

Repository files navigation

πŸ“± send-sms-freemobile

NPM Version CI Status License

An fast and user-friendlySend CLI to SMS instantly from your terminal using FreeMobile API


πŸ“¦ Installation

For End Users (Recommended)

# Install globally with npm
npm install -g send-sms-freemobile

# Or use directly with npx (no installation)
npx send-sms-freemobile --help

# With Bun
bun install -g send-sms-freemobile
bunx send-sms-freemobile --help

⚑ Configuration

You can configure your FreeMobile credentials using environment variables or CLI arguments. See the Configuration Methods section below for details.

πŸ“± FreeMobile Account Setup

You need a FreeMobile subscription to use this tool.

  1. Go to FreeMobile account
  2. Login with your FreeMobile credentials
  3. Get your User ID
  4. Navigate to "Mes Options"
  5. Enable "Notification par SMS" if not already enabled
  6. Generate an API key if you don't have one yet

πŸš€ Usage Examples

Basic Usage

# Simple message
send-sms-freemobile -m "Hello World!"

# From a file
send-sms-freemobile -s message.txt

Advanced Usage

# Multi-line message
send-sms-freemobile -m "Line 1
Line 2
Line 3"

# With specific credentials (overrides saved config)
send-sms-freemobile -u 12345678 -p your_api_key -m "Hello!"

πŸ“– Input Methods

This tool supports 4 different ways to provide your message:

1. πŸ’¬ Direct Message (--message, -m)

send-sms-freemobile -m "Your message here"

2. πŸ“„ File Input (--source, -s)

echo "Server is down!" > alert.txt
send-sms-freemobile -s alert.txt

3. πŸ“¨ Stdin Pipe (perfect for scripts)

echo "Build completed successfully!" | send-sms-freemobile
curl -s https://api.status.io/myservice | send-sms-freemobile

4. ✏️ Interactive Mode

# Just run without message - it will prompt you
send-sms-freemobile

# Offers single-line or multi-line editor

βš™οΈ Configuration Methods

1. πŸ“ Environment File (.env) (Recommended)

echo "FREEMOBILE_USER=12345678" > .env
echo "FREEMOBILE_PASS=your_api_key" >> .env
send-sms-freemobile -m "Hello!"

2. 🌍 Environment Variables

export FREEMOBILE_USER=12345678
export FREEMOBILE_PASS=your_api_key
send-sms-freemobile -m "Hello!"

3. πŸ”‘ CLI Arguments (one-time use)

send-sms-freemobile -u 12345678 -p your_api_key -m "Hello!"

πŸ“‹ Command Reference

Option Alias Description Example
--message -m SMS message text -m "Hello World!"
--source -s Read message from file -s message.txt
--user -u FreeMobile user ID (8 digits) -u 12345678
--pass -p FreeMobile API key -p your_api_key
--version -v Show version number -v
--help -h Show help message -h

πŸ”„ Message Processing

Messages are automatically processed for maximum compatibility thanks to freemobile-api package:

  • URL decoded: Hello%20World β†’ Hello World
  • Newline handling: Line 1\nLine 2 β†’ Multi-line SMS
  • Long message chunking: Messages >999 chars split automatically
  • Emoji support: Compatible emojis preserved, others converted safely

πŸ’‘ Use Cases & Examples

πŸ–₯️ Server Monitoring

# Add to your monitoring script
if ! ping -c 1 your-server.com; then
    echo "⚠️ Server your-server.com is DOWN!" | send-sms-freemobile
fi

πŸ”§ Deployment Notifications

# In your CI/CD pipeline
echo "πŸš€ Production deployment completed successfully!" | send-sms-freemobile

πŸ“Š Backup Completion

# In your backup script
echo "βœ… Daily backup completed - $(date)" | send-sms-freemobile

πŸ”” Custom Alerts

# CPU usage alert
cpu_usage=$(top -l1 | grep "CPU usage" | cut -d% -f1 | cut -d: -f2)
if [ $cpu_usage -gt 80 ]; then
    echo "⚠️ High CPU usage: ${cpu_usage}%" | send-sms-freemobile
fi

πŸ› οΈ For Developers

Local Development

# Clone and setup
git clone https://github.com/davlgd/send-sms-freemobile.git
cd send-sms-freemobile
bun install # or npm install

# Run locally
bun run index.ts --help

# Run tests
bun test

# Code quality checks
bun run validate

πŸ“„ License

Apache 2.0 License - see the LICENSE file for details.


⭐ Found this useful? Give it a star on GitHub and share it with others!

Made with ❀️ for the Open Source Community

About

πŸ“± Modern CLI tool for sending SMS via FreeMobile API with TypeScript

Topics

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages