ThanklyLifecycle

class ThanklyLifecycle(config: ThanklyConfig, engine: HttpEngine = OkHttpEngine())

Lifecycle marketing: signals in, engagement decisions out, outcomes back.

A server-side surface. Every call authenticates with the org credential on X-Authorization, and the customer data it carries makes it unsuitable for an untrusted client regardless.

Constructors

Link copied to clipboard
constructor(config: ThanklyConfig, engine: HttpEngine = OkHttpEngine())

Functions

Link copied to clipboard
suspend fun awaitDecision(externalCustomerId: String, playbookId: String, journeyDay: Int? = null, postalCode: String? = null, overrides: JsonObject? = null): EngagementDecision

Run a playbook and wait for the decision and its enrichment.

Link copied to clipboard
suspend fun brandConfig(): JsonObject

Read the active brand configuration.

Link copied to clipboard
suspend fun brandConfigVersions(): JsonObject

List every version of the brand configuration.

Link copied to clipboard
suspend fun customerProfile(externalCustomerId: String): JsonObject

Read a customer's derived profile.

Link copied to clipboard
suspend fun deletePlaybook(playbookId: String)

Delete a playbook.

Link copied to clipboard
suspend fun engage(externalCustomerId: String, playbookId: String, journeyDay: Int? = null, postalCode: String? = null, overrides: JsonObject? = null, callbackUrl: String? = null, callbackSecret: String? = null): EngagementDecision

Run a playbook for a customer.

Link copied to clipboard
suspend fun getDecision(decisionId: String): EngagementDecision

Poll one decision's scoped widget set.

Link copied to clipboard

Ingest behavioural events.

Link copied to clipboard
suspend fun playbook(playbookId: String): JsonObject

Read a playbook.

Link copied to clipboard
suspend fun playbooks(): JsonObject

List the org's playbooks.

Link copied to clipboard
suspend fun reportOutcome(decisionId: String, channel: String? = null, sent: Boolean? = null, delivered: Boolean? = null, opened: Boolean? = null, clicked: Boolean? = null, converted: Boolean? = null, revenue: Double? = null, conversionEvent: String? = null): JsonObject

Report a delivery outcome. Stages latch monotonically and replays are no-ops.

Link copied to clipboard
suspend fun rollbackBrandConfig(version: Int): JsonObject

Roll the brand configuration back to an earlier version.

Link copied to clipboard
suspend fun setBrandConfig(config: Map<String, String>, expectedVersion: Int? = null): JsonObject

Replace the org's brand configuration.

Link copied to clipboard
suspend fun upsertPlaybook(playbookId: String, playbook: JsonObject): JsonObject

Create or replace a playbook.