June 19, 2011 3 Comments
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
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.