Skip to content

sinch/sinch-sdk-java

Repository files navigation

Sinch Java SDK

Here you'll find documentation related to the Sinch Java SDK, including how to install it, initialize it, and start developing code using Sinch services.

To use Sinch services, you'll need a Sinch account and access keys. You can sign up for an account and create access keys at dashboard.sinch.com.

For more information on the Sinch APIs on which this SDK is based, refer to the official developer documentation portal.

Prerequisites

Installation

Add to your pom.xml file the dependency to SDK:

<dependencies>
    <dependency>
      <groupId>com.sinch.sdk</groupId>
      <artifactId>sinch-sdk-java</artifactId>
      <version>${sdk.version}</version>
    </dependency>
    ...
</dependencies>

Note the ${sdk.version} need to be set according to released version to be used (see available versions from Maven Repository)

Getting started

Once the SDK is installed, you must start by initializing the main client class.

Client initialization

To initialize communication with the Sinch servers, credentials obtained from the Sinch dashboard must be provided to the main client class of this SDK. It's highly recommended to not hardcode these credentials and to load them from environment variables instead.

Sample:

import com.sinch.sdk.SinchClient;
import com.sinch.sdk.models.Configuration;

...
Configuration configuration = Configuration.builder().setKeyId(PARAM_KEY_ID)
                                                     .setKeySecret(PARAM_KEY_SECRET)
                                                     .setProjectId(PARAM_PROJECT_ID)
                                                     .build();
...
SinchClient client = new SinchClient(configuration);

Products

Here is the list of the Sinch products and their level of support by the Java SDK:

API Category API Name Status
Conversation Conversation API (javadoc)
Messaging SMS API (javadoc)
Numbers & Connectivity Numbers API (javadoc)
Verification Verification API (javadoc)
Voice and Video Voice API (javadoc)

Logging

The SDK uses the Java 8 logging feature (java.util.logging) Loggers and severity can be configured by using a logging.properties file like (see sample-app/src/main/resources/:

handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = INFO
com.sinch.sdk.level = INFO

java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] [%4$-7s %2$s] %5$s %n

Onboarding

To improve onboarding experience, following resources are available:

License

This project is licensed under the Apache License. See the LICENSE file for the license text.