Add Activity API

This API allows the user to send event to the CEE panel from external sources i.e. offline activity data

Details

URL Schema:
US IDC:
https://api2.netcoresmartech.com/v1/activity/upload

Indian IDC:
https://apiin2.netcoresmartech.com/v1/activity/upload

Method:
POST

Authorization:
Bearer API_KEY

Header:

KeyValue
Content-Typeapplication/json

Parameters:

ParameterDescriptionData TypeRequired
activity_nameThis is name of the activityStringYes
asset_idPass website_id or app_id for which the activity is mappedStringYes
timestampThis is the timestamp of the event occurred.

We currently support the UTC and ISO-8601 time zones.

UTC Example
Expected Value format: 2021-12-29T12:06:28Z

In UTC timezone, pass the timestamp. The timestamp will be displayed in the UI based on the timezone set on the panel.

ISO-8601 Example

In case, you would want to pass timestamp in local timezone, then refer to the below example for IST.
Expected Value Format: 2021-12-29T06:12:28+05:30
Date-TimeYes
annonidThis is the unique ID of the contact. This is mandatory if identity is not passed.

This will be used in case of anon user.
StringNo
identityThis is the identifying information of the contact. It can be email/mobile/customer-id of the logged-in contact. This is the same as the primary key in your CEE Panel. Passing this parameter is mandatory for identified contacts.String/IntegerYes
activity_sourceThis is a source of activityString

Depending on the asset that you are using whether it is website or app, please use the source as either "web" or "app"

For Website - use "web"

For App - use "app"
No
activity_paramsThis is activity payload data.ObjectYes

📘

Product Array

Multiple products can be passed in API call in array format, which can be seen in the JSON example below.

However please note if you are passing the data in the format of an array and if it is blank, the system will not insert such events in the CEE.
Do Not Pass an Empty Array

Sample JSON:

{
    "asset_id": "sdbsjdh623jhmsndbkfs",
    "activity_name":Purchase,
    "timestamp":2020-04-28T16:47:37Z,
    "identity":CUSTOMER_ID,
    "activity_source":"CRM",
    "activity_params": {
        "customer_user_id": "xxxxxx",
        "total_item_qty": "2",
        "currency": "INR",
        "product": [
            {
                "mrp": "250.0",
                "l2_category": "Moisturizers",
                "l3_category": "Serums & Essence",
                "l1_category": "Skin",
                "price": "250.0",
                "quantity": "1",
                "product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
            },
            {
            "l1_category": "Makeup",
            "quantity": "1",
            "mrp": "620.0",
            "product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
            "price": "496.0"
            }
        ]
}

Response: Success

{
    "status": "success",
    "success_count": "<count>",
    "failed_count": "[
        {"status":"fail", "code":<error code>, "error":<error msg>, "record":<record>},
        {"status":"fail", "code":<error code>, "error":<error msg>, "record":<record>},"
    ]        
}

API Error Codes:

Error CodeError
400Bad Request | Missing Parameter - Activity Name
401Unauthorized | Invalid API Key
405Method Not Allowed
408Request Time Out
500Internal Server Error

🚧

Please Remember

If timestamp passed for event passed by the activity API is more than 24hrs old, it wont trigger a journey. It will be stored in the event data.

Using this API for bulk activity upload

The Same API described above can be used to upload activities in bulk(Max:1000) at a time.

Sample JSON:

[
  {
      "asset_id": "sdbsjdh623jhmsndbkfs",
        "activity_name":"Purchase",
      "timestamp":"2020-04-28T16:47:37Z",
      "identity":"CUSTOMER_ID",
      "activity_source":"CRM",
      "activity_params": {
          "customer_user_id": "xxxxxx",
          "total_item_qty": "2",
          "currency": "INR",
          "product": [
              {
                  "mrp": "250.0",
                  "l2_category": "Moisturizers",
                  "l3_category": "Serums & Essence",
                  "l1_category": "Skin",
                  "price": "250.0",
                  "quantity": "1",
                  "product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
              },
              {
              "l1_category": "Makeup",
              "quantity": "1",
              "mrp": "620.0",
              "product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
              "price": "496.0"
              }
          ]
  },
  {
      "activity_name":"Checkout",
      "timestamp":"2020-04-28T16:40:37Z",
      "identity":"CUSTOMER_ID",
      "activity_source":"CRM",
      "activity_params": {
          "customer_user_id": "xxxxxx",
          "total_item_qty": "2",
          "currency": "INR",
          "product": [
              {
                  "mrp": "250.0",
                  "l2_category": "Moisturizers",
                  "l3_category": "Serums & Essence",
                  "l1_category": "Skin",
                  "price": "250.0",
                  "quantity": "1",
                  "product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
              },
              {
              "l1_category": "Makeup",
              "quantity": "1",
              "mrp": "620.0",
              "product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
              "price": "496.0"
              }
          ]
  },
  {
      "activity_name":"Add To Cart",
      "timestamp":"2020-04-25T10:20:37Z",
      "identity":"CUSTOMER_ID",
      "activity_source":"CRM",
      "activity_params": {
          "customer_user_id": "xxxxxx",
          "total_item_qty": "2",
          "currency": "INR",
          "product": [
              {
                  "mrp": "250.0",
                  "l2_category": "Moisturizers",
                  "l3_category": "Serums & Essence",
                  "l1_category": "Skin",
                  "price": "250.0",
                  "quantity": "1",
                  "product_name": "L'Oreal Paris Revitalift Crystal Micro-Essence"
              },
              {
              "l1_category": "Makeup",
              "quantity": "1",
              "mrp": "620.0",
              "product_name": "Maybelline New York Instant Age Rewind Eraser Dark Circles Treatment Concealer - 150 Neutralizer",
              "price": "496.0"
              }
          ]
  }
]

The response and error codes are the same as defined above.