Send an Email Campaign

Lets you send an email campaign to a list of leads. Once the campaign is scheduled, you can view the campaign details under Marketing>Email Campaign

Note: The report for email campaigns sent through this API will be available 20 minutes after the campaign is sent.

API URL

POST
https://{host}/v2/EmailMarketing.svc/SendCampaignToList?accessKey=AccessKey&secretKey=SecretKey
Copy URL

Request

JSON Body/Payload

Content-Type: application/json

{  
   "EmailLibraryName":"Email template name",
   "SenderType":"User",
   "From_UserIdEmailAddress":"Sender email address",
   "ListId":" Mention the list ID",
   "Schedule":"2017-07-13 11:06:00",
   "EmailCampaignName":"Campaign name",
   "IncludeEmailFooter":true,
   "EmailCategory":"Category name"
}

JSON Properties

Parameter Description
EmailLibraryName

The name of an email template (either system generated or created by you). You can find it here.

SenderType

This parameter lets you choose how you want to pass the sender of the email. Depending on the chosen value for this parameter, you will have to pass a corresponding value in the “Sender” parameter.

The “SenderType” can be passed as:

  • UserId
    If you pass this value, the “Sender” parameter must contain the user Id of the sender.

 

  • “UserEmailAddress”
    If you pass this value, you can simply specify the sender’s email address in the “Sender” parameter.

 

  • “APICaller”
    If you pass this value, you don’t have to pass any value in the “Sender” parameter. The email address of the person who called the API will automatically be displayed as the sender of the email.

 

  • “LeadOwner”
    If you pass this value, you don’t have to pass any value in the “Sender” parameter. The lead owner will automatically be displayed as the sender of the email.
From_UserIdEmailAddress

Use the required administrator or marketing user email address.

ListId

This is the unique ID of a lead’s list. To get this, refer to the Retrieve all Lists API

Schedule

This parameter allows you to schedule the email for a later date and time. If you don’t pass this value the email will be sent immediately.
Be sure to adhere to the “YYYY-mm-dd HH:mm:ss” format.

EmailCampaignName

The name of your email campaign. For example “Merry Christmas from Example Brand”.

IncludeEmailFooter

You can pass this value as “true” if you wish to add a footer in your email or as “false” if you don’t.

EmailCategory

This parameter is not mandatory but you can pass the email category name if you have them created in your LeadSquared account. You can create new email categories by navigating to Settings>Email Settings on the LeadSquared UI.

Response

200 OK

Content-Type: application/json

{
    "ID": "aef54482-6ac1-11e7-bd09-22000aa220ce",
    "MemberCount": 9,
    "TotalRecipient": 6
}

HTTP Response Code

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.