Tutorial: Using the Zipwhip API in Java

I’m new to the Zipwhip API so I figured I would share my experience sending out my first text message using the Zipwhip system. To follow along with this article you will need to get your hands on the Zipwhip API as a JAR file. It’s available here for download:

Zipwhip API Jar File (170KB) ZipwhipAPI.jar

Release Date: 6/18/2011

First, open up Eclipse and make a new Java project.



Call the project ZipwhipAPIExample. (BTW, you can zoom in on the screenshots by clicking them.)


You can leave the Source tab alone, however you will want to add the ZipwhipAPI Jar to the Libraries tab.


Make sure you download the ZipwhipAPI Jar from the link at the start of this article. Then, add it to the Libraries list by choosing “Add External JARs” and finding the file on your local computer. Make sure to add the Log4J Jar file as well since the ZipwhipAPI is dependant upon it. You will get compile errors if you don’t have Log4J somewhere in the build path.


You should now have a new project in your Package Explorer. You are ready to go.


Make a new Java class file by right-clicking the src folder and choosing “Class”.


Call your class “Example” after you’ve entered a package name of something like “com.yourcompany.zipwhipapi”. Make sure to also create a public static void main() method so you have an entry point for your Java app.


After you hit “Finish” you should see something similar to the following generated code.


Now, we’ll help you out with the code you should place into the Example.java file in order to send off your first text message using the Zipwhip API. Make sure you set your own mobile number and password in the code. If you don’t know what your password is, or you have never signed up for Zipwhip, you need to do it via your carrier website if your carrier supports Zipwhip. Zipwhip has contracts with most major U.S. carriers so please visit your carrier site or call your carrier to find out how to gain access.

Download source code below Example.java

 1: package com.yourcompany.zipwhipapi;
 3: import com.zipwhip.api.DefaultZipwhipClient;
 4: import com.zipwhip.api.HttpConnection;
 5: import com.zipwhip.api.ZipwhipClient;
 7: public class Example {
 9:     public static void main(String[] args) {
 11:         HttpConnection connection = new HttpConnection();
 13:         String mobileNumber = "3135551212";
 14:         String password = "mypassword";
 16:         try {
 17:             connection.requestLogin(mobileNumber, password);
 18:             ZipwhipClient zipwhipClient = new DefaultZipwhipClient(connection);


 21:             zipwhipClient.sendMessage("3134440002", "This is our first test SMS message.");
 23:             System.out.println("Done sending message");
 25:         } catch (Exception e) {
 26:             // TODO Auto-generated catch block
 27:             e.printStackTrace();
 28:         }
 29:     }
 30: }

This is what your Eclipse window should look like when all of the code is done and ready to go.


That’s it. Have fun sending off text messages via Zipwhip’s spectacularly simple API. If you want to get fancy, try to use some of the other methods in the API that let you create contacts, create groups, receive messages back, let you setup a URL to be posted to when an SMS comes in, etc.

To learn how to receive text messages via the Zipwhip API you can read my next posting.

3 thoughts

  1. Cool, I have a Sidekick 4G on T-Mobile and it has T-Mobile’s Cloud Text. I see that is powered by Zipwhip so I searched to see if there was an API available so I can do more with my text account on T-Mobile. It looks like I can according to this posting.

  2. admin:Корень проекта это директория, в которую был установлен WP, phpBB или Joomla.Или по другому, корневая директория это та директория, в которой расположен файл:- для WP wp-config.php- для phpBB config.php- для Joomla coroagunitifn.php

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s