Sending notification SMS from command line is a great way to send an SMS message to your employees or clients. For example, you might use it as an alert system or as a reminder system for your employees.

In the old days, you would have to create a program in order to send text messages from your computer, meaning you would need to have access to a data coding scheme installed and configured. But now, all you have to do is turn on your computer and open up the terminal window to send SMS at command.

There is a very easy way to send text notifications from a unix command line. Using this guide and example bash script provided below, you can be up and running in less than 10 minutes.

1) Sign up for an account and get to the Dashboard

Sign up for an account here

Sending SMS from command line is a process that does not require a mobile phone at all. It can be achieved by setting up an account with Messente that gives you a message ID.

Make sure you also verify your phone number, as this is required to send SMS messages. If you skipped the number verification during sign-up, then you can add it later by selecting “+ Add Sender” from the Dashboard Sender selection drop-down menu.

2) Get your API username and password

First you need to know the IP address of your server that you'll be using to send SMS messages via an API call. Find out your IP address from the command line:

$ echo `curl -s`

Now go and get your SMS API username and password from the dashboard.

3) Get the bash script

Save following script to a file, for example

#set -x

# Configure this!

# ---------------------------------------
# Do not modify anything below this line
# ---------------------------------------

if [ ! "$#" -eq 2 ]; then
 echo "ERROR 2 arguments required, $# provided"
 echo "-------------------------------------------------"
 echo "Usage: bash $0 full_phone_number text_message"
 echo "Example: bash $0 4463773683 "This is a test message""
 echo "-------------------------------------------------"
 exit 1
echo -n "Sending SMS..."
curl -o /tmp/send_sms_result 
 -d username=${MESSENTE_API_USERNAME} 
 -d password=${MESSENTE_API_PASSWORD} 
 --data-urlencode "to=$1" 
 --data-urlencode "text=$2"
API_RESULT=$( cat /tmp/send_sms_result | sed 's/( )(.*)/1/' )
API_RESULT_FULL=$( cat /tmp/send_sms_result )
if [ $API_RESULT == "OK" ]; then
 echo " done" 
 exit 0
 echo " failed (${API_RESULT_FULL})"
 exit 1

4) Try out your new SMS sending function

You could make this file executable, or just call it directly:

$ bash 4463773683 "This is a sample text message"

And you are done! Now you can easily use this script to send out SMS messages.

The SMS text mode from command line is the perfect way to send important messages from this script. It can be used by applications, service providers, and other entities that need to communicate with the end-user.


First, make sure you edited the script to include your personal API username and password.

Secondly, check the error code from Messente API documentation.

Still having troubles? Contact us and we will help you with it.