Skip to content

feat: add personalization API (run/runAll) to Android SDK#3

Merged
vmarchaud merged 2 commits into
mainfrom
devin/1781269267-add-personalization-api
Jun 12, 2026
Merged

feat: add personalization API (run/runAll) to Android SDK#3
vmarchaud merged 2 commits into
mainfrom
devin/1781269267-add-personalization-api

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Adds run() and runAll() to the existing ReelevantSDK class so the same SDK instance handles both analytics tracking and personalization — with shared identity.

Key design: Identity auto-resolves from setUser() → stored tmpId → fallback, so callers don't pass userId manually (but can override via RunOptions.userId).

New API surface

// Constructor gains optional personalization config (backward compatible)
ReelevantSDK(context, companyId, datasourceId,
    runnerUrl = "https://reelevant.run",    // default
    personalizationTimeout = 5000L,          // default
    fallback = FallbackStrategy.Empty        // default
)

suspend fun run(options: RunOptions): RunResult
suspend fun runAll(optionsList: List<RunOptions>): List<RunResult>

RunResult.body is a sealed class RunContent with variants Json(JSONObject), Html(String), Image(ByteArray), Empty.

Files

  • New: personalization.kt — types (RunOptions, RunResult, RunContent, FallbackStrategy, error classes) + internal runner HTTP logic (executeRunnerCall, fireAndForgetClick)
  • Modified: sdk.kt — added run()/runAll()/resolveUserId()/handleRunError() methods + new constructor params with defaults
  • Updated: README.md — full personalization docs with usage examples

Link to Devin session: https://app.devin.ai/sessions/cb78c8f2e2ba4d348b6f9a8c274c69bb
Requested by: @vmarchaud

Add run() and runAll() methods to ReelevantSDK for fetching personalised
content from the Reelevant runner. Identity is auto-resolved from stored
userId/tmpId. Includes typed RunResult with discriminated RunContent body,
click tracking, and configurable fallback strategies.

New types: RunOptions, RunResult, RunContent (Json/Html/Image/Empty),
FallbackStrategy (Empty/Error/Custom), RunSource, error types.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author
Original prompt from vmarchaud

i want to provide the same DX as the web sdk but for mobile SDKs, check mobile personalization part in the docs to understand better

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Skip rlvt-u key when merging user-supplied params into runner URL
query parameters to prevent silent identity override.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Open in Devin Review

@vmarchaud vmarchaud marked this pull request as ready for review June 12, 2026 13:23
@vmarchaud vmarchaud merged commit 1492354 into main Jun 12, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant