curl --request POST \
--url https://api.neoagent.io/public-api/end-user-notifications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_company_ids": [
"<string>"
],
"idempotency_key": "<string>",
"message": "<string>",
"recipients": "all",
"only_recent_chatters": false
}
'import requests
url = "https://api.neoagent.io/public-api/end-user-notifications"
payload = {
"end_company_ids": ["<string>"],
"idempotency_key": "<string>",
"message": "<string>",
"recipients": "all",
"only_recent_chatters": False
}
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({
end_company_ids: ['<string>'],
idempotency_key: '<string>',
message: '<string>',
recipients: 'all',
only_recent_chatters: false
})
};
fetch('https://api.neoagent.io/public-api/end-user-notifications', 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.neoagent.io/public-api/end-user-notifications",
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([
'end_company_ids' => [
'<string>'
],
'idempotency_key' => '<string>',
'message' => '<string>',
'recipients' => 'all',
'only_recent_chatters' => false
]),
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.neoagent.io/public-api/end-user-notifications"
payload := strings.NewReader("{\n \"end_company_ids\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"message\": \"<string>\",\n \"recipients\": \"all\",\n \"only_recent_chatters\": false\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.neoagent.io/public-api/end-user-notifications")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_company_ids\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"message\": \"<string>\",\n \"recipients\": \"all\",\n \"only_recent_chatters\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neoagent.io/public-api/end-user-notifications")
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 \"end_company_ids\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"message\": \"<string>\",\n \"recipients\": \"all\",\n \"only_recent_chatters\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"created_at": "2023-11-07T05:31:56Z",
"end_company_ids": [
"<string>"
],
"failed_count": 123,
"finished_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"message": "<string>",
"not_reachable_count": 123,
"only_recent_chatters": true,
"picked_people_count": 123,
"recipients_total": 123,
"sent_by": "<string>",
"sent_count": 123,
"started_at": "2023-11-07T05:31:56Z",
"state": "QUEUED"
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timings_ms": {},
"pagination": {
"has_more": true,
"next_cursor": "<string>"
},
"warnings": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Send a notification to end users
Queues one message to many end users through the workspace’s end-user Teams app, and returns at once with state QUEUED; read progress with GET /public-api/end-user-notifications/{id}. end_company_ids null sends to everyone the app reaches (as the reach with no companies). recipients is "all" or the user_ids from the reach with include_people=true; a picked person the app cannot reach is recorded NOT_REACHABLE, and a pick with more than 50 such people is refused with 400. message is markdown, up to 4,000 characters. Each company gets at most 25 notices a minute, so a large send takes minutes. A reply from an end user is a normal chat turn and bills as one. idempotency_key (1 to 200 characters) is new for each notification: a request repeated with the same key returns the first notification and sends nothing again. 400 with what to change when the workspace has no active end-user Teams app, another notification is still sending, or the request is out of bounds. 429 after 20 new sends in an hour. Needs an admin or owner, or a member an admin gave the Send end-user notifications permission, else 403 insufficient_scope. A triggered or scheduled agent run, with no person behind it, gets 403 too.
curl --request POST \
--url https://api.neoagent.io/public-api/end-user-notifications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_company_ids": [
"<string>"
],
"idempotency_key": "<string>",
"message": "<string>",
"recipients": "all",
"only_recent_chatters": false
}
'import requests
url = "https://api.neoagent.io/public-api/end-user-notifications"
payload = {
"end_company_ids": ["<string>"],
"idempotency_key": "<string>",
"message": "<string>",
"recipients": "all",
"only_recent_chatters": False
}
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({
end_company_ids: ['<string>'],
idempotency_key: '<string>',
message: '<string>',
recipients: 'all',
only_recent_chatters: false
})
};
fetch('https://api.neoagent.io/public-api/end-user-notifications', 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.neoagent.io/public-api/end-user-notifications",
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([
'end_company_ids' => [
'<string>'
],
'idempotency_key' => '<string>',
'message' => '<string>',
'recipients' => 'all',
'only_recent_chatters' => false
]),
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.neoagent.io/public-api/end-user-notifications"
payload := strings.NewReader("{\n \"end_company_ids\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"message\": \"<string>\",\n \"recipients\": \"all\",\n \"only_recent_chatters\": false\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.neoagent.io/public-api/end-user-notifications")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_company_ids\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"message\": \"<string>\",\n \"recipients\": \"all\",\n \"only_recent_chatters\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neoagent.io/public-api/end-user-notifications")
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 \"end_company_ids\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"message\": \"<string>\",\n \"recipients\": \"all\",\n \"only_recent_chatters\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"created_at": "2023-11-07T05:31:56Z",
"end_company_ids": [
"<string>"
],
"failed_count": 123,
"finished_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"message": "<string>",
"not_reachable_count": 123,
"only_recent_chatters": true,
"picked_people_count": 123,
"recipients_total": 123,
"sent_by": "<string>",
"sent_count": 123,
"started_at": "2023-11-07T05:31:56Z",
"state": "QUEUED"
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timings_ms": {},
"pagination": {
"has_more": true,
"next_cursor": "<string>"
},
"warnings": [
"<string>"
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Authorizations
Authorization: Bearer <token> where <token> is either a neo_sk_<env>_<secret> API key (service account) or a Microsoft Entra ID access token (dashboard user).
