cimplify
API reference

Activity

The activity API records lightweight session signals (product views, searches, cart events) so that the storefront can show relevant recommendations, intent-based incentives, and contextual messages. Every call is scoped to the active session token.

POST /api/v1/activity/events

Submit a batch of activity events. The server records them, recomputes the visitor’s intent, and returns the updated message set.

Body

FieldDescription
eventsArray of typed events. Tags: product_view, category_view, search, cart_add, cart_remove.
website_idOptional analytics website ID.
domainOptional originating domain.

Request

cURL
curl -X POST https://api.cimplify.io/api/v1/activity/events \
  -H "X-Public-Key: pk_test_your_publishable_key" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "shop.example.com",
    "events": [
      {
        "type": "product_view",
        "product_id": "prod_abc123",
        "product_name": "Espresso",
        "category_id": "cat_drinks",
        "price": 4.5,
        "page_path": "/products/espresso"
      },
      {
        "type": "cart_add",
        "product_id": "prod_abc123",
        "quantity": 1
      }
    ]
  }'

Response

{
  "success": true,
  "data": {
    "processed": 2,
    "intent": "considering",
    "messages": [
      {
        "code": "free_delivery_threshold",
        "title": "Add GHS 12 more for free delivery",
        "severity": "info"
      }
    ]
  }
}

GET /api/v1/activity/state

Read the current session activity snapshot, computed intent, active incentive, and the active message set.

cURL
curl https://api.cimplify.io/api/v1/activity/state \
  -H "X-Public-Key: pk_test_your_publishable_key"

Response

{
  "success": true,
  "data": {
    "activity": {
      "viewed_products": [{ "product_id": "prod_abc123", "count": 3 }],
      "viewed_categories": [{ "category_id": "cat_drinks", "count": 1 }],
      "search_count": 0
    },
    "intent": "considering",
    "messages": [
      { "code": "free_delivery_threshold", "title": "Add GHS 12 more for free delivery" }
    ],
    "incentive": { "template_id": "free_ship_v2", "agent_id": null }
  }
}

Anonymous sessions return activity: null, intent: “baseline”, and an empty messages array.

GET /api/v1/activity/recommendations

Personalised product picks based on viewed categories, with optional limit (max 50, default 10).

cURL
curl "https://api.cimplify.io/api/v1/activity/recommendations?limit=12" \
  -H "X-Public-Key: pk_test_your_publishable_key"

Response

{
  "success": true,
  "data": {
    "recommendations": [
      { "product": { "id": "prod_xyz", "name": "Latte" }, "reason": "from_category:cat_drinks" }
    ],
    "intent": "considering",
    "incentive": null
  }
}

POST /api/v1/activity/messages/dismiss

Suppress a specific message for the rest of the session. The body uses code, the identifier returned in the messages array. There is no message_id field.

Request

cURL
curl -X POST https://api.cimplify.io/api/v1/activity/messages/dismiss \
  -H "X-Public-Key: pk_test_your_publishable_key" \
  -H "Content-Type: application/json" \
  -d '{"code": "free_delivery_threshold"}'

Response

{
  "success": true,
  "data": {
    "dismissed": "free_delivery_threshold",
    "messages": []
  }
}
  • Cart Cart writes already emit cart-add / cart-remove events automatically.

  • Products Source of recommended products.

On this page