Create Note With Mention
Create a note mentioning a selected member. This operation is experimental.
Requires notes:write; finding the recipient first requires notes:read.
Use Selectable Team Members to select a recipient from the Post's channel. Replace the example serviceEntityId with the selected member's complete urn. See Notes for the full workflow.
mutation CreateNoteWithMention {
createCollaborationNote(input: {
subject: { postId: "YOUR_POST_ID" }
text: "@Alex please review the revised caption."
annotations: [{
type: mention
serviceEntityId: "SELECTED_MEMBER_URN"
content: "@Alex"
text: "@Alex"
indices: [0, 5]
}]
}) {
__typename
... on CreateCollaborationNoteSuccess {
edge {
node {
id
text
annotations { type serviceEntityId content text indices }
allowedActions
}
}
}
... on MutationError { message }
}
}
curl -X POST 'https://api.buffer.com' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{"query": "mutation CreateNoteWithMention {\n createCollaborationNote(input: {\n subject: { postId: \"YOUR_POST_ID\" }\n text: \"@Alex please review the revised caption.\"\n annotations: [{\n type: mention\n serviceEntityId: \"SELECTED_MEMBER_URN\"\n content: \"@Alex\"\n text: \"@Alex\"\n indices: [0, 5]\n }]\n }) {\n __typename\n ... on CreateCollaborationNoteSuccess {\n edge {\n node {\n id\n text\n annotations { type serviceEntityId content text indices }\n allowedActions\n }\n }\n }\n ... on MutationError { message }\n }\n}"}'
async function createNoteWithMention() {
const response = await fetch('https://api.buffer.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
},
body: JSON.stringify({
query: `
mutation CreateNoteWithMention {
createCollaborationNote(input: {
subject: { postId: "YOUR_POST_ID" }
text: "@Alex please review the revised caption."
annotations: [{
type: mention
serviceEntityId: "SELECTED_MEMBER_URN"
content: "@Alex"
text: "@Alex"
indices: [0, 5]
}]
}) {
__typename
... on CreateCollaborationNoteSuccess {
edge {
node {
id
text
annotations { type serviceEntityId content text indices }
allowedActions
}
}
}
... on MutationError { message }
}
}
`,
}),
});
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
}
createNoteWithMention();
import requests
query = """
mutation CreateNoteWithMention {
createCollaborationNote(input: {
subject: { postId: "YOUR_POST_ID" }
text: "@Alex please review the revised caption."
annotations: [{
type: mention
serviceEntityId: "SELECTED_MEMBER_URN"
content: "@Alex"
text: "@Alex"
indices: [0, 5]
}]
}) {
__typename
... on CreateCollaborationNoteSuccess {
edge {
node {
id
text
annotations { type serviceEntityId content text indices }
allowedActions
}
}
}
... on MutationError { message }
}
}
"""
response = requests.post(
"https://api.buffer.com",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
},
json={
"query": query,
},
)
data = response.json()
print(data)
<?php
$query = '
mutation CreateNoteWithMention {
createCollaborationNote(input: {
subject: { postId: "YOUR_POST_ID" }
text: "@Alex please review the revised caption."
annotations: [{
type: mention
serviceEntityId: "SELECTED_MEMBER_URN"
content: "@Alex"
text: "@Alex"
indices: [0, 5]
}]
}) {
__typename
... on CreateCollaborationNoteSuccess {
edge {
node {
id
text
annotations { type serviceEntityId content text indices }
allowedActions
}
}
}
... on MutationError { message }
}
}
';
$payload = [
'query' => $query,
];
$ch = curl_init('https://api.buffer.com');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);
For a channel-less draft, find recipients with organization scope and use { contentItemId: "YOUR_CONTENT_ITEM_ID" } as the subject. Update the annotation span when changing the text. Buffer rejects the entire write if any recipient cannot read the subject's Notes.