Email Trigger

POST /Email/Predefinedemail

This endpoint is used to trigger email sendings based on pre-saved email trigger templates. Email trigger templates allow you to save all the details necessary to 'trigger' an email sending as a template. Doing so helps you save time by using a template to autofill the Email sending details like the Sender name, the Sender Email, the email subject, preheader, etc., at the time of campaign distribution.

Usage scenario for this endpoint:

This endpoint is used to trigger an Email sending based on details pre-saved as email trigger templates – no need to pass the details manually.

Method Details
HTTP Method POST
Content type Application/json
Requires authentication? YES
Rate limited? YES
Headers User-Agent
Module Email
End Point

https://apiemail.mainbrainer.com/email/predefinedemail

Required Parameters Usage Description
Access Token or API Key Authorization: Bearer {token} header Pass the API key in the request header for request authentication.Read more about our authentication process.
Listid listId (uuid) eg: "3fa85f64-5717-4562-b3fc-2c963f66afa6 Each contact list in the MainBrainer CRM is assigned a unique List ID that acts as a Unique identifier for the particular list. In case you wish to send the SMS to contacts of a particular list, specify the list ID of the desired list using the parameter listId.
Template ID Used in the request body and typically looks like this = TEMAIL-997 It is the unique identifier for a trigger template created in your MainBrainer account. The Email sending details are fetched as per the details saved under this specified template ID.
Recipient Include email for example sink@mainbrainer.com This parameter specifies the email address at which you want to send the email.
Personalization Substitution Tags personalizationSubstitutionTags : { "tagName": "[name]", "tagValue": "Sink" } These tags help you insert dynamic data at the time of email sending. In order to substitute the data at the time of the sending, follow the pattern "substitution_tag":"value” to substitute for the key/value pairs.

-- In case you use the parameter 'recipients' to identify the email recipients, the substitutions will work as specified.
-- In case you use the parameter 'recipients' to identify the email recipients, the substitutions will work as specified.
-- In case you use both the parameters listID and recipients to identify the email recipients, and the information passed under recipients is not in conformity with the information stored in the CRM list, data will get substituted on the basis of information passed under the parameter recipients.
-- In case you use the parameter ListID to identify multiple Lists, and a contact exists in both the lists with different information, data will get substituted from either of the lists on a random basis.
ScheduledDate-time RFC3339 format (Y-m-d\TH:i:sP) Pass the scheduled date and time of the message in RFC3339 format (Y-m-d\TH:i:sP). The date and time passed in this parameter will be converted as per the offset value specified in your account settings.
Webhook URL Delivery Status Use this parameter to specify the webhook URL where you want to receive delivery status updates for the email being sent. When the destination email client returns a delivery status, the status is instantly posted to this webhook URL. Using a Webhook enables your application to receive delivery updates as they happen, in an easily parsable JSON format.
Updates will be sent for the following delivery statuses:
+ Processed
+ Dropped
+ Deferred
+ Bounce
+ Delivered
+ Open
+ Click
+ Spam Report
+ Unsubscribe
Note:

To identify the recipients for the Email sending, it is mandatory to specify at least one of the parameters - List ID or the parameter - recipients. In case you wish to include manually added recipients in addition to contacts of a MainBrainer CRM list, pass the relevant values in both the parameters - List ID and recipients.

Note:

Emails will only be sent to contacts if their emailOptIn status is true.

Note:

A maximum of 1000 emails can be sent per request.

Email Trigger Templates and Trigger Template ID

Email Trigger Templates and Trigger Template ID Email trigger templates allow you to save all the details necessary to 'trigger' an Email sending as a template. Every Email trigger template on MainBrainer.com is assigned a unique template ID. This template ID acts as the unique identifier for the template created in your MainBrainer account

Copy
Copied

This example demonstrates how to send predefine trigger Emails


post url: https://apiemail.mainbrainer.com/email/predefinedemail

{
"predefinedTemplateId": "TEMAIL-896",
"listId": [
  "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
"scheduleDateTime": "2019-08-24T14:15:22Z",
"recipients": [
  {
    "to": "sink@mainbrainer.com",
    "personalizationSubstitutionTags": [
      {
        "tagName": "[name]",
        "tagValue": "Sink"
      }
    ]
  }
],
"webHookUrl": "https://webhook-url.yourdomain.com"
}

Returns a 202 Accepted response with content on success.
    

Response Body

Copy
Copied
{
"status": "Success",
"message": "Successfully accepted.",
"data": {
    "QueueId": "b39a9eda-4cc9-441f-a41a-32f6fa0953e9",
    "QueuedTimestamp": 1630491138137
}
}