Transactional Email
Send Transactional Email Template
Send a transactional email using a pre-built template. Templates are created in the Flywheel dashboard and can include dynamic variables that are populated at send time.
POST
/
v1
/
transactional
/
template
Send Transactional Email Template
const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Auth-Type': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: {
transactional_template_id: '550e8400-e29b-41d4-a716-446655440000',
to: 'user@example.com',
variables: {
first_name: 'John',
company_name: 'Acme Corp',
activation_url: 'https://app.yourdomain.com/activate?token=xyz'
}
}
})
};
fetch('https://api.flywheel.cx/v1/transactional/template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Auth-Type': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: {
transactional_template_id: '550e8400-e29b-41d4-a716-446655440000',
to: 'user@example.com',
variables: {
first_name: 'John',
company_name: 'Acme Corp',
activation_url: 'https://app.yourdomain.com/activate?token=xyz'
}
}
})
};
fetch('https://api.flywheel.cx/v1/transactional/template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.flywheel.cx/v1/transactional/template \
--header 'Auth-Type: <api-key>' \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"params": {
"transactional_template_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "user@example.com",
"variables": {
"first_name": "John",
"company_name": "Acme Corp",
"activation_url": "https://app.yourdomain.com/activate?token=xyz"
}
}
}
'import requests
url = "https://api.flywheel.cx/v1/transactional/template"
payload = { "params": {
"transactional_template_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "user@example.com",
"variables": {
"first_name": "John",
"company_name": "Acme Corp",
"activation_url": "https://app.yourdomain.com/activate?token=xyz"
}
} }
headers = {
"Authorization": "<api-key>",
"Auth-Type": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flywheel.cx/v1/transactional/template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'params' => [
'transactional_template_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => 'user@example.com',
'variables' => [
'first_name' => 'John',
'company_name' => 'Acme Corp',
'activation_url' => 'https://app.yourdomain.com/activate?token=xyz'
]
]
]),
CURLOPT_HTTPHEADER => [
"Auth-Type: <api-key>",
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"email_id": "987fcdeb-51a2-43d1-9f12-123456789abc"
}Authorizations
Enter your API key obtained from the Flywheel dashboard (without 'Bearer ' prefix)
Authentication type header. Must be set to 'api' for all API requests.
Body
application/json
Show child attributes
Show child attributes
⌘I
Send Transactional Email Template
const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Auth-Type': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: {
transactional_template_id: '550e8400-e29b-41d4-a716-446655440000',
to: 'user@example.com',
variables: {
first_name: 'John',
company_name: 'Acme Corp',
activation_url: 'https://app.yourdomain.com/activate?token=xyz'
}
}
})
};
fetch('https://api.flywheel.cx/v1/transactional/template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Auth-Type': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: {
transactional_template_id: '550e8400-e29b-41d4-a716-446655440000',
to: 'user@example.com',
variables: {
first_name: 'John',
company_name: 'Acme Corp',
activation_url: 'https://app.yourdomain.com/activate?token=xyz'
}
}
})
};
fetch('https://api.flywheel.cx/v1/transactional/template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.flywheel.cx/v1/transactional/template \
--header 'Auth-Type: <api-key>' \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"params": {
"transactional_template_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "user@example.com",
"variables": {
"first_name": "John",
"company_name": "Acme Corp",
"activation_url": "https://app.yourdomain.com/activate?token=xyz"
}
}
}
'import requests
url = "https://api.flywheel.cx/v1/transactional/template"
payload = { "params": {
"transactional_template_id": "550e8400-e29b-41d4-a716-446655440000",
"to": "user@example.com",
"variables": {
"first_name": "John",
"company_name": "Acme Corp",
"activation_url": "https://app.yourdomain.com/activate?token=xyz"
}
} }
headers = {
"Authorization": "<api-key>",
"Auth-Type": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flywheel.cx/v1/transactional/template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'params' => [
'transactional_template_id' => '550e8400-e29b-41d4-a716-446655440000',
'to' => 'user@example.com',
'variables' => [
'first_name' => 'John',
'company_name' => 'Acme Corp',
'activation_url' => 'https://app.yourdomain.com/activate?token=xyz'
]
]
]),
CURLOPT_HTTPHEADER => [
"Auth-Type: <api-key>",
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"email_id": "987fcdeb-51a2-43d1-9f12-123456789abc"
}