Update donor portal notification preferences
Requires a valid donor session and client-owned program or none context. Saves catalog category/event overrides atomically with channel choices. Valid email categories are returned by GET; email event changes are mirrored to donor records sharing the address. Account access cannot be disabled individually. sms_opt_out=true opts matching records out; false does not grant SMS consent. restore_all_email clears stored email opt-outs and event overrides while donor/form master suppression remains unless do_not_email is separately cleared. Postal changes apply to every matching donor.
curl --request PUT \
--url https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id} \
--header 'Content-Type: application/json' \
--data '
{
"preferences": [
{
"category_key": "marketing",
"channel": "email",
"enabled": true,
"event_key": "*",
"reset": true,
"default": true
}
],
"postal_mail_enabled": true,
"sms_opt_out": true,
"restore_all_email": true,
"do_not_email": true
}
'import requests
url = "https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}"
payload = {
"preferences": [
{
"category_key": "marketing",
"channel": "email",
"enabled": True,
"event_key": "*",
"reset": True,
"default": True
}
],
"postal_mail_enabled": True,
"sms_opt_out": True,
"restore_all_email": True,
"do_not_email": True
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
preferences: [
{
category_key: 'marketing',
channel: 'email',
enabled: true,
event_key: '*',
reset: true,
default: true
}
],
postal_mail_enabled: true,
sms_opt_out: true,
restore_all_email: true,
do_not_email: true
})
};
fetch('https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}', 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/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'preferences' => [
[
'category_key' => 'marketing',
'channel' => 'email',
'enabled' => true,
'event_key' => '*',
'reset' => true,
'default' => true
]
],
'postal_mail_enabled' => true,
'sms_opt_out' => true,
'restore_all_email' => true,
'do_not_email' => true
]),
CURLOPT_HTTPHEADER => [
"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/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}"
payload := strings.NewReader("{\n \"preferences\": [\n {\n \"category_key\": \"marketing\",\n \"channel\": \"email\",\n \"enabled\": true,\n \"event_key\": \"*\",\n \"reset\": true,\n \"default\": true\n }\n ],\n \"postal_mail_enabled\": true,\n \"sms_opt_out\": true,\n \"restore_all_email\": true,\n \"do_not_email\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}")
.header("Content-Type", "application/json")
.body("{\n \"preferences\": [\n {\n \"category_key\": \"marketing\",\n \"channel\": \"email\",\n \"enabled\": true,\n \"event_key\": \"*\",\n \"reset\": true,\n \"default\": true\n }\n ],\n \"postal_mail_enabled\": true,\n \"sms_opt_out\": true,\n \"restore_all_email\": true,\n \"do_not_email\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"preferences\": [\n {\n \"category_key\": \"marketing\",\n \"channel\": \"email\",\n \"enabled\": true,\n \"event_key\": \"*\",\n \"reset\": true,\n \"default\": true\n }\n ],\n \"postal_mail_enabled\": true,\n \"sms_opt_out\": true,\n \"restore_all_email\": true,\n \"do_not_email\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Notification preferences saved.",
"audience": "donor",
"catalog": [
{
"key": "marketing",
"label": "Example",
"description": "Example",
"criticality": "standard",
"requires_disable_warning": true,
"channels": [
"email"
],
"enabled": {},
"mappings": {
"novu_templates": [
"<string>"
],
"activity_actions": [
"<string>"
]
},
"events": [
{
"key": "Example",
"label": "Example",
"channels": [
"email"
],
"enabled": {},
"novu_workflow": "Example",
"mappings": {
"email_triggers": [
"<string>"
],
"novu_event_types": [
"<string>"
],
"novu_templates": [
"<string>"
],
"activity_actions": [
"<string>"
]
}
}
]
}
],
"communication": {
"email_categories": {},
"saved_email_categories": {},
"sms": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"saved_sms": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"postal_mail": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"saved_postal_mail": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"do_not_email": true
}
}{
"message": "Unauthorized",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}Path Parameters
Client id in the current organization.
Organization program id, or none for the global donor portal context.
^(none|[1-9][0-9]*)$Opaque donor session id issued by portal login.
Body
Validated request fields for this operation.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Postal mail enabled. Validation: sometimes, boolean.
true
Sms opt out. Validation: sometimes, boolean.
true
Restore all email. Validation: sometimes, boolean.
true
Do not email. Validation: sometimes, boolean.
true
curl --request PUT \
--url https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id} \
--header 'Content-Type: application/json' \
--data '
{
"preferences": [
{
"category_key": "marketing",
"channel": "email",
"enabled": true,
"event_key": "*",
"reset": true,
"default": true
}
],
"postal_mail_enabled": true,
"sms_opt_out": true,
"restore_all_email": true,
"do_not_email": true
}
'import requests
url = "https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}"
payload = {
"preferences": [
{
"category_key": "marketing",
"channel": "email",
"enabled": True,
"event_key": "*",
"reset": True,
"default": True
}
],
"postal_mail_enabled": True,
"sms_opt_out": True,
"restore_all_email": True,
"do_not_email": True
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
preferences: [
{
category_key: 'marketing',
channel: 'email',
enabled: true,
event_key: '*',
reset: true,
default: true
}
],
postal_mail_enabled: true,
sms_opt_out: true,
restore_all_email: true,
do_not_email: true
})
};
fetch('https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}', 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/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'preferences' => [
[
'category_key' => 'marketing',
'channel' => 'email',
'enabled' => true,
'event_key' => '*',
'reset' => true,
'default' => true
]
],
'postal_mail_enabled' => true,
'sms_opt_out' => true,
'restore_all_email' => true,
'do_not_email' => true
]),
CURLOPT_HTTPHEADER => [
"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/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}"
payload := strings.NewReader("{\n \"preferences\": [\n {\n \"category_key\": \"marketing\",\n \"channel\": \"email\",\n \"enabled\": true,\n \"event_key\": \"*\",\n \"reset\": true,\n \"default\": true\n }\n ],\n \"postal_mail_enabled\": true,\n \"sms_opt_out\": true,\n \"restore_all_email\": true,\n \"do_not_email\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}")
.header("Content-Type", "application/json")
.body("{\n \"preferences\": [\n {\n \"category_key\": \"marketing\",\n \"channel\": \"email\",\n \"enabled\": true,\n \"event_key\": \"*\",\n \"reset\": true,\n \"default\": true\n }\n ],\n \"postal_mail_enabled\": true,\n \"sms_opt_out\": true,\n \"restore_all_email\": true,\n \"do_not_email\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/frontend/donor/dashboard/notification-preferences/{client_id}/{program_id}/{session_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"preferences\": [\n {\n \"category_key\": \"marketing\",\n \"channel\": \"email\",\n \"enabled\": true,\n \"event_key\": \"*\",\n \"reset\": true,\n \"default\": true\n }\n ],\n \"postal_mail_enabled\": true,\n \"sms_opt_out\": true,\n \"restore_all_email\": true,\n \"do_not_email\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Notification preferences saved.",
"audience": "donor",
"catalog": [
{
"key": "marketing",
"label": "Example",
"description": "Example",
"criticality": "standard",
"requires_disable_warning": true,
"channels": [
"email"
],
"enabled": {},
"mappings": {
"novu_templates": [
"<string>"
],
"activity_actions": [
"<string>"
]
},
"events": [
{
"key": "Example",
"label": "Example",
"channels": [
"email"
],
"enabled": {},
"novu_workflow": "Example",
"mappings": {
"email_triggers": [
"<string>"
],
"novu_event_types": [
"<string>"
],
"novu_templates": [
"<string>"
],
"activity_actions": [
"<string>"
]
}
}
]
}
],
"communication": {
"email_categories": {},
"saved_email_categories": {},
"sms": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"saved_sms": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"postal_mail": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"saved_postal_mail": {
"enabled": true,
"events": {},
"partially_enabled": true,
"blocked_code": "category_opt_out",
"blocked_reason": "All donor email is turned off."
},
"do_not_email": true
}
}{
"message": "Unauthorized",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}