LeadSquared Developer Centre

ON THIS PAGE

Post Activities on Leads in Bulk (Using Unique Lead Fields)


Lets you post activities to leads in bulk.

  • Specify the lead you want to post an activity to by passing any unique lead field.*
    • Pass the field name in the “SearchBy” parameter in the API URL.
    • Pass the field value in the “SearchByValue” attribute in the JSON body.
  • Specify the activity you want to post to a lead by passing the “ActivityEvent”. You can find them on the Custom Activities & Scores page, under the ‘Code’ column.
    • The “ActivityNote”, “ActivityOwnerEmail” and “Activity DateTime” parameters are optional.
    • You can also pass custom fields by specifying their “SchemaNames” and “Values” within the “Fields” node.

* Default unique lead fields include “EmailAddress”, “Phone” and “Mobile”. However, you can set your own unique lead fields according to your business requirements. This API accepts all unique lead fields, the defaults and also the ones you set.

Note:

  • The supported DateTime format is UTC (YYYY-MM-DD HH:MM:SS).
  • To skip validating dropdown activity fields, pass an additional parameter "ValidateDropDownOptions" : true. This is helpful if you’re passing drop-down values stored on Mavis DB.

 

API URL

URL
Icon
POST https://{host}/v2/ProspectActivity.svc/Bulk/CustomActivity/Add/ByLeadField?accessKey=AccessKey&secretKey=SecretKey&searchBy=SearchBy

URL Parameters

Parameter Description
SearchBy The name of the unique lead field. E.g., EmailAddress

Request

Content-Type: application/json
JSON Body/Payload Icon
[
    {
        "SearchByValue": "user1@domain.com",
        "ActivityEvent": 320,
        "ActivityNote": "Add/ByEmailAddress",
        "ActivityOwnerEmail": "example@example.com",
        "Fields": [
            {
                "SchemaName": "mx_Custom_1",
                "Value": "First"
            },
            {
                "SchemaName": "mx_Custom_2",
                "Value": "0419"
            },
            {
                "SchemaName": "mx_Custom_3",
                "Value": "Activity Test"
            },
            {
                "SchemaName": "mx_Custom_4",
                "Value": "2016-09-18 12:12:12"
            }
        ]
    },
    {
        "SearchByValue": "user2@domain.com",
        "ActivityEvent": 320,
        "ActivityNote": "Add/EmailAddress",
        "ActivityOwnerEmail": "example2@example.com",
        "Fields": [
            {
                "SchemaName": "mx_Custom_1",
                "Value": "First"
            },
            {
                "SchemaName": "mx_Custom_2",
                "Value": "0419"
            },
            {
                "SchemaName": "mx_Custom_3",
                "Value": "Activity Test"
            },
            {
                "SchemaName": "mx_Custom_4",
                "Value": "2016-09-18 12:12:12"
            }
        ]
    }
]

Request Parameters

Parameter Description
SearchByValue

Value of the “SearchBy” attribute you passed in the API URL. For example, if you passed “EmailAddress” in the API URL, then pass “john@example.com” here.

ActivityEvent

The code of the activity. You can find activity codes in your LeadSquared account settings or by calling this API: Get List of Activity Types

ActivityNote

The description or notes associated with the activity.

ActivityOwnerEmail

Email Id of the LeadSquared user who is the owner of the activity.

Fields

You can optionally pass custom activity fields here by specifying their “SchemaNames” and “Values”. E.g. “SchemaName”: “mx_Custom_1”,
“Value”: “100”

Response

200 OK
Content-Type: application/json
{
    "Response": [
        {
            "ProspectActivityId": "6e2a3c76-9e57-4dd6-8bf1-660960336d6e",
            "RowNumber": 1,
            "ActivityCreated": true
        },
        {
            "ProspectActivityId": "50d619b7-9013-4467-aa6a-389d82530a69",
            "RowNumber": 2,
            "ActivityCreated": true
        }
    ]
}

HTTP Response Codes

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.

On this page

© 2022 by MarketXpander Services Pvt Ltd. All Rights Reserved.