An open API service indexing awesome lists of open source software.

https://github.com/trycourier/courier-java

Java SDK for communicating with the Courier REST API.
https://github.com/trycourier/courier-java

Last synced: 4 months ago
JSON representation

Java SDK for communicating with the Courier REST API.

Awesome Lists containing this project

README

          

# Courier Java SDK

The Courier Java SDK provides typed access to the Courier REST API from applications written in Java 8+. It uses builder-pattern request construction, OkHttp for transport, and returns strongly typed response objects.

## Installation

### Gradle

```kotlin
implementation("com.courier:courier-java:LATEST_VERSION")
```

### Maven

```xml

com.courier
courier-java
LATEST_VERSION

```

Find the latest version on [Maven Central](https://central.sonatype.com/artifact/com.courier/courier-java).

## Quick Start

```java
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.core.JsonValue;
import com.courier.models.UserRecipient;
import com.courier.models.send.SendMessageParams;

CourierClient client = CourierOkHttpClient.fromEnv();

SendMessageParams params = SendMessageParams.builder()
.message(SendMessageParams.Message.builder()
.to(UserRecipient.builder().userId("your_user_id").build())
.template("your_template_id")
.data(SendMessageParams.Message.Data.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build())
.build())
.build();

var response = client.send().message(params);
System.out.println(response.requestId());
```

The client reads `COURIER_API_KEY` from your environment (or `courier.apiKey` system property) automatically.

## Documentation

Full documentation: **[courier.com/docs/sdk-libraries/java](https://www.courier.com/docs/sdk-libraries/java/)**

- [Quickstart](https://www.courier.com/docs/getting-started/quickstart/)
- [Send API](https://www.courier.com/docs/platform/sending/send-message/)
- [API Reference](https://www.courier.com/docs/reference/get-started/)
- [Javadocs](https://javadoc.io/doc/com.courier/courier-java/)