This release brings the SDK in line with the current Knock OpenAPI spec and with the Node SDK. Most changes are additive. The breaking changes are listed below.
These methods used to return a String (always empty). They now return nothing, CompletableFuture<Void?> for the async client, and their raw-response variants return HttpResponse instead of HttpResponseFor<String>:
users().delete,objects().delete,tenants().deleteusers().unsetChannelData,objects().unsetChannelDataaudiences().addMembers,audiences().removeMembersworkflows().cancel
// Before
String result = client.users().delete("user_1");
// After
client.users().delete("user_1");The API returns message, event, and delivery log lists under items. The old entries() accessor always returned an empty list. The page accessor is now items() on:
MessageListPage,UserListMessagesPage,ObjectListMessagesPageMessageListEventsPage,MessageListDeliveryLogsPage
The same applies to the async page classes and to the *PageResponse classes (items() / _items()). autoPager() works unchanged.
// Before
List<Message> messages = client.messages().list().entries();
// After
List<Message> messages = client.messages().list().items();users().guides().markMessageAsSeen, markMessageAsInteracted, and markMessageAsArchived now call PUT /v1/users/{user_id}/guides/messages/{action} and no longer take a messageId. The guide, step, and channel are identified in the request body instead:
// Before
client.users().guides().markMessageAsSeen("user_1", "message_1", params);
// After
client.users().guides().markMessageAsSeen(
"user_1",
GuideMarkMessageAsSeenParams.builder()
.channelId("channel_1")
.guideId("guide_1")
.guideKey("onboarding")
.guideStepRef("step_1")
.content(GuideMarkMessageAsSeenParams.Content.builder().build())
.build());- The three
GuideMarkMessageAs*Responseclasses are replaced by a singleGuideActionResponse. GuideGetChannelResponsematches the API's current shape:entries(),guideGroups(),guideGroupDisplayLogs(), andineligibleGuides()replaceguides()andrecipient().
messages().activities().list(...) duplicated messages().listActivities(...), which calls the same endpoint. Use listActivities:
// Before
client.messages().activities().list(ActivityListParams.builder().messageId("message_1").build());
// After
client.messages().listActivities("message_1");UserListSubscriptionsParams.objects, ObjectListSubscriptionsParams.recipients, and ScheduleListParams.recipients are now List<RecipientReference> instead of List<String>, so that object recipients can be filtered on. The addObject(String) and addRecipient(String) overloads still accept user IDs:
ScheduleListParams.builder()
.workflow("digest")
.addRecipient("user_1")
.addRecipient(RecipientReference.ObjectReference.builder().collection("projects").id("p1").build())
.build();Object references are now sent in the indexed form (recipients[0][collection]=...) that the API expects.
Each item in objects().bulk().addSubscriptions now requires the object id, as the API does:
BulkAddSubscriptionsParams.Subscription.builder()
.id("project_1")
.addRecipient("user_1")
.build();ScheduleCreateParams.repeats() returns Optional<List<ScheduleRepeatRule>>, because a schedule can be created with only scheduled_at.
The SDK still supports Java 8, but its dependencies have moved to their current major versions:
- OkHttp 5.
knock-java-client-okhttp(and soknock-java) now depends on OkHttp 5.5.0, via thecom.squareup.okhttp3:okhttp-jvmartifact. OkHttp 5 is binary compatible with OkHttp 4 for most uses. If your build pinscom.squareup.okhttp3:okhttpto 4.x, remove the pin or move it to 5.x. In Maven, depend onokhttp-jvmrather thanokhttp, because theokhttpartifact is empty in OkHttp 5. - Kotlin. The SDK is compiled with language and API version 2.2 and depends on
kotlin-stdlib2.2 or later (OkHttp 5 already requireskotlin-stdlib2.x). Java projects aren't affected beyond the newer transitivekotlin-stdlib. Kotlin projects need the Kotlin 2.1 compiler or later. - Jackson. The default Jackson version is 2.22.3. The minimum supported version is still 2.13.4.
- Apache HttpClient. The transitive
httpclient5andhttpcore5versions are 5.6.4 and 5.4.4.
workflowRecipientRuns()withlistandgetusers().preferenceCenter()withgetConfigandgenerateSignedUrlusers().unsetPreferencesandobjects().unsetPreferencesobjects().bulk().deleteSubscriptionsusers().guides().resetGuideEngagementsandunarchiveGuideMessageapp.knock.api.lib.UserTokensfor signing user tokens (see the README)- New request fields: workflow trigger
settings(sandbox_mode,skip_delay), scheduleactor, tenantname,resolve_full_preference_settingson tenants,create_audienceon audience members, feedlocale/exclude/mode/inserted_at, and inline useravatar/locale/phone_number - New response fields: message
sourcerun identifiers and connectionknock_tenant_id