SDK - Getting started

In this tutorial, you'll create and configure your first Conversation API app from the Sinch Conversation SDK.

Things you'll need

  • Channels that are set up and registered to be included in the Conversation API.
  • Service plan ID/Service ID/Sender Identity set up at corresponding channel portals.
  • Access keys and Project ID which can be found in the Sinch dashboard.
  • Setting up the keys as variables like the following:
  • Getting the following dependencies on the the project.
    implementation "com.sinch.sdk:java-sdk:${sdkVersion}"


For every operation you'll need the App object:

private static com.sinch.sdk.api.conversationapi.service.Apps apps;
apps = Sinch.conversationApi(Region.EU).apps();

Step One: Creating a new App

To create an App you'll need the following snippet: (This guide will use the Messenger channel and RCS)

At this point you'll need your messenger token:

new StaticTokenCredential().token("__messenger_token__");

After that you create a channel credential with the token:

new ConversationChannelCredential().channel(
    .staticToken(new StaticTokenCredential().token("__messenger_token__"));

Aditionally you'll need your bearer credentials for the RCS channel:

new ConversationChannelCredential().channel(
    .staticBearer(new StaticBearerCredential()

With that already on hand, you can create the actual app with a provided name:

    new App()
        .displayName("SDK application name")
            new ConversationChannelCredential()
                .staticToken(new StaticTokenCredential()
            new ConversationChannelCredential()
                    new StaticBearerCredential()

And with that you have created you own app directly from the Conversation SDK.

Step Two: Listing your Apps

If you're in need to list all your available apps you'll just need to execute the following call:


Preferably stored in a List<App> object.

Likewise if you need a specific App to display information off it you'll use the next function:


Step Three: Updating or Deleting an App

If you've put the wrong name for the App you don't have to create a new one with the correct one, instead you can update the name directly from the SDK (like from the Dashboard).

First you'll need the App ID (you can get it at step two) once you have it, you'll just have to call the function:

apps.update(APP_ID, new App().displayName("Updated SDK application name"));

And if you would just like to delete the App for other reasons you'll also need the App ID and call the correct function:



For every operation you'll need the Messages object:

private com.sinch.sdk.api.conversationapi.service.Messages messages,
messages = Sinch.conversationApi(Region.EU).messages(AppsExamples.APP_ID);

Step One: Send Message

In this example we'll send a message with options called a Carousel Message

First we'll start by creating our main message:

new MediaMessage().url("");

In this example we are using an image as the message.

Then create the desired choices:

new Choice().textMessage(new TextMessage().text("Suggested Reply 1 Text")));

In here you can set your options (for simplicity we'll user numbered placeholders).

After you have your choices created we create the CardMessage object with options:

Choice c1 = new Choice()
    .textMessage(new TextMessage().text("Suggested Reply 1 Text"));

Choice c2 = new Choice()
    .textMessage(new TextMessage().text("Suggested Reply 2 Text"));

Choice c3 = new Choice()
    .textMessage(new TextMessage().text("Suggested Reply 3 Text"));

MediaMessage mm = new MediaMessage()
    .url("" +

new CardMessage()
    .title("This is the card 1 title")
    .description("This is the card 1 description")

Now this will be the whole snippet for sending the message with the Messages object:

CardMessage cm1 = new CardMessage()
    .title("This is the card 1 title")
    .description("This is the card 1 description")
    .mediaMessage(new MediaMessage()
        .url("" +
    .addChoicesItem(new Choice().urlMessage(
        new UrlMessage().title("URL Choice Message:")

CardMessage cm2 = new CardMessage()
    .title("This is the card 2 title")
    .description("This is the card 2 description")
    .mediaMessage(new MediaMessage()
        .url("" +
    .addChoicesItem(new Choice().callMessage(
        new CallMessage().title("Call Choice Message:").phoneNumber("46732000000")));

CardMessage cm3 = new CardMessage()
    .title("This is the card 3 title")
    .description("This is the card 3 description")
    .mediaMessage(new MediaMessage()
        .url("" +
    .addChoicesItem(new Choice().locationMessage(
        new LocationMessage()
            .title("Location Choice Message")
            .label("Enriching Engagement")
                new Coordinates().latitude(55.610479f).longitude(13.002873f))));

messages.send(new SendMessageRequest()
    .message(new AppMessage().carouselMessage(
        new CarouselMessage().addCardsItem(cm1).addCardsItem(cm2).addCardsItem(cm3)))

And you can also add several different options (not neccessarily all of them in a given message).

An example of a single message would be like this:

CardMessageRequest cmr = new CardMessageRequest("This is the card 1 title")
    .description("This is the card 1 description")
    .media("" +
    .addTextChoice("Suggested Reply 1 Text")
    .addTextChoice("Suggested Reply 2 Text")
    .addTextChoice("Suggested Reply 3 Text")

CardMessage cm1 = cardMessage("This is the card 2 title")
    .description("This is the card 2 description")
            "" +
        choice(urlMessage("URL Choice Message:", "")));

CardMessage cm2 = cardMessage("This is the card 3 title")
    .description("This is the card 3 description")
            "" +
    .addChoicesItem(choice(callMessage("Call Choice Message:", "46732000000")))

CardMessage cm3 = cardMessage("This is the card 4 title")
    .description("This is the card 4 description")
            "" +
            locationMessage("Location Choice Message", 13.002873f, 55.610479f)
                .label("Enriching Engagement")))

    new CarouselMessageRequest()

In this example we use a Carousel style for the message.

Step Two: List Messages

For listing messages you'll need the ContactID to filter:

final ListMessagesResponse response = messages.list(
    new ListMessagesParams().contactId(ContactsExamples.CONTACT_ID));

To get a single message you'll need the MessageID and call the function:


You can also delete the message as follows:



For every operation you'll need the Webhooks object.

private com.sinch.sdk.api.conversationapi.service.Webhooks webhooks;
webhooks = Sinch.conversationApi(Region.EU).webhooks();

Step One: Creating Webhooks

For simplicity this is the basic example with the most used Triggers:

    new Webhook()

In here you can see that we require the AppID (you can see how to create Apps or list existing Apps on the App guide).

Step Two: Listing Webhooks

You can list webhooks that are part of an specific App:


Preferably stored on a List<Webhook> object.

If you only need to get a single Webhook you can get it by using the Webhook ID:


Step Three: Updating and Removing Webhooks

If it's needed you can update with the following function:

webhooks.update(WEBHOOK_ID, new Webhook().targetType(WebhookTargetType.GRPC));

In this example we change the target type for the webhook.

If you need to remove the webhook as a whole use this (note that you'll need the Webhook ID):


More Examples

If you need more examples you can follow this link to the GitHub Repo.