These docs are for v1.0. Click to read the latest docs for v2.0.

Add Activity API

This API allows the user to send event to the smartech 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.

The date should be passed with ISO - 8601

If there is no timezone passed then panel timezone will be considered
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 Smartech Panel. Passing this parameter is mandatory for identified contacts.String/IntegerYes
activity_sourceThis is a source of activityString

The value should be either (“web”or “app” or any other system, needs to be passed in double quotes)
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 Smartech.
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.