Developer Documentation for Client Integration
Ncanto Interaction Logger is a microservice designed to capture, normalize, and forward user interaction events to Ncanto's personalization and recommendation API. This documentation will help you understand how to integrate your client applications with the Interaction Logger.
The Ncanto Interaction Logger follows a clean architecture with the following components:
Clients (Web, iOS, Android)
│
▼
API Gateway (Nginx)
│
▼
Flask API (POST /interact or /interact/batch)
│
▼
Redis Queue (async)
│
▼
Celery Worker → Ncanto API (POST /interactions)
/api/v1/logs
Ingests multiple interaction events in a single request.
A JSON array of interaction objects.
{
"status": "success",
"message": "Batch received and saved for processing",
"count": 5,
"skipped": 0
}
202 Accepted - Batch accepted for processing400 Bad Request - Invalid JSON or validation error500 Internal Server Error - Server error/health
Checks the health of the application.
{
"status": "ok",
"uptime": 3600,
"redis": true,
"database": true,
"pending_interactions": 0,
"version": "1.0.0",
"documentation": "/docs"
}
200 OK - Service is healthy500 Internal Server Error - Service is degradedratingEquivalent score.| Action | Type | Rating | Notes |
|---|---|---|---|
| View recommendation | recommendationImpression |
0.0 | Fired when content appears on screen |
| Click asset | select |
0.25 | User shows interest |
| Start playback | play |
0.25 | Initial intent to consume |
| Watch >80% | play_complete |
0.5 | Strong engagement |
| Like/thumbs up | rate |
1.0 | Explicit preference |
| Dislike/thumbs down | rate |
-1.0 | Explicit negative reaction |
| Add to watchlist/favorites | select |
1.0 | Explicit intent |
| Remove from watchlist | deselect |
-1.0 | Explicit dislike |
| Share | share |
0.75 | High intent |
| Action | Type | Rating | Notes |
|---|---|---|---|
| View product | recommendationImpression |
0.0 | Recommendation impression |
| Click product | select |
0.25 | Initial interest |
| Add to cart | add_to_cart |
0.5 | Clear purchase intent |
| Purchase product | purchase |
0.75 | Highest intent interaction |
| Add to wishlist | select |
1.0 | Treated like a like |
| Remove from wishlist | deselect |
-1.0 | Treated like a dislike |
| Leave 4–5 star review | rate |
1.0 | Explicit rating |
| Leave 1–2 star review | rate |
-1.0 | Explicit negative feedback |
| Share product | share |
0.75 | Strong engagement |
All interactions are mapped to a standardized rating scale from -1.0 to 1.0. This allows the recommendation engine to understand the relative strength of user preferences.
| Intent Level | ratingEquivalent | Description |
|---|---|---|
| Explicit Like | 1.0 | Like, favorite, save |
| High Positive | 0.75 | Purchase, share |
| Medium Positive | 0.5 | Watched >80%, add to cart |
| Low Positive | 0.25 | Play, click |
| Neutral / View | 0.1 | View, impression |
| Explicit Dislike | -1.0 | Dislike, remove from wishlist |
All interactions must follow this standardized JSON format:
{
"timestamp": "2025-07-09T09:45:00Z",
"subscriber": "product_user_12345",
"assetId": "product_asset_67890",
"interaction": "interaction_type",
"ratingEquivalent": 0.25,
"comment": "Optional: debug message",
"contextId": "Optional: Ncanto context",
"setting": {
"device": "web" // Values: 'web', 'android_app', 'ios_app'
}
}
| Field | Type | Required | Description |
|---|---|---|---|
timestamp |
String | Yes | ISO 8601 formatted date-time (UTC) |
subscriber |
String | Yes | Unique identifier for the user |
assetId |
String | Yes | Unique identifier for the content or product |
interaction |
String | Yes | Type of interaction (see tables above) |
ratingEquivalent |
Number | Yes | Rating value between -1.0 and 1.0 |
comment |
String | No | Optional debug message or additional context |
contextId |
String | No | Optional Ncanto context identifier |
setting |
Object | Yes | Contains device information |
setting.device |
String | Yes | Device type: 'web', 'android_app', or 'ios_app' |
{
"timestamp": "2025-07-09T10:15:00Z",
"subscriber": "viusasa_user_12345",
"assetId": "viusasa_episode_67890",
"interaction": "play_complete",
"ratingEquivalent": 0.5,
"comment": "User watched 90% of the episode.",
"contextId": "viusasa_player_context",
"setting": {
"device": "android_app"
}
}
{
"timestamp": "2025-07-09T11:05:20Z",
"subscriber": "duka_user_54321",
"assetId": "duka_product_abcde",
"interaction": "add_to_cart",
"ratingEquivalent": 0.5,
"comment": "User added product to cart from product detail page.",
"contextId": "duka_pdp_context",
"setting": {
"device": "web"
}
}
[
{
"timestamp": "2025-07-09T09:30:00Z",
"subscriber": "citizen_user_12345",
"assetId": "citizen_article_67890",
"interaction": "select",
"ratingEquivalent": 0.25,
"setting": {
"device": "web"
}
},
{
"timestamp": "2025-07-09T09:31:00Z",
"subscriber": "citizen_user_12345",
"assetId": "citizen_article_67890",
"interaction": "share",
"ratingEquivalent": 0.75,
"setting": {
"device": "web"
}
}
]