Send donor email through my connected account
Requires email/calendar deployment availability and the route permissions. Connected account operations use the authenticated tenant and mailbox owner; body/metadata sharing remains separately authorized. Requires an owned connected/sync-enabled email account, donor email and allowed message preferences. account_id may select it; otherwise the first writable account is used.201 returns the recorded email.202 means the provider accepted the send but recording donor history remains pending; avoid blindly resending.
curl --request POST \
--url https://api.gratona.com/v1/donors/{donor_id}/email-compose/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": "<string>",
"body": "<string>",
"account_id": 123
}
'import requests
url = "https://api.gratona.com/v1/donors/{donor_id}/email-compose/send"
payload = {
"subject": "<string>",
"body": "<string>",
"account_id": 123
}
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({subject: '<string>', body: JSON.stringify('<string>'), account_id: 123})
};
fetch('https://api.gratona.com/v1/donors/{donor_id}/email-compose/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://api.gratona.com/v1/donors/{donor_id}/email-compose/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([
'subject' => '<string>',
'body' => '<string>',
'account_id' => 123
]),
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://api.gratona.com/v1/donors/{donor_id}/email-compose/send"
payload := strings.NewReader("{\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"account_id\": 123\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://api.gratona.com/v1/donors/{donor_id}/email-compose/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"account_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/donors/{donor_id}/email-compose/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 \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"local_body": "<string>",
"delivery_state": "<string>",
"legacy_action": "<string>",
"kind": "<string>",
"type": "<string>",
"client_id": 123,
"donor_id": 123,
"email_calendar_account_id": 123,
"account_email": "<string>",
"account_provider": "<string>",
"owner_user_id": 123,
"owner_name": "<string>",
"source": "<string>",
"subject": "<string>",
"from_address": "<string>",
"email_direction": "<string>",
"body_visibility": "<string>",
"match_status": "<string>",
"matched_by": "<string>",
"matched_email": "<string>",
"classification_class": "<string>",
"metadata_visibility": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"snippet": "<string>",
"provider_message_id": "<string>",
"provider_thread_id": "<string>",
"attachment_count": 123,
"subtype": "<string>",
"can_view_body": true,
"can_view_metadata": true,
"can_correct_relationship": true,
"source_deleted": true,
"provider_deleted_at": "2023-11-07T05:31:56Z",
"body_plain": "<string>",
"body_html": "<string>",
"body_fetch_status": "<string>",
"id": 123,
"to_addresses": [
"<string>"
],
"cc_addresses": [
"<string>"
],
"classification_reasons": [
"<string>"
]
}
}{
"message": "<string>",
"status": "<string>"
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}Authorizations
Passport bearer token authentication for legacy admin sessions.
Path Parameters
Donor id.
Body
Request fields accepted by this operation. Omitted optional properties retain the behavior described above.
Response
Send donor email through my connected account response.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.gratona.com/v1/donors/{donor_id}/email-compose/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": "<string>",
"body": "<string>",
"account_id": 123
}
'import requests
url = "https://api.gratona.com/v1/donors/{donor_id}/email-compose/send"
payload = {
"subject": "<string>",
"body": "<string>",
"account_id": 123
}
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({subject: '<string>', body: JSON.stringify('<string>'), account_id: 123})
};
fetch('https://api.gratona.com/v1/donors/{donor_id}/email-compose/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://api.gratona.com/v1/donors/{donor_id}/email-compose/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([
'subject' => '<string>',
'body' => '<string>',
'account_id' => 123
]),
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://api.gratona.com/v1/donors/{donor_id}/email-compose/send"
payload := strings.NewReader("{\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"account_id\": 123\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://api.gratona.com/v1/donors/{donor_id}/email-compose/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"account_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/donors/{donor_id}/email-compose/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 \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"local_body": "<string>",
"delivery_state": "<string>",
"legacy_action": "<string>",
"kind": "<string>",
"type": "<string>",
"client_id": 123,
"donor_id": 123,
"email_calendar_account_id": 123,
"account_email": "<string>",
"account_provider": "<string>",
"owner_user_id": 123,
"owner_name": "<string>",
"source": "<string>",
"subject": "<string>",
"from_address": "<string>",
"email_direction": "<string>",
"body_visibility": "<string>",
"match_status": "<string>",
"matched_by": "<string>",
"matched_email": "<string>",
"classification_class": "<string>",
"metadata_visibility": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"snippet": "<string>",
"provider_message_id": "<string>",
"provider_thread_id": "<string>",
"attachment_count": 123,
"subtype": "<string>",
"can_view_body": true,
"can_view_metadata": true,
"can_correct_relationship": true,
"source_deleted": true,
"provider_deleted_at": "2023-11-07T05:31:56Z",
"body_plain": "<string>",
"body_html": "<string>",
"body_fetch_status": "<string>",
"id": 123,
"to_addresses": [
"<string>"
],
"cc_addresses": [
"<string>"
],
"classification_reasons": [
"<string>"
]
}
}{
"message": "<string>",
"status": "<string>"
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}