Send Email Template
Sends an email using a predefined template.
This method is suitable for production usage and allows you to use templates for sending emails.
Authorizations
Section titled “Authorizations ”Request Body
Section titled “Request Body ”The request body for sending an email using a template.
This request body should be a JSON object containing the necessary fields to send an email using a template.
object
The unique identifier of the email template to use.
template123
object
The name of the recipient.
Jane Smith
The email address of the recipient.
jane@smith.com
Variables to be used in the email template. Variables avalaible from A to Z. You can define variables like variable_a_var, variable_b_var, etc.
These variables can be used in dynamic content like {{variable_a_var}}.
object
Use on dynamic content like {{variable_a_var}}.
Variable A Value
object
The name of the file to be attached.
document.pdf
The URL of the file to be attached.
The file will be downloaded and attached to the email.
https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf
object
The name of the file to be attached.
document.pdf
The base64 encoded content of the file to be attached.
This is useful for small files that can be sent directly in the request.
data:(mime type),base64,JVBERi0xLjQKJazc... (base64 content)
Responses
Section titled “ Responses ”Email sent successfully.
object
true
Email sent successfully
Your key auth is not valid
object
true
Your key auth is not valid, please check with your administrator to get the new key
Example
{ "status": false, "error": true, "description": "Your key auth is not valid, please check with your administrator to get the new key"}
Your account dont have credits availables for send
object
true
Your account dont have credits availables for send this, please contact your administrator
Example
{ "status": false, "error": true, "description": "Your account dont have credits availables for send this, please contact your administrator"}
Missing required parameters
object
true
Missing params, please verify or contact to support
Example
{ "status": false, "error": true, "description": "Missing params, please verify or contact to support"}
Examples
Section titled “Examples ”Useful for guiding users to view code examples in different developer languages.
curl -X POST "https://api.example.com/v1/send/template" \ -H "Accept: application/json" \ -H "Connection: keep-alive" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your-token>" \ -d '{"template_id":"template123","to":[{"name":"Jane Smith","email":"jane@smith.com"}],"variables":{"variable_a_var":"Variable A Value"},"attachment":[{"name":"document.pdf","url":"https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf"}],"attachment_buffer":[{"name":"document.pdf","content":"data:(mime type),base64,JVBERi0xLjQKJazc... (base64 content)"}]}'
const fetch = require('node-fetch');
fetch("https://api.example.com/v1/send/template", { method: "POST", headers: { "Accept": "application/json", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "Bearer <your-token>"}, body: JSON.stringify({ "template_id": "template123", "to": [ { "name": "Jane Smith", "email": "jane@smith.com" } ], "variables": { "variable_a_var": "Variable A Value" }, "attachment": [ { "name": "document.pdf", "url": "https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf" } ], "attachment_buffer": [ { "name": "document.pdf", "content": "data:(mime type),base64,JVBERi0xLjQKJazc... (base64 content)" } ]}) }) .then(res => res.json()) .then(console.log) .catch(console.error);
<?php $curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.example.com/v1/send/template", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Accept: application/json", "Connection: keep-alive", "Content-Type: application/json", "Authorization: Bearer <your-token>" ], CURLOPT_POSTFIELDS => json_encode({ "template_id": "template123", "to": [ { "name": "Jane Smith", "email": "jane@smith.com" } ], "variables": { "variable_a_var": "Variable A Value" }, "attachment": [ { "name": "document.pdf", "url": "https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf" } ], "attachment_buffer": [ { "name": "document.pdf", "content": "data:(mime type),base64,JVBERi0xLjQKJazc... (base64 content)" } ]}) ]);
$response = curl_exec($curl); curl_close($curl); echo $response; ?>
using System.Net.Http; using System.Text; using System.Threading.Tasks;
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.POST, "https://api.example.com/v1/send/template") { Content = new StringContent("{ \"template_id\": \"template123\", \"to\": [ { \"name\": \"Jane Smith\", \"email\": \"jane@smith.com\" } ], \"variables\": { \"variable_a_var\": \"Variable A Value\" }, \"attachment\": [ { \"name\": \"document.pdf\", \"url\": \"https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf\" } ], \"attachment_buffer\": [ { \"name\": \"document.pdf\", \"content\": \"data:(mime type),base64,JVBERi0xLjQKJazc... (base64 content)\" } ]}", Encoding.UTF8, "application/json") }; request.Headers.Add("Accept", "application/json");request.Headers.Add("Connection", "keep-alive");request.Headers.Add("Content-Type", "application/json");request.Headers.Add("Authorization", "Bearer <your-token>"); var response = await client.SendAsync(request); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody);
import requests import json
url = "https://api.example.com/v1/send/template" headers = { "Accept": "application/json", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "Bearer <your-token>" } data = { "template_id": "template123", "to": [ { "name": "Jane Smith", "email": "jane@smith.com" } ], "variables": { "variable_a_var": "Variable A Value" }, "attachment": [ { "name": "document.pdf", "url": "https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf" } ], "attachment_buffer": [ { "name": "document.pdf", "content": "data:(mime type),base64,JVBERi0xLjQKJazc... (base64 content)" } ]}
response = requests.post(url, headers=headers, json=data) print(response.text)
import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets;
public class ApiExample { public static void main(String[] args) throws Exception { URL url = new URL("https://api.example.com/v1/send/template"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoOutput(true); conn.setRequestProperty("Accept", "application/json"); conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Authorization", "Bearer <your-token>");
String jsonInputString = "{\"template_id\":\"template123\",\"to\":[{\"name\":\"Jane Smith\",\"email\":\"jane@smith.com\"}],\"variables\":{\"variable_a_var\":\"Variable A Value\"},\"attachment\":[{\"name\":\"document.pdf\",\"url\":\"https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf\"}],\"attachment_buffer\":[{\"name\":\"document.pdf\",\"content\":\"data:(mime type),base64,JVBERi0xLjQKJazc... (base64 content)\"}]}"; try(OutputStream os = conn.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); }
int code = conn.getResponseCode(); System.out.println("Response code: " + code); } }