Create Notification Rule
curl --request POST \
--url https://api.vela.dev/v1/apps/{appId}/notification-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Alert on large payment failure",
"eventName": "payment.failed",
"enabled": true,
"conditions": [
{
"id": "cond-1",
"field": "amountCents",
"operator": "greater_than",
"value": 10000
}
],
"actions": [
{
"id": "action-1",
"destinationId": "dest-uuid",
"channel": "slack",
"enabled": true
}
]
}
'import requests
url = "https://api.vela.dev/v1/apps/{appId}/notification-rules"
payload = {
"name": "Alert on large payment failure",
"eventName": "payment.failed",
"enabled": True,
"conditions": [
{
"id": "cond-1",
"field": "amountCents",
"operator": "greater_than",
"value": 10000
}
],
"actions": [
{
"id": "action-1",
"destinationId": "dest-uuid",
"channel": "slack",
"enabled": True
}
]
}
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({
name: 'Alert on large payment failure',
eventName: 'payment.failed',
enabled: true,
conditions: [{id: 'cond-1', field: 'amountCents', operator: 'greater_than', value: 10000}],
actions: [{id: 'action-1', destinationId: 'dest-uuid', channel: 'slack', enabled: true}]
})
};
fetch('https://api.vela.dev/v1/apps/{appId}/notification-rules', 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.vela.dev/v1/apps/{appId}/notification-rules",
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([
'name' => 'Alert on large payment failure',
'eventName' => 'payment.failed',
'enabled' => true,
'conditions' => [
[
'id' => 'cond-1',
'field' => 'amountCents',
'operator' => 'greater_than',
'value' => 10000
]
],
'actions' => [
[
'id' => 'action-1',
'destinationId' => 'dest-uuid',
'channel' => 'slack',
'enabled' => 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.vela.dev/v1/apps/{appId}/notification-rules"
payload := strings.NewReader("{\n \"name\": \"Alert on large payment failure\",\n \"eventName\": \"payment.failed\",\n \"enabled\": true,\n \"conditions\": [\n {\n \"id\": \"cond-1\",\n \"field\": \"amountCents\",\n \"operator\": \"greater_than\",\n \"value\": 10000\n }\n ],\n \"actions\": [\n {\n \"id\": \"action-1\",\n \"destinationId\": \"dest-uuid\",\n \"channel\": \"slack\",\n \"enabled\": true\n }\n ]\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.vela.dev/v1/apps/{appId}/notification-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Alert on large payment failure\",\n \"eventName\": \"payment.failed\",\n \"enabled\": true,\n \"conditions\": [\n {\n \"id\": \"cond-1\",\n \"field\": \"amountCents\",\n \"operator\": \"greater_than\",\n \"value\": 10000\n }\n ],\n \"actions\": [\n {\n \"id\": \"action-1\",\n \"destinationId\": \"dest-uuid\",\n \"channel\": \"slack\",\n \"enabled\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vela.dev/v1/apps/{appId}/notification-rules")
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 \"name\": \"Alert on large payment failure\",\n \"eventName\": \"payment.failed\",\n \"enabled\": true,\n \"conditions\": [\n {\n \"id\": \"cond-1\",\n \"field\": \"amountCents\",\n \"operator\": \"greater_than\",\n \"value\": 10000\n }\n ],\n \"actions\": [\n {\n \"id\": \"action-1\",\n \"destinationId\": \"dest-uuid\",\n \"channel\": \"slack\",\n \"enabled\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "rule-uuid",
"appId": "app-uuid",
"name": "Alert on large payment failure",
"eventName": "payment.failed",
"conditions": [
{
"id": "cond-1",
"field": "amountCents",
"operator": "greater_than",
"value": 10000
}
],
"actions": [
{
"id": "action-1",
"destinationId": "dest-uuid",
"channel": "slack",
"target": null,
"enabled": true
}
],
"enabled": true,
"lastTriggeredAt": null,
"triggerCount": 0,
"createdAt": "2024-06-01T12:00:00.000Z"
}Notification Rules
Create Notification Rule
Creates a new notification rule.
POST
/
apps
/
{appId}
/
notification-rules
Create Notification Rule
curl --request POST \
--url https://api.vela.dev/v1/apps/{appId}/notification-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Alert on large payment failure",
"eventName": "payment.failed",
"enabled": true,
"conditions": [
{
"id": "cond-1",
"field": "amountCents",
"operator": "greater_than",
"value": 10000
}
],
"actions": [
{
"id": "action-1",
"destinationId": "dest-uuid",
"channel": "slack",
"enabled": true
}
]
}
'import requests
url = "https://api.vela.dev/v1/apps/{appId}/notification-rules"
payload = {
"name": "Alert on large payment failure",
"eventName": "payment.failed",
"enabled": True,
"conditions": [
{
"id": "cond-1",
"field": "amountCents",
"operator": "greater_than",
"value": 10000
}
],
"actions": [
{
"id": "action-1",
"destinationId": "dest-uuid",
"channel": "slack",
"enabled": True
}
]
}
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({
name: 'Alert on large payment failure',
eventName: 'payment.failed',
enabled: true,
conditions: [{id: 'cond-1', field: 'amountCents', operator: 'greater_than', value: 10000}],
actions: [{id: 'action-1', destinationId: 'dest-uuid', channel: 'slack', enabled: true}]
})
};
fetch('https://api.vela.dev/v1/apps/{appId}/notification-rules', 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.vela.dev/v1/apps/{appId}/notification-rules",
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([
'name' => 'Alert on large payment failure',
'eventName' => 'payment.failed',
'enabled' => true,
'conditions' => [
[
'id' => 'cond-1',
'field' => 'amountCents',
'operator' => 'greater_than',
'value' => 10000
]
],
'actions' => [
[
'id' => 'action-1',
'destinationId' => 'dest-uuid',
'channel' => 'slack',
'enabled' => 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.vela.dev/v1/apps/{appId}/notification-rules"
payload := strings.NewReader("{\n \"name\": \"Alert on large payment failure\",\n \"eventName\": \"payment.failed\",\n \"enabled\": true,\n \"conditions\": [\n {\n \"id\": \"cond-1\",\n \"field\": \"amountCents\",\n \"operator\": \"greater_than\",\n \"value\": 10000\n }\n ],\n \"actions\": [\n {\n \"id\": \"action-1\",\n \"destinationId\": \"dest-uuid\",\n \"channel\": \"slack\",\n \"enabled\": true\n }\n ]\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.vela.dev/v1/apps/{appId}/notification-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Alert on large payment failure\",\n \"eventName\": \"payment.failed\",\n \"enabled\": true,\n \"conditions\": [\n {\n \"id\": \"cond-1\",\n \"field\": \"amountCents\",\n \"operator\": \"greater_than\",\n \"value\": 10000\n }\n ],\n \"actions\": [\n {\n \"id\": \"action-1\",\n \"destinationId\": \"dest-uuid\",\n \"channel\": \"slack\",\n \"enabled\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vela.dev/v1/apps/{appId}/notification-rules")
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 \"name\": \"Alert on large payment failure\",\n \"eventName\": \"payment.failed\",\n \"enabled\": true,\n \"conditions\": [\n {\n \"id\": \"cond-1\",\n \"field\": \"amountCents\",\n \"operator\": \"greater_than\",\n \"value\": 10000\n }\n ],\n \"actions\": [\n {\n \"id\": \"action-1\",\n \"destinationId\": \"dest-uuid\",\n \"channel\": \"slack\",\n \"enabled\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "rule-uuid",
"appId": "app-uuid",
"name": "Alert on large payment failure",
"eventName": "payment.failed",
"conditions": [
{
"id": "cond-1",
"field": "amountCents",
"operator": "greater_than",
"value": 10000
}
],
"actions": [
{
"id": "action-1",
"destinationId": "dest-uuid",
"channel": "slack",
"target": null,
"enabled": true
}
],
"enabled": true,
"lastTriggeredAt": null,
"triggerCount": 0,
"createdAt": "2024-06-01T12:00:00.000Z"
}Authorizations
Client secret for management API access. Format: vela_cs_...
Path Parameters
App UUID or slug
Body
application/json
Response
201 - application/json
Rule created
Rule identifier
Rule display name
Event name to watch
Conditions to evaluate (empty = trigger on all)
Show child attributes
Show child attributes
Delivery actions
Show child attributes
Show child attributes
⌘I