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:
Key | Value |
---|---|
Content-Type | application/json |
Parameters:
Parameter | Description | Data Type | Required |
---|---|---|---|
activity_name | This is name of the activity | String | Yes |
asset_id | Pass website_id or app_id for which the activity is mapped | String | Yes |
timestamp | This 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-Time | Yes |
annonid | This is the unique ID of the contact. This is mandatory if identity is not passed. This will be used in case of anon user. | String | No |
identity | This 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/Integer | Yes |
activity_source | This is a source of activity | String The value should be either (“web”or “app” or any other system, needs to be passed in double quotes) | No |
activity_params | This is activity payload data. | Object | Yes |
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 Code | Error |
---|---|
400 | Bad Request | Missing Parameter - Activity Name |
401 | Unauthorized | Invalid API Key |
405 | Method Not Allowed |
408 | Request Time Out |
500 | Internal 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.
Updated almost 4 years ago