Update Notification Preferences
Update the current user’s notification preferences.
Updates per-notification-type channel preferences (in-app, email). Preferences are managed server-side and sent to Knock with each notification.
curl --request PUT \
--url https://api.aspect.inc/users/me/notification-preferences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"comments": {
"comment_on_asset": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_mention": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_reply": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_thread_activity": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"collections": {
"collection_item_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"workspaces": {
"workspace_user_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
}
}
'import requests
url = "https://api.aspect.inc/users/me/notification-preferences"
payload = {
"comments": {
"comment_on_asset": {
"in_app": True,
"email": True,
"mobile_push": True
},
"comment_mention": {
"in_app": True,
"email": True,
"mobile_push": True
},
"comment_reply": {
"in_app": True,
"email": True,
"mobile_push": True
},
"comment_thread_activity": {
"in_app": True,
"email": True,
"mobile_push": True
}
},
"collections": { "collection_item_added": {
"in_app": True,
"email": True,
"mobile_push": True
} },
"workspaces": { "workspace_user_added": {
"in_app": True,
"email": True,
"mobile_push": True
} }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
comments: {
comment_on_asset: {in_app: true, email: true, mobile_push: true},
comment_mention: {in_app: true, email: true, mobile_push: true},
comment_reply: {in_app: true, email: true, mobile_push: true},
comment_thread_activity: {in_app: true, email: true, mobile_push: true}
},
collections: {collection_item_added: {in_app: true, email: true, mobile_push: true}},
workspaces: {workspace_user_added: {in_app: true, email: true, mobile_push: true}}
})
};
fetch('https://api.aspect.inc/users/me/notification-preferences', 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.aspect.inc/users/me/notification-preferences",
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([
'comments' => [
'comment_on_asset' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
],
'comment_mention' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
],
'comment_reply' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
],
'comment_thread_activity' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
]
],
'collections' => [
'collection_item_added' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
]
],
'workspaces' => [
'workspace_user_added' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
]
]
]),
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.aspect.inc/users/me/notification-preferences"
payload := strings.NewReader("{\n \"comments\": {\n \"comment_on_asset\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_mention\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_reply\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_thread_activity\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"collections\": {\n \"collection_item_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"workspaces\": {\n \"workspace_user_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.aspect.inc/users/me/notification-preferences")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"comments\": {\n \"comment_on_asset\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_mention\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_reply\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_thread_activity\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"collections\": {\n \"collection_item_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"workspaces\": {\n \"workspace_user_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aspect.inc/users/me/notification-preferences")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"comments\": {\n \"comment_on_asset\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_mention\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_reply\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_thread_activity\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"collections\": {\n \"collection_item_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"workspaces\": {\n \"workspace_user_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"comments": {
"comment_on_asset": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_mention": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_reply": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_thread_activity": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"collections": {
"collection_item_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"workspaces": {
"workspace_user_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
JWT in Authorization header. 'Bearer ' prefix optional.
Body
User notification preferences stored in the database.
Schema:
- comments: Per-type preferences for comment notifications
- collections: Per-type preferences for collection notifications
- workspaces: Per-type preferences for workspace notifications
Per-type notification preferences for comment-related notifications.
Each field controls which channels are enabled for that notification type.
Show child attributes
Show child attributes
Per-type notification preferences for collection-related notifications.
Each field controls which channels are enabled for that notification type.
Show child attributes
Show child attributes
Per-type notification preferences for workspace-related notifications.
Workspace invitations are transactional: the email channel for workspace_user_added is always on and cannot be disabled. The validator enforces this on every construction, so reads and API writes both keep email enabled. Only the in-app channel is user-toggleable.
Show child attributes
Show child attributes
Response
Successful Response
User notification preferences stored in the database.
Schema:
- comments: Per-type preferences for comment notifications
- collections: Per-type preferences for collection notifications
- workspaces: Per-type preferences for workspace notifications
Per-type notification preferences for comment-related notifications.
Each field controls which channels are enabled for that notification type.
Show child attributes
Show child attributes
Per-type notification preferences for collection-related notifications.
Each field controls which channels are enabled for that notification type.
Show child attributes
Show child attributes
Per-type notification preferences for workspace-related notifications.
Workspace invitations are transactional: the email channel for workspace_user_added is always on and cannot be disabled. The validator enforces this on every construction, so reads and API writes both keep email enabled. Only the in-app channel is user-toggleable.
Show child attributes
Show child attributes
curl --request PUT \
--url https://api.aspect.inc/users/me/notification-preferences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"comments": {
"comment_on_asset": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_mention": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_reply": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_thread_activity": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"collections": {
"collection_item_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"workspaces": {
"workspace_user_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
}
}
'import requests
url = "https://api.aspect.inc/users/me/notification-preferences"
payload = {
"comments": {
"comment_on_asset": {
"in_app": True,
"email": True,
"mobile_push": True
},
"comment_mention": {
"in_app": True,
"email": True,
"mobile_push": True
},
"comment_reply": {
"in_app": True,
"email": True,
"mobile_push": True
},
"comment_thread_activity": {
"in_app": True,
"email": True,
"mobile_push": True
}
},
"collections": { "collection_item_added": {
"in_app": True,
"email": True,
"mobile_push": True
} },
"workspaces": { "workspace_user_added": {
"in_app": True,
"email": True,
"mobile_push": True
} }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
comments: {
comment_on_asset: {in_app: true, email: true, mobile_push: true},
comment_mention: {in_app: true, email: true, mobile_push: true},
comment_reply: {in_app: true, email: true, mobile_push: true},
comment_thread_activity: {in_app: true, email: true, mobile_push: true}
},
collections: {collection_item_added: {in_app: true, email: true, mobile_push: true}},
workspaces: {workspace_user_added: {in_app: true, email: true, mobile_push: true}}
})
};
fetch('https://api.aspect.inc/users/me/notification-preferences', 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.aspect.inc/users/me/notification-preferences",
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([
'comments' => [
'comment_on_asset' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
],
'comment_mention' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
],
'comment_reply' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
],
'comment_thread_activity' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
]
],
'collections' => [
'collection_item_added' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
]
],
'workspaces' => [
'workspace_user_added' => [
'in_app' => true,
'email' => true,
'mobile_push' => true
]
]
]),
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.aspect.inc/users/me/notification-preferences"
payload := strings.NewReader("{\n \"comments\": {\n \"comment_on_asset\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_mention\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_reply\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_thread_activity\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"collections\": {\n \"collection_item_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"workspaces\": {\n \"workspace_user_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.aspect.inc/users/me/notification-preferences")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"comments\": {\n \"comment_on_asset\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_mention\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_reply\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_thread_activity\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"collections\": {\n \"collection_item_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"workspaces\": {\n \"workspace_user_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aspect.inc/users/me/notification-preferences")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"comments\": {\n \"comment_on_asset\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_mention\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_reply\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n },\n \"comment_thread_activity\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"collections\": {\n \"collection_item_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n },\n \"workspaces\": {\n \"workspace_user_added\": {\n \"in_app\": true,\n \"email\": true,\n \"mobile_push\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"comments": {
"comment_on_asset": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_mention": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_reply": {
"in_app": true,
"email": true,
"mobile_push": true
},
"comment_thread_activity": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"collections": {
"collection_item_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
},
"workspaces": {
"workspace_user_added": {
"in_app": true,
"email": true,
"mobile_push": true
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
