You're ready for this Quickstart if you've got the following:
To help you get started we've put together a library of sample applications. For this Quickstart, clone the repository for Java Receive Message Tutorial using Github's interface or git in the command line.
git clone https://github.com/FreeClimbAPI/Java-Receive-Message-Tutorial.git
You can access the full sample app library through your Dashboard or the FreeClimbAPI Github repositories.
Now that you've cloned the repo for your sample app, the next step is to configure your environment variables with
From numbers, and your API credentials.
You can copy your API credentials from your Dashboard homepage.
Set these all as environment variables according to your operating system.
ACCOUNT_ID="YOUR-ACCOUNT-TOKEN" API_KEY="YOUR-API-KEY" TO_PHONE_NUMBER="+15555555555" FREECLIMB_PHONE_NUMBER="+15555550010"
The fastest way to start testing your FreeClimb application is to temporarily make your local server publicly accessible through a tunneling service. We'll use Ngrok to do this. Start by downloading Ngrok. Unzip the file to install, then open your terminal and navigate to the directory where you've unzipped Ngrok. Use the following command to start a HTTP tunnel on port 3000.
./ngrok http 3000
Once you run Ngrok you should receive a response with a public URL, that looks something like this:
ngrok by @inconshreveable Tunnel Status online Version 2.0/2.0 Web Interface http://127.0.0.1:4040 Forwarding http://92832de0.ngrok.io -> localhost:3000 Forwarding https://92832de0.ngrok.io -> localhost:3000 Connnections ttl opn rt1 rt5 p50 p90 0 0 0.00 0.00 0.00 0.00
The Forwarding URLs point to your local server. Save the URLs and go on to the next step.
Now that you've got a public URL you're ready to configure your application's endpoints. We'll be configuring the smsUrl using your Ngrok URL and the route reference
Open its App Config, and you'll see its application ID, alias, and some options for URL configuration. Enter your Ngrok URL into the smsUrl field, and add the route
/InboundSms at the end of the URL.
When you're done the App Config should look something like this:
Save your updated App Config.
Once you've updated your App Config you're all ready to run your app! Run the application with the command:
gradle build && java -Dserver.port=3000 -jar build/libs/gs-spring-boot-0.1.0.jar
Congratulations! You've just made your first messaging application!
For a more detailed explanation of the code used, see How to Reply to an Incoming Message.
Updated 2 months ago