curl --request PUT \
--url https://app.kosli.com/api/v2/notification-config/{org}/{notification_type} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targets": [
{
"webhook": "<string>",
"type": "SLACK",
"last_success_at": 123,
"last_failure_at": 123,
"context": {
"channel_id": "<string>",
"channel_name": "<string>",
"team_id": "<string>"
}
}
]
}
'import requests
url = "https://app.kosli.com/api/v2/notification-config/{org}/{notification_type}"
payload = { "targets": [
{
"webhook": "<string>",
"type": "SLACK",
"last_success_at": 123,
"last_failure_at": 123,
"context": {
"channel_id": "<string>",
"channel_name": "<string>",
"team_id": "<string>"
}
}
] }
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({
targets: [
{
webhook: '<string>',
type: 'SLACK',
last_success_at: 123,
last_failure_at: 123,
context: {channel_id: '<string>', channel_name: '<string>', team_id: '<string>'}
}
]
})
};
fetch('https://app.kosli.com/api/v2/notification-config/{org}/{notification_type}', 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://app.kosli.com/api/v2/notification-config/{org}/{notification_type}",
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([
'targets' => [
[
'webhook' => '<string>',
'type' => 'SLACK',
'last_success_at' => 123,
'last_failure_at' => 123,
'context' => [
'channel_id' => '<string>',
'channel_name' => '<string>',
'team_id' => '<string>'
]
]
]
]),
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://app.kosli.com/api/v2/notification-config/{org}/{notification_type}"
payload := strings.NewReader("{\n \"targets\": [\n {\n \"webhook\": \"<string>\",\n \"type\": \"SLACK\",\n \"last_success_at\": 123,\n \"last_failure_at\": 123,\n \"context\": {\n \"channel_id\": \"<string>\",\n \"channel_name\": \"<string>\",\n \"team_id\": \"<string>\"\n }\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://app.kosli.com/api/v2/notification-config/{org}/{notification_type}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targets\": [\n {\n \"webhook\": \"<string>\",\n \"type\": \"SLACK\",\n \"last_success_at\": 123,\n \"last_failure_at\": 123,\n \"context\": {\n \"channel_id\": \"<string>\",\n \"channel_name\": \"<string>\",\n \"team_id\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/notification-config/{org}/{notification_type}")
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 \"targets\": [\n {\n \"webhook\": \"<string>\",\n \"type\": \"SLACK\",\n \"last_success_at\": 123,\n \"last_failure_at\": 123,\n \"context\": {\n \"channel_id\": \"<string>\",\n \"channel_name\": \"<string>\",\n \"team_id\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"notification_type": "api_key_expiry",
"scope": "<string>",
"targets": [
{
"type": "SLACK",
"webhook": "<string>"
}
],
"detection": {},
"last_notified_at": 123,
"last_failure": {
"failed_at": 123,
"error": "<string>"
}
}{
"errors": {
"email": "Field must be a valid email address",
"name": "Field cannot be empty"
},
"message": "Input payload validation failed"
}Create or update notification configuration
Set where an org sends one kind of notification Kosli raises itself.
The targets replace the recipients Kosli would otherwise derive. Admins only.
curl --request PUT \
--url https://app.kosli.com/api/v2/notification-config/{org}/{notification_type} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targets": [
{
"webhook": "<string>",
"type": "SLACK",
"last_success_at": 123,
"last_failure_at": 123,
"context": {
"channel_id": "<string>",
"channel_name": "<string>",
"team_id": "<string>"
}
}
]
}
'import requests
url = "https://app.kosli.com/api/v2/notification-config/{org}/{notification_type}"
payload = { "targets": [
{
"webhook": "<string>",
"type": "SLACK",
"last_success_at": 123,
"last_failure_at": 123,
"context": {
"channel_id": "<string>",
"channel_name": "<string>",
"team_id": "<string>"
}
}
] }
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({
targets: [
{
webhook: '<string>',
type: 'SLACK',
last_success_at: 123,
last_failure_at: 123,
context: {channel_id: '<string>', channel_name: '<string>', team_id: '<string>'}
}
]
})
};
fetch('https://app.kosli.com/api/v2/notification-config/{org}/{notification_type}', 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://app.kosli.com/api/v2/notification-config/{org}/{notification_type}",
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([
'targets' => [
[
'webhook' => '<string>',
'type' => 'SLACK',
'last_success_at' => 123,
'last_failure_at' => 123,
'context' => [
'channel_id' => '<string>',
'channel_name' => '<string>',
'team_id' => '<string>'
]
]
]
]),
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://app.kosli.com/api/v2/notification-config/{org}/{notification_type}"
payload := strings.NewReader("{\n \"targets\": [\n {\n \"webhook\": \"<string>\",\n \"type\": \"SLACK\",\n \"last_success_at\": 123,\n \"last_failure_at\": 123,\n \"context\": {\n \"channel_id\": \"<string>\",\n \"channel_name\": \"<string>\",\n \"team_id\": \"<string>\"\n }\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://app.kosli.com/api/v2/notification-config/{org}/{notification_type}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targets\": [\n {\n \"webhook\": \"<string>\",\n \"type\": \"SLACK\",\n \"last_success_at\": 123,\n \"last_failure_at\": 123,\n \"context\": {\n \"channel_id\": \"<string>\",\n \"channel_name\": \"<string>\",\n \"team_id\": \"<string>\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/notification-config/{org}/{notification_type}")
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 \"targets\": [\n {\n \"webhook\": \"<string>\",\n \"type\": \"SLACK\",\n \"last_success_at\": 123,\n \"last_failure_at\": 123,\n \"context\": {\n \"channel_id\": \"<string>\",\n \"channel_name\": \"<string>\",\n \"team_id\": \"<string>\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"notification_type": "api_key_expiry",
"scope": "<string>",
"targets": [
{
"type": "SLACK",
"webhook": "<string>"
}
],
"detection": {},
"last_notified_at": 123,
"last_failure": {
"failed_at": 123,
"error": "<string>"
}
}{
"errors": {
"email": "Field must be a valid email address",
"name": "Field cannot be empty"
},
"message": "Input payload validation failed"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
A kind of notification a customer can configure.
A new kind is a new member here, not a new field or a new collection.
api_key_expiry Body
Where notifications of this type go, replacing the recipients Kosli would otherwise derive. At least one target: delete the configuration instead to restore the derived recipients.
1- SlackActionTarget
- WebhookActionTarget
- EmailActionTarget
Show child attributes
Show child attributes
Response
Successful Response
The kind of notification this configuration applies to
api_key_expiry The entity the configuration applies to, or null for the whole org
Where notifications of this type go. Empty when the org has not configured any, in which case Kosli derives the recipients.
- SlackNotificationTargetResponse
- WebhookNotificationTargetResponse
- EmailNotificationTargetResponse
Show child attributes
Show child attributes
What counts as a condition, for the types that have one
When a notification of this type was last sent for the org, as epoch seconds, or null if none has been
The most recent failed delivery, when nothing has been sent since it; null otherwise
Show child attributes
Show child attributes