VivialConnect Client for Java
VivialConnect is a simple SMS/MMS API. It's designed specifically for developers seeking a simple, affordable and scalable messaging solution.
Get your API key here: https://www.vivialconnect.net/register
Be sure to read the API documentation: https://docs.vivialconnect.net
Requirements
Maven Installation
Include the following dependency into your pom.xml:
<dependency>
<groupId>vivialconnect</groupId>
<artifactId>vivialconnect-java</artifactId>
<version>0.1.6</version>
</dependency>
Manual Installation
You can clone the VivialConnect Java client repository into your project:
git clone https://github.com/VivialConnect/vivialconnect-java
Examples
Initialize Client: Needed before attempting to use any resource.
VivialConnectClient.init(123456, my-api-key, my-api-secret);
(optional) Set Proxy: If you need to setup a proxy:
Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 9000));
VivialConnectClient.setProxy(proxy);
Search for and buying a number:
List<AvailableNumber> availableNumbers = Number.findAvailableNumbersByAreaCode("302");
AvailableNumber availableNumber = availableNumbers.get(0);
AssociatedNumber associatedNumber = availableNumber.buy();
Send a text message:
Message message = new Message();
message.setFromNumber("+19132597591");
message.setToNumber("+11234567890");
message.setBody("Hello, from Vivial Connect!");
message.send();
Retrieve a list of all messages sent:
Message.getMessages();
Get a specific message by ID:
Message message = Message.getMessageById(86962);
Query Parameters
qParams are managed by this library using a Map<String, String>
. Every resource that supports query parameters will have an overload method that takes a Map.
Retrieve a list of the 5 most recent messages:
Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put("order", "sent desc");
queryParams.put("limit", "5");
List<Message> messages = Message.getMessages(queryParams);
Retrieve a 2 available numbers from US area code 302:
Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put("limit", "2");
List<AvailableNumber> availableNumbers = Number.findAvailableNumbersByAreaCode("302", queryParams);