Skip to content

Latest commit

 

History

History
93 lines (67 loc) · 2.9 KB

README.md

File metadata and controls

93 lines (67 loc) · 2.9 KB

Whispir Java Library

Maven Central Build Status

The Whispir Java library provides convenient access to the Whispir API from applications written in Java.

Documentation

You can find the complete documentation of the Whispir API at developers.whispir.com.

Installation

Requirements

  • Java 1.8 or later

Gradle users

Add this dependency to your project's build file:

implementation "com.whispir:whispir-java:1.1.2"

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.whispir</groupId>
  <artifactId>whispir-java</artifactId>
  <version>1.1.2</version>
</dependency>

Others

You'll need to manually install the following JARs:

Usage

The package needs to be configured with your account's username/password combination and API Key, which can be obtained by following the Obtain an API Key instructions.

WhispirExample.java

import java.util.HashMap;
import java.util.Map;

import com.whispir.Whispir;
import com.whispir.exception.WhispirException;
import com.whispir.model.Message;
import com.whispir.api.RequestOptions;
import com.whispir.param.MessageCreateParams;

public class WhispirExample {

    public static void main(String[] args) {
        Whispir.username = "username...";
        Whispir.password = "password...";
        Whispir.apiKey = "apiKey...";

        MessageCreateParams params =
            MessageCreateParams
                .builder()
                .setTo("61400400400")
                .setSubject("My first message")
                .setBody("Hello from Whispir Java SDK!")
                .build();

        try {
            Message message = Message.create(params);
            System.out.println(message);
        } catch (WhispirException e) {
            e.printStackTrace();
        }
    }
}

Examples

Visit the examples folder for a curated list of examples to help you get started quickly with Whispir.