Send an Email to a Lead
Sends an email to a single lead.
API URL
Request
Content-Type: application/json{ "SenderType":"UserEmailAddress", "Sender":"marketeer@example.com", "CCEmailAddress":"john2@example.com", "RecipientType":"LeadEmailAddress", "RecipientEmailFields":"", "Recipient":"johnsmith@example.com", "EmailType":"Html", "EmailLibraryName":"", "ContentHTML":"Welcome John", "ContentText":"Welcome John", "Subject":"Example Subject", "IncludeEmailFooter":true, "Schedule":"2017-10-13 10:00:00", "EmailCategory":"" }
Request Parameters
Parameter | Description |
---|---|
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:
|
Sender | This is the sender of the email that your lead will see in the sent from field of your email.
|
CCEmailAddress | The email address of the LeadSquared user to CC in the email. |
RecipientType | Similar to the “SenderType” parameter, this parameter lets you choose how you want to pass the recipient of your email. You can pass the “RecipientType” as:
|
RecipientEmailFields | This parameter is not mandatory. If you have created custom fields for your leads where you are recording a secondary or alternative email address then you can pass the schema name of that field here. Note: If you don’t pass this parameter, your email will be delivered to all the email addresses recorded in your custom fields. You can find the schema name by navigating to Settings>Customization>Lead Fields. |
Recipient | This is the lead that will receive your email.
|
EmailType | You can pass the “EmailType” as either:
|
EmailLibraryName | This parameter is only required if you passed the “EmailType“ parameter as “Template”. You can pass the name of any email template that you saved in your LeadSquared account. You can find your saved templates by navigating to Content>Email Library. |
ContentHTML | This parameter is required if you passed the “EmailType” parameter as “HTML”. You can pass the HTML code that you want rendered on the email here. |
ContentText | This parameter is required if you passed the “EmailType” parameter as “HTML”. Since some email clients do not support certain HTML formats, this parameter gives you the ability to deliver simple text in the body of your email. You can pass any text you want here. |
Subject | Pass the subject of your email here. |
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. |
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. |
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
{ "ID": "302a8f26-9465-11e7-b0ab-02e89b2fb8f4", "MemberCount": 1, "TotalRecipient": 1 }
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. |