Send a transactional notification
curl --request POST \
--url https://{notifuseDomain}/api/transactional.send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_id": "ws_1234567890",
"notification": {
"id": "welcome_email",
"contact": {
"email": "user@example.com",
"external_id": "user_12345",
"timezone": "America/New_York",
"language": "en-US",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"phone": "+15551234567",
"address_line_1": "123 Main St",
"address_line_2": "Apt 4B",
"country": "US",
"postcode": "10001",
"state": "NY",
"job_title": "Software Engineer",
"custom_string_1": "Premium tier",
"custom_string_2": "<string>",
"custom_string_3": "<string>",
"custom_string_4": "<string>",
"custom_string_5": "<string>",
"custom_number_1": 42,
"custom_number_2": 123,
"custom_number_3": 123,
"custom_number_4": 123,
"custom_number_5": 123,
"custom_datetime_1": "2023-06-01T09:00:00Z",
"custom_datetime_2": "2023-11-07T05:31:56Z",
"custom_datetime_3": "2023-11-07T05:31:56Z",
"custom_datetime_4": "2023-11-07T05:31:56Z",
"custom_datetime_5": "2023-11-07T05:31:56Z",
"custom_json_1": {
"preferences": {
"theme": "dark",
"notifications": true
}
},
"custom_json_2": {},
"custom_json_3": {},
"custom_json_4": {},
"custom_json_5": {}
},
"channels": [
"email"
],
"external_id": "txn_12345",
"data": {
"user_name": "John Doe",
"activation_link": "https://example.com/activate/abc123"
},
"metadata": {
"campaign_id": "spring_promo_2023",
"source": "user_signup"
},
"email_options": {
"from_name": "Support Team",
"subject": "Welcome, {{ name }}!",
"subject_preview": "Your order has been confirmed",
"cc": [
"manager@example.com"
],
"bcc": [
"archive@example.com"
],
"reply_to": "support@example.com",
"attachments": [
{
"filename": "invoice.pdf",
"content": "JVBERi0xLjQKJeLjz9MKMy4uLg==",
"content_type": "application/pdf",
"disposition": "attachment"
}
]
}
}
}
'import requests
url = "https://{notifuseDomain}/api/transactional.send"
payload = {
"workspace_id": "ws_1234567890",
"notification": {
"id": "welcome_email",
"contact": {
"email": "user@example.com",
"external_id": "user_12345",
"timezone": "America/New_York",
"language": "en-US",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"phone": "+15551234567",
"address_line_1": "123 Main St",
"address_line_2": "Apt 4B",
"country": "US",
"postcode": "10001",
"state": "NY",
"job_title": "Software Engineer",
"custom_string_1": "Premium tier",
"custom_string_2": "<string>",
"custom_string_3": "<string>",
"custom_string_4": "<string>",
"custom_string_5": "<string>",
"custom_number_1": 42,
"custom_number_2": 123,
"custom_number_3": 123,
"custom_number_4": 123,
"custom_number_5": 123,
"custom_datetime_1": "2023-06-01T09:00:00Z",
"custom_datetime_2": "2023-11-07T05:31:56Z",
"custom_datetime_3": "2023-11-07T05:31:56Z",
"custom_datetime_4": "2023-11-07T05:31:56Z",
"custom_datetime_5": "2023-11-07T05:31:56Z",
"custom_json_1": { "preferences": {
"theme": "dark",
"notifications": True
} },
"custom_json_2": {},
"custom_json_3": {},
"custom_json_4": {},
"custom_json_5": {}
},
"channels": ["email"],
"external_id": "txn_12345",
"data": {
"user_name": "John Doe",
"activation_link": "https://example.com/activate/abc123"
},
"metadata": {
"campaign_id": "spring_promo_2023",
"source": "user_signup"
},
"email_options": {
"from_name": "Support Team",
"subject": "Welcome, {{ name }}!",
"subject_preview": "Your order has been confirmed",
"cc": ["manager@example.com"],
"bcc": ["archive@example.com"],
"reply_to": "support@example.com",
"attachments": [
{
"filename": "invoice.pdf",
"content": "JVBERi0xLjQKJeLjz9MKMy4uLg==",
"content_type": "application/pdf",
"disposition": "attachment"
}
]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspace_id: 'ws_1234567890',
notification: {
id: 'welcome_email',
contact: {
email: 'user@example.com',
external_id: 'user_12345',
timezone: 'America/New_York',
language: 'en-US',
first_name: 'John',
last_name: 'Doe',
full_name: 'John Doe',
phone: '+15551234567',
address_line_1: '123 Main St',
address_line_2: 'Apt 4B',
country: 'US',
postcode: '10001',
state: 'NY',
job_title: 'Software Engineer',
custom_string_1: 'Premium tier',
custom_string_2: '<string>',
custom_string_3: '<string>',
custom_string_4: '<string>',
custom_string_5: '<string>',
custom_number_1: 42,
custom_number_2: 123,
custom_number_3: 123,
custom_number_4: 123,
custom_number_5: 123,
custom_datetime_1: '2023-06-01T09:00:00Z',
custom_datetime_2: '2023-11-07T05:31:56Z',
custom_datetime_3: '2023-11-07T05:31:56Z',
custom_datetime_4: '2023-11-07T05:31:56Z',
custom_datetime_5: '2023-11-07T05:31:56Z',
custom_json_1: {preferences: {theme: 'dark', notifications: true}},
custom_json_2: {},
custom_json_3: {},
custom_json_4: {},
custom_json_5: {}
},
channels: ['email'],
external_id: 'txn_12345',
data: {user_name: 'John Doe', activation_link: 'https://example.com/activate/abc123'},
metadata: {campaign_id: 'spring_promo_2023', source: 'user_signup'},
email_options: {
from_name: 'Support Team',
subject: 'Welcome, {{ name }}!',
subject_preview: 'Your order has been confirmed',
cc: ['manager@example.com'],
bcc: ['archive@example.com'],
reply_to: 'support@example.com',
attachments: [
{
filename: 'invoice.pdf',
content: 'JVBERi0xLjQKJeLjz9MKMy4uLg==',
content_type: 'application/pdf',
disposition: 'attachment'
}
]
}
}
})
};
fetch('https://{notifuseDomain}/api/transactional.send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{notifuseDomain}/api/transactional.send",
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([
'workspace_id' => 'ws_1234567890',
'notification' => [
'id' => 'welcome_email',
'contact' => [
'email' => 'user@example.com',
'external_id' => 'user_12345',
'timezone' => 'America/New_York',
'language' => 'en-US',
'first_name' => 'John',
'last_name' => 'Doe',
'full_name' => 'John Doe',
'phone' => '+15551234567',
'address_line_1' => '123 Main St',
'address_line_2' => 'Apt 4B',
'country' => 'US',
'postcode' => '10001',
'state' => 'NY',
'job_title' => 'Software Engineer',
'custom_string_1' => 'Premium tier',
'custom_string_2' => '<string>',
'custom_string_3' => '<string>',
'custom_string_4' => '<string>',
'custom_string_5' => '<string>',
'custom_number_1' => 42,
'custom_number_2' => 123,
'custom_number_3' => 123,
'custom_number_4' => 123,
'custom_number_5' => 123,
'custom_datetime_1' => '2023-06-01T09:00:00Z',
'custom_datetime_2' => '2023-11-07T05:31:56Z',
'custom_datetime_3' => '2023-11-07T05:31:56Z',
'custom_datetime_4' => '2023-11-07T05:31:56Z',
'custom_datetime_5' => '2023-11-07T05:31:56Z',
'custom_json_1' => [
'preferences' => [
'theme' => 'dark',
'notifications' => true
]
],
'custom_json_2' => [
],
'custom_json_3' => [
],
'custom_json_4' => [
],
'custom_json_5' => [
]
],
'channels' => [
'email'
],
'external_id' => 'txn_12345',
'data' => [
'user_name' => 'John Doe',
'activation_link' => 'https://example.com/activate/abc123'
],
'metadata' => [
'campaign_id' => 'spring_promo_2023',
'source' => 'user_signup'
],
'email_options' => [
'from_name' => 'Support Team',
'subject' => 'Welcome, {{ name }}!',
'subject_preview' => 'Your order has been confirmed',
'cc' => [
'manager@example.com'
],
'bcc' => [
'archive@example.com'
],
'reply_to' => 'support@example.com',
'attachments' => [
[
'filename' => 'invoice.pdf',
'content' => 'JVBERi0xLjQKJeLjz9MKMy4uLg==',
'content_type' => 'application/pdf',
'disposition' => 'attachment'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{notifuseDomain}/api/transactional.send"
payload := strings.NewReader("{\n \"workspace_id\": \"ws_1234567890\",\n \"notification\": {\n \"id\": \"welcome_email\",\n \"contact\": {\n \"email\": \"user@example.com\",\n \"external_id\": \"user_12345\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en-US\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"full_name\": \"John Doe\",\n \"phone\": \"+15551234567\",\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 4B\",\n \"country\": \"US\",\n \"postcode\": \"10001\",\n \"state\": \"NY\",\n \"job_title\": \"Software Engineer\",\n \"custom_string_1\": \"Premium tier\",\n \"custom_string_2\": \"<string>\",\n \"custom_string_3\": \"<string>\",\n \"custom_string_4\": \"<string>\",\n \"custom_string_5\": \"<string>\",\n \"custom_number_1\": 42,\n \"custom_number_2\": 123,\n \"custom_number_3\": 123,\n \"custom_number_4\": 123,\n \"custom_number_5\": 123,\n \"custom_datetime_1\": \"2023-06-01T09:00:00Z\",\n \"custom_datetime_2\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_3\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_4\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_5\": \"2023-11-07T05:31:56Z\",\n \"custom_json_1\": {\n \"preferences\": {\n \"theme\": \"dark\",\n \"notifications\": true\n }\n },\n \"custom_json_2\": {},\n \"custom_json_3\": {},\n \"custom_json_4\": {},\n \"custom_json_5\": {}\n },\n \"channels\": [\n \"email\"\n ],\n \"external_id\": \"txn_12345\",\n \"data\": {\n \"user_name\": \"John Doe\",\n \"activation_link\": \"https://example.com/activate/abc123\"\n },\n \"metadata\": {\n \"campaign_id\": \"spring_promo_2023\",\n \"source\": \"user_signup\"\n },\n \"email_options\": {\n \"from_name\": \"Support Team\",\n \"subject\": \"Welcome, {{ name }}!\",\n \"subject_preview\": \"Your order has been confirmed\",\n \"cc\": [\n \"manager@example.com\"\n ],\n \"bcc\": [\n \"archive@example.com\"\n ],\n \"reply_to\": \"support@example.com\",\n \"attachments\": [\n {\n \"filename\": \"invoice.pdf\",\n \"content\": \"JVBERi0xLjQKJeLjz9MKMy4uLg==\",\n \"content_type\": \"application/pdf\",\n \"disposition\": \"attachment\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{notifuseDomain}/api/transactional.send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspace_id\": \"ws_1234567890\",\n \"notification\": {\n \"id\": \"welcome_email\",\n \"contact\": {\n \"email\": \"user@example.com\",\n \"external_id\": \"user_12345\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en-US\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"full_name\": \"John Doe\",\n \"phone\": \"+15551234567\",\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 4B\",\n \"country\": \"US\",\n \"postcode\": \"10001\",\n \"state\": \"NY\",\n \"job_title\": \"Software Engineer\",\n \"custom_string_1\": \"Premium tier\",\n \"custom_string_2\": \"<string>\",\n \"custom_string_3\": \"<string>\",\n \"custom_string_4\": \"<string>\",\n \"custom_string_5\": \"<string>\",\n \"custom_number_1\": 42,\n \"custom_number_2\": 123,\n \"custom_number_3\": 123,\n \"custom_number_4\": 123,\n \"custom_number_5\": 123,\n \"custom_datetime_1\": \"2023-06-01T09:00:00Z\",\n \"custom_datetime_2\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_3\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_4\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_5\": \"2023-11-07T05:31:56Z\",\n \"custom_json_1\": {\n \"preferences\": {\n \"theme\": \"dark\",\n \"notifications\": true\n }\n },\n \"custom_json_2\": {},\n \"custom_json_3\": {},\n \"custom_json_4\": {},\n \"custom_json_5\": {}\n },\n \"channels\": [\n \"email\"\n ],\n \"external_id\": \"txn_12345\",\n \"data\": {\n \"user_name\": \"John Doe\",\n \"activation_link\": \"https://example.com/activate/abc123\"\n },\n \"metadata\": {\n \"campaign_id\": \"spring_promo_2023\",\n \"source\": \"user_signup\"\n },\n \"email_options\": {\n \"from_name\": \"Support Team\",\n \"subject\": \"Welcome, {{ name }}!\",\n \"subject_preview\": \"Your order has been confirmed\",\n \"cc\": [\n \"manager@example.com\"\n ],\n \"bcc\": [\n \"archive@example.com\"\n ],\n \"reply_to\": \"support@example.com\",\n \"attachments\": [\n {\n \"filename\": \"invoice.pdf\",\n \"content\": \"JVBERi0xLjQKJeLjz9MKMy4uLg==\",\n \"content_type\": \"application/pdf\",\n \"disposition\": \"attachment\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{notifuseDomain}/api/transactional.send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspace_id\": \"ws_1234567890\",\n \"notification\": {\n \"id\": \"welcome_email\",\n \"contact\": {\n \"email\": \"user@example.com\",\n \"external_id\": \"user_12345\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en-US\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"full_name\": \"John Doe\",\n \"phone\": \"+15551234567\",\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 4B\",\n \"country\": \"US\",\n \"postcode\": \"10001\",\n \"state\": \"NY\",\n \"job_title\": \"Software Engineer\",\n \"custom_string_1\": \"Premium tier\",\n \"custom_string_2\": \"<string>\",\n \"custom_string_3\": \"<string>\",\n \"custom_string_4\": \"<string>\",\n \"custom_string_5\": \"<string>\",\n \"custom_number_1\": 42,\n \"custom_number_2\": 123,\n \"custom_number_3\": 123,\n \"custom_number_4\": 123,\n \"custom_number_5\": 123,\n \"custom_datetime_1\": \"2023-06-01T09:00:00Z\",\n \"custom_datetime_2\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_3\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_4\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_5\": \"2023-11-07T05:31:56Z\",\n \"custom_json_1\": {\n \"preferences\": {\n \"theme\": \"dark\",\n \"notifications\": true\n }\n },\n \"custom_json_2\": {},\n \"custom_json_3\": {},\n \"custom_json_4\": {},\n \"custom_json_5\": {}\n },\n \"channels\": [\n \"email\"\n ],\n \"external_id\": \"txn_12345\",\n \"data\": {\n \"user_name\": \"John Doe\",\n \"activation_link\": \"https://example.com/activate/abc123\"\n },\n \"metadata\": {\n \"campaign_id\": \"spring_promo_2023\",\n \"source\": \"user_signup\"\n },\n \"email_options\": {\n \"from_name\": \"Support Team\",\n \"subject\": \"Welcome, {{ name }}!\",\n \"subject_preview\": \"Your order has been confirmed\",\n \"cc\": [\n \"manager@example.com\"\n ],\n \"bcc\": [\n \"archive@example.com\"\n ],\n \"reply_to\": \"support@example.com\",\n \"attachments\": [\n {\n \"filename\": \"invoice.pdf\",\n \"content\": \"JVBERi0xLjQKJeLjz9MKMy4uLg==\",\n \"content_type\": \"application/pdf\",\n \"disposition\": \"attachment\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"message_id": "msg_1234567890abcdef",
"success": true
}Transactional
Send a transactional notification
Sends a transactional notification to a contact through specified channels. Requires authentication.
POST
/
api
/
transactional.send
Send a transactional notification
curl --request POST \
--url https://{notifuseDomain}/api/transactional.send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_id": "ws_1234567890",
"notification": {
"id": "welcome_email",
"contact": {
"email": "user@example.com",
"external_id": "user_12345",
"timezone": "America/New_York",
"language": "en-US",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"phone": "+15551234567",
"address_line_1": "123 Main St",
"address_line_2": "Apt 4B",
"country": "US",
"postcode": "10001",
"state": "NY",
"job_title": "Software Engineer",
"custom_string_1": "Premium tier",
"custom_string_2": "<string>",
"custom_string_3": "<string>",
"custom_string_4": "<string>",
"custom_string_5": "<string>",
"custom_number_1": 42,
"custom_number_2": 123,
"custom_number_3": 123,
"custom_number_4": 123,
"custom_number_5": 123,
"custom_datetime_1": "2023-06-01T09:00:00Z",
"custom_datetime_2": "2023-11-07T05:31:56Z",
"custom_datetime_3": "2023-11-07T05:31:56Z",
"custom_datetime_4": "2023-11-07T05:31:56Z",
"custom_datetime_5": "2023-11-07T05:31:56Z",
"custom_json_1": {
"preferences": {
"theme": "dark",
"notifications": true
}
},
"custom_json_2": {},
"custom_json_3": {},
"custom_json_4": {},
"custom_json_5": {}
},
"channels": [
"email"
],
"external_id": "txn_12345",
"data": {
"user_name": "John Doe",
"activation_link": "https://example.com/activate/abc123"
},
"metadata": {
"campaign_id": "spring_promo_2023",
"source": "user_signup"
},
"email_options": {
"from_name": "Support Team",
"subject": "Welcome, {{ name }}!",
"subject_preview": "Your order has been confirmed",
"cc": [
"manager@example.com"
],
"bcc": [
"archive@example.com"
],
"reply_to": "support@example.com",
"attachments": [
{
"filename": "invoice.pdf",
"content": "JVBERi0xLjQKJeLjz9MKMy4uLg==",
"content_type": "application/pdf",
"disposition": "attachment"
}
]
}
}
}
'import requests
url = "https://{notifuseDomain}/api/transactional.send"
payload = {
"workspace_id": "ws_1234567890",
"notification": {
"id": "welcome_email",
"contact": {
"email": "user@example.com",
"external_id": "user_12345",
"timezone": "America/New_York",
"language": "en-US",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"phone": "+15551234567",
"address_line_1": "123 Main St",
"address_line_2": "Apt 4B",
"country": "US",
"postcode": "10001",
"state": "NY",
"job_title": "Software Engineer",
"custom_string_1": "Premium tier",
"custom_string_2": "<string>",
"custom_string_3": "<string>",
"custom_string_4": "<string>",
"custom_string_5": "<string>",
"custom_number_1": 42,
"custom_number_2": 123,
"custom_number_3": 123,
"custom_number_4": 123,
"custom_number_5": 123,
"custom_datetime_1": "2023-06-01T09:00:00Z",
"custom_datetime_2": "2023-11-07T05:31:56Z",
"custom_datetime_3": "2023-11-07T05:31:56Z",
"custom_datetime_4": "2023-11-07T05:31:56Z",
"custom_datetime_5": "2023-11-07T05:31:56Z",
"custom_json_1": { "preferences": {
"theme": "dark",
"notifications": True
} },
"custom_json_2": {},
"custom_json_3": {},
"custom_json_4": {},
"custom_json_5": {}
},
"channels": ["email"],
"external_id": "txn_12345",
"data": {
"user_name": "John Doe",
"activation_link": "https://example.com/activate/abc123"
},
"metadata": {
"campaign_id": "spring_promo_2023",
"source": "user_signup"
},
"email_options": {
"from_name": "Support Team",
"subject": "Welcome, {{ name }}!",
"subject_preview": "Your order has been confirmed",
"cc": ["manager@example.com"],
"bcc": ["archive@example.com"],
"reply_to": "support@example.com",
"attachments": [
{
"filename": "invoice.pdf",
"content": "JVBERi0xLjQKJeLjz9MKMy4uLg==",
"content_type": "application/pdf",
"disposition": "attachment"
}
]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspace_id: 'ws_1234567890',
notification: {
id: 'welcome_email',
contact: {
email: 'user@example.com',
external_id: 'user_12345',
timezone: 'America/New_York',
language: 'en-US',
first_name: 'John',
last_name: 'Doe',
full_name: 'John Doe',
phone: '+15551234567',
address_line_1: '123 Main St',
address_line_2: 'Apt 4B',
country: 'US',
postcode: '10001',
state: 'NY',
job_title: 'Software Engineer',
custom_string_1: 'Premium tier',
custom_string_2: '<string>',
custom_string_3: '<string>',
custom_string_4: '<string>',
custom_string_5: '<string>',
custom_number_1: 42,
custom_number_2: 123,
custom_number_3: 123,
custom_number_4: 123,
custom_number_5: 123,
custom_datetime_1: '2023-06-01T09:00:00Z',
custom_datetime_2: '2023-11-07T05:31:56Z',
custom_datetime_3: '2023-11-07T05:31:56Z',
custom_datetime_4: '2023-11-07T05:31:56Z',
custom_datetime_5: '2023-11-07T05:31:56Z',
custom_json_1: {preferences: {theme: 'dark', notifications: true}},
custom_json_2: {},
custom_json_3: {},
custom_json_4: {},
custom_json_5: {}
},
channels: ['email'],
external_id: 'txn_12345',
data: {user_name: 'John Doe', activation_link: 'https://example.com/activate/abc123'},
metadata: {campaign_id: 'spring_promo_2023', source: 'user_signup'},
email_options: {
from_name: 'Support Team',
subject: 'Welcome, {{ name }}!',
subject_preview: 'Your order has been confirmed',
cc: ['manager@example.com'],
bcc: ['archive@example.com'],
reply_to: 'support@example.com',
attachments: [
{
filename: 'invoice.pdf',
content: 'JVBERi0xLjQKJeLjz9MKMy4uLg==',
content_type: 'application/pdf',
disposition: 'attachment'
}
]
}
}
})
};
fetch('https://{notifuseDomain}/api/transactional.send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{notifuseDomain}/api/transactional.send",
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([
'workspace_id' => 'ws_1234567890',
'notification' => [
'id' => 'welcome_email',
'contact' => [
'email' => 'user@example.com',
'external_id' => 'user_12345',
'timezone' => 'America/New_York',
'language' => 'en-US',
'first_name' => 'John',
'last_name' => 'Doe',
'full_name' => 'John Doe',
'phone' => '+15551234567',
'address_line_1' => '123 Main St',
'address_line_2' => 'Apt 4B',
'country' => 'US',
'postcode' => '10001',
'state' => 'NY',
'job_title' => 'Software Engineer',
'custom_string_1' => 'Premium tier',
'custom_string_2' => '<string>',
'custom_string_3' => '<string>',
'custom_string_4' => '<string>',
'custom_string_5' => '<string>',
'custom_number_1' => 42,
'custom_number_2' => 123,
'custom_number_3' => 123,
'custom_number_4' => 123,
'custom_number_5' => 123,
'custom_datetime_1' => '2023-06-01T09:00:00Z',
'custom_datetime_2' => '2023-11-07T05:31:56Z',
'custom_datetime_3' => '2023-11-07T05:31:56Z',
'custom_datetime_4' => '2023-11-07T05:31:56Z',
'custom_datetime_5' => '2023-11-07T05:31:56Z',
'custom_json_1' => [
'preferences' => [
'theme' => 'dark',
'notifications' => true
]
],
'custom_json_2' => [
],
'custom_json_3' => [
],
'custom_json_4' => [
],
'custom_json_5' => [
]
],
'channels' => [
'email'
],
'external_id' => 'txn_12345',
'data' => [
'user_name' => 'John Doe',
'activation_link' => 'https://example.com/activate/abc123'
],
'metadata' => [
'campaign_id' => 'spring_promo_2023',
'source' => 'user_signup'
],
'email_options' => [
'from_name' => 'Support Team',
'subject' => 'Welcome, {{ name }}!',
'subject_preview' => 'Your order has been confirmed',
'cc' => [
'manager@example.com'
],
'bcc' => [
'archive@example.com'
],
'reply_to' => 'support@example.com',
'attachments' => [
[
'filename' => 'invoice.pdf',
'content' => 'JVBERi0xLjQKJeLjz9MKMy4uLg==',
'content_type' => 'application/pdf',
'disposition' => 'attachment'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{notifuseDomain}/api/transactional.send"
payload := strings.NewReader("{\n \"workspace_id\": \"ws_1234567890\",\n \"notification\": {\n \"id\": \"welcome_email\",\n \"contact\": {\n \"email\": \"user@example.com\",\n \"external_id\": \"user_12345\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en-US\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"full_name\": \"John Doe\",\n \"phone\": \"+15551234567\",\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 4B\",\n \"country\": \"US\",\n \"postcode\": \"10001\",\n \"state\": \"NY\",\n \"job_title\": \"Software Engineer\",\n \"custom_string_1\": \"Premium tier\",\n \"custom_string_2\": \"<string>\",\n \"custom_string_3\": \"<string>\",\n \"custom_string_4\": \"<string>\",\n \"custom_string_5\": \"<string>\",\n \"custom_number_1\": 42,\n \"custom_number_2\": 123,\n \"custom_number_3\": 123,\n \"custom_number_4\": 123,\n \"custom_number_5\": 123,\n \"custom_datetime_1\": \"2023-06-01T09:00:00Z\",\n \"custom_datetime_2\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_3\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_4\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_5\": \"2023-11-07T05:31:56Z\",\n \"custom_json_1\": {\n \"preferences\": {\n \"theme\": \"dark\",\n \"notifications\": true\n }\n },\n \"custom_json_2\": {},\n \"custom_json_3\": {},\n \"custom_json_4\": {},\n \"custom_json_5\": {}\n },\n \"channels\": [\n \"email\"\n ],\n \"external_id\": \"txn_12345\",\n \"data\": {\n \"user_name\": \"John Doe\",\n \"activation_link\": \"https://example.com/activate/abc123\"\n },\n \"metadata\": {\n \"campaign_id\": \"spring_promo_2023\",\n \"source\": \"user_signup\"\n },\n \"email_options\": {\n \"from_name\": \"Support Team\",\n \"subject\": \"Welcome, {{ name }}!\",\n \"subject_preview\": \"Your order has been confirmed\",\n \"cc\": [\n \"manager@example.com\"\n ],\n \"bcc\": [\n \"archive@example.com\"\n ],\n \"reply_to\": \"support@example.com\",\n \"attachments\": [\n {\n \"filename\": \"invoice.pdf\",\n \"content\": \"JVBERi0xLjQKJeLjz9MKMy4uLg==\",\n \"content_type\": \"application/pdf\",\n \"disposition\": \"attachment\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{notifuseDomain}/api/transactional.send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspace_id\": \"ws_1234567890\",\n \"notification\": {\n \"id\": \"welcome_email\",\n \"contact\": {\n \"email\": \"user@example.com\",\n \"external_id\": \"user_12345\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en-US\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"full_name\": \"John Doe\",\n \"phone\": \"+15551234567\",\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 4B\",\n \"country\": \"US\",\n \"postcode\": \"10001\",\n \"state\": \"NY\",\n \"job_title\": \"Software Engineer\",\n \"custom_string_1\": \"Premium tier\",\n \"custom_string_2\": \"<string>\",\n \"custom_string_3\": \"<string>\",\n \"custom_string_4\": \"<string>\",\n \"custom_string_5\": \"<string>\",\n \"custom_number_1\": 42,\n \"custom_number_2\": 123,\n \"custom_number_3\": 123,\n \"custom_number_4\": 123,\n \"custom_number_5\": 123,\n \"custom_datetime_1\": \"2023-06-01T09:00:00Z\",\n \"custom_datetime_2\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_3\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_4\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_5\": \"2023-11-07T05:31:56Z\",\n \"custom_json_1\": {\n \"preferences\": {\n \"theme\": \"dark\",\n \"notifications\": true\n }\n },\n \"custom_json_2\": {},\n \"custom_json_3\": {},\n \"custom_json_4\": {},\n \"custom_json_5\": {}\n },\n \"channels\": [\n \"email\"\n ],\n \"external_id\": \"txn_12345\",\n \"data\": {\n \"user_name\": \"John Doe\",\n \"activation_link\": \"https://example.com/activate/abc123\"\n },\n \"metadata\": {\n \"campaign_id\": \"spring_promo_2023\",\n \"source\": \"user_signup\"\n },\n \"email_options\": {\n \"from_name\": \"Support Team\",\n \"subject\": \"Welcome, {{ name }}!\",\n \"subject_preview\": \"Your order has been confirmed\",\n \"cc\": [\n \"manager@example.com\"\n ],\n \"bcc\": [\n \"archive@example.com\"\n ],\n \"reply_to\": \"support@example.com\",\n \"attachments\": [\n {\n \"filename\": \"invoice.pdf\",\n \"content\": \"JVBERi0xLjQKJeLjz9MKMy4uLg==\",\n \"content_type\": \"application/pdf\",\n \"disposition\": \"attachment\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{notifuseDomain}/api/transactional.send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspace_id\": \"ws_1234567890\",\n \"notification\": {\n \"id\": \"welcome_email\",\n \"contact\": {\n \"email\": \"user@example.com\",\n \"external_id\": \"user_12345\",\n \"timezone\": \"America/New_York\",\n \"language\": \"en-US\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"full_name\": \"John Doe\",\n \"phone\": \"+15551234567\",\n \"address_line_1\": \"123 Main St\",\n \"address_line_2\": \"Apt 4B\",\n \"country\": \"US\",\n \"postcode\": \"10001\",\n \"state\": \"NY\",\n \"job_title\": \"Software Engineer\",\n \"custom_string_1\": \"Premium tier\",\n \"custom_string_2\": \"<string>\",\n \"custom_string_3\": \"<string>\",\n \"custom_string_4\": \"<string>\",\n \"custom_string_5\": \"<string>\",\n \"custom_number_1\": 42,\n \"custom_number_2\": 123,\n \"custom_number_3\": 123,\n \"custom_number_4\": 123,\n \"custom_number_5\": 123,\n \"custom_datetime_1\": \"2023-06-01T09:00:00Z\",\n \"custom_datetime_2\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_3\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_4\": \"2023-11-07T05:31:56Z\",\n \"custom_datetime_5\": \"2023-11-07T05:31:56Z\",\n \"custom_json_1\": {\n \"preferences\": {\n \"theme\": \"dark\",\n \"notifications\": true\n }\n },\n \"custom_json_2\": {},\n \"custom_json_3\": {},\n \"custom_json_4\": {},\n \"custom_json_5\": {}\n },\n \"channels\": [\n \"email\"\n ],\n \"external_id\": \"txn_12345\",\n \"data\": {\n \"user_name\": \"John Doe\",\n \"activation_link\": \"https://example.com/activate/abc123\"\n },\n \"metadata\": {\n \"campaign_id\": \"spring_promo_2023\",\n \"source\": \"user_signup\"\n },\n \"email_options\": {\n \"from_name\": \"Support Team\",\n \"subject\": \"Welcome, {{ name }}!\",\n \"subject_preview\": \"Your order has been confirmed\",\n \"cc\": [\n \"manager@example.com\"\n ],\n \"bcc\": [\n \"archive@example.com\"\n ],\n \"reply_to\": \"support@example.com\",\n \"attachments\": [\n {\n \"filename\": \"invoice.pdf\",\n \"content\": \"JVBERi0xLjQKJeLjz9MKMy4uLg==\",\n \"content_type\": \"application/pdf\",\n \"disposition\": \"attachment\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"message_id": "msg_1234567890abcdef",
"success": true
}Authorizations
API token for authentication
Body
application/json
⌘I
