POST

Send.EmailTemplate

Send an organization email_template to one or more customers. Uses dashboard Email compose (send_mail_client_new). Optional data JSON overrides template placeholders: key cf-hello_1 replaces {hello_1} and {cf-hello_1} with the assigned value. Optional custom_email (alias custom_html) merges raw HTML into the template: fills {message} when present, otherwise appends after the template body.

Permissions

  • User must be logged in with a valid bearer token.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Runs the Send.EmailTemplate function and returns JSON.

Push Service

No push is sent because this function only reads data or returns helper information.

Automation

No automation is run for this function.

Special Instructions

  • Required: template_id and cust_ids.
  • data (alias data_array): JSON map of placeholder overrides.
  • Rule: data key "cf-FIELD" or "FIELD" replaces {FIELD} and {cf-FIELD} inside the template HTML/subject with that value. Example: {"cf-hello_1":"VIP","cf-ORDER SELECT":"Override Name"} fills {hello_1} and {ORDER SELECT}.
  • custom_email (aliases: custom_html, html_body): optional custom HTML merged with the template before send. If the template contains {message}, custom_email replaces it (same idea as dashboard compose). If not, custom_email is appended to the template HTML. Template attachments/SMTP still apply. Without custom_email/data, behavior is unchanged.
  • Also supports nested/per-customer shapes and contactus static keys (name, phone, …) via temporary customer snapshot.
  • Without data, remaining shortcodes still resolve from the live customer record like the dashboard.
  • Max 50 customers. Recipient email from contactus.email.

Required Parameters

NameTypeSampleExplanation
template_id
post
int3723email_template.id
cust_ids
post
array|string108545,13806825Customer ids

Optional Parameters

NameTypeSampleWhat it gives
data
post
json{"cf-hello_1":"VIP","cf-ORDER SELECT":"Override Name"}Placeholder overrides. cf- prefix optional; matches {} tokens in the template.
custom_email
post
string<p><b>Extra block</b> for this send</p>Custom HTML merged into the template. Alias: custom_html. Fills {message} if the template has it; otherwise appended to the template body. Sent together with the template (SMTP, attachments, shortcodes).

Authentication

Send the bearer token returned by Login in the request header.

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Send.EmailTemplate",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "template_id": "3723",
        "cust_ids": "108545,13806825",
        "data": "{\"cf-hello_1\":\"VIP\"}",
        "custom_email": "<p><b>Extra block<\/b> for this send<\/p>"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Send.EmailTemplate",
    "url_domain": "https:\/\/{domain}\/app\/Send.EmailTemplate"
}

Endpoint

POST /app/Send.EmailTemplate
POST https://{user}.bull36.com/app/Send.EmailTemplate
POST https://{domain}/app/Send.EmailTemplate

Sample Output

{
    "success": 1,
    "template_id": 3723,
    "total": 2,
    "sent": 2,
    "failed": 0,
    "custom_email_applied": 1,
    "custom_email_mode": "message_placeholder",
    "results": [
        {
            "cust_id": 108545,
            "success": 1,
            "message": "Email Send Successfully",
            "custom_email_applied": 1
        }
    ]
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams({
  template_id: '3723',
  cust_ids: '108545,13806825',
  data: JSON.stringify({ 'cf-hello_1': 'VIP' }),
  custom_email: '<p><b>Extra block</b></p>'
});
const res = await fetch('/app/Send.EmailTemplate', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + token },
  body
});
console.log(await res.json());

Error Example

{
    "missing": {
        "success": 0,
        "message": "Missing required parameter: template_id, cust_ids"
    },
    "template_not_found": {
        "success": 0,
        "error": "template_not_found",
        "message": "Template is not valid"
    }
}