Create a webhook endpoint
curl --request POST \
--url https://client-backend.oktivo.com/api/v2/webhooks/endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"eventTypes": [
"<string>"
],
"name": "<string>",
"description": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>",
"enabled": true
}
],
"bodyTemplate": "<string>",
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"agentIds": [
"<string>"
],
"timeoutMs": 15500,
"retryOnFailure": true,
"maxRetries": 5
}
'import requests
url = "https://client-backend.oktivo.com/api/v2/webhooks/endpoints"
payload = {
"url": "<string>",
"eventTypes": ["<string>"],
"name": "<string>",
"description": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>",
"enabled": True
}
],
"bodyTemplate": "<string>",
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"agentIds": ["<string>"],
"timeoutMs": 15500,
"retryOnFailure": True,
"maxRetries": 5
}
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({
url: '<string>',
eventTypes: ['<string>'],
name: '<string>',
description: '<string>',
headers: [{key: '<string>', value: '<string>', enabled: true}],
bodyTemplate: '<string>',
conditions: [{field: '<string>', value: '<string>'}],
agentIds: ['<string>'],
timeoutMs: 15500,
retryOnFailure: true,
maxRetries: 5
})
};
fetch('https://client-backend.oktivo.com/api/v2/webhooks/endpoints', 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://client-backend.oktivo.com/api/v2/webhooks/endpoints",
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([
'url' => '<string>',
'eventTypes' => [
'<string>'
],
'name' => '<string>',
'description' => '<string>',
'headers' => [
[
'key' => '<string>',
'value' => '<string>',
'enabled' => true
]
],
'bodyTemplate' => '<string>',
'conditions' => [
[
'field' => '<string>',
'value' => '<string>'
]
],
'agentIds' => [
'<string>'
],
'timeoutMs' => 15500,
'retryOnFailure' => true,
'maxRetries' => 5
]),
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://client-backend.oktivo.com/api/v2/webhooks/endpoints"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"eventTypes\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"enabled\": true\n }\n ],\n \"bodyTemplate\": \"<string>\",\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"agentIds\": [\n \"<string>\"\n ],\n \"timeoutMs\": 15500,\n \"retryOnFailure\": true,\n \"maxRetries\": 5\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://client-backend.oktivo.com/api/v2/webhooks/endpoints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"eventTypes\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"enabled\": true\n }\n ],\n \"bodyTemplate\": \"<string>\",\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"agentIds\": [\n \"<string>\"\n ],\n \"timeoutMs\": 15500,\n \"retryOnFailure\": true,\n \"maxRetries\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://client-backend.oktivo.com/api/v2/webhooks/endpoints")
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 \"url\": \"<string>\",\n \"eventTypes\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"enabled\": true\n }\n ],\n \"bodyTemplate\": \"<string>\",\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"agentIds\": [\n \"<string>\"\n ],\n \"timeoutMs\": 15500,\n \"retryOnFailure\": true,\n \"maxRetries\": 5\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"requestId": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"data": "<unknown>",
"meta": {}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Webhooks
Create a webhook endpoint
The signing secret is returned once, in this response only.
POST
/
webhooks
/
endpoints
Create a webhook endpoint
curl --request POST \
--url https://client-backend.oktivo.com/api/v2/webhooks/endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"eventTypes": [
"<string>"
],
"name": "<string>",
"description": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>",
"enabled": true
}
],
"bodyTemplate": "<string>",
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"agentIds": [
"<string>"
],
"timeoutMs": 15500,
"retryOnFailure": true,
"maxRetries": 5
}
'import requests
url = "https://client-backend.oktivo.com/api/v2/webhooks/endpoints"
payload = {
"url": "<string>",
"eventTypes": ["<string>"],
"name": "<string>",
"description": "<string>",
"headers": [
{
"key": "<string>",
"value": "<string>",
"enabled": True
}
],
"bodyTemplate": "<string>",
"conditions": [
{
"field": "<string>",
"value": "<string>"
}
],
"agentIds": ["<string>"],
"timeoutMs": 15500,
"retryOnFailure": True,
"maxRetries": 5
}
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({
url: '<string>',
eventTypes: ['<string>'],
name: '<string>',
description: '<string>',
headers: [{key: '<string>', value: '<string>', enabled: true}],
bodyTemplate: '<string>',
conditions: [{field: '<string>', value: '<string>'}],
agentIds: ['<string>'],
timeoutMs: 15500,
retryOnFailure: true,
maxRetries: 5
})
};
fetch('https://client-backend.oktivo.com/api/v2/webhooks/endpoints', 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://client-backend.oktivo.com/api/v2/webhooks/endpoints",
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([
'url' => '<string>',
'eventTypes' => [
'<string>'
],
'name' => '<string>',
'description' => '<string>',
'headers' => [
[
'key' => '<string>',
'value' => '<string>',
'enabled' => true
]
],
'bodyTemplate' => '<string>',
'conditions' => [
[
'field' => '<string>',
'value' => '<string>'
]
],
'agentIds' => [
'<string>'
],
'timeoutMs' => 15500,
'retryOnFailure' => true,
'maxRetries' => 5
]),
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://client-backend.oktivo.com/api/v2/webhooks/endpoints"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"eventTypes\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"enabled\": true\n }\n ],\n \"bodyTemplate\": \"<string>\",\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"agentIds\": [\n \"<string>\"\n ],\n \"timeoutMs\": 15500,\n \"retryOnFailure\": true,\n \"maxRetries\": 5\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://client-backend.oktivo.com/api/v2/webhooks/endpoints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"eventTypes\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"enabled\": true\n }\n ],\n \"bodyTemplate\": \"<string>\",\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"agentIds\": [\n \"<string>\"\n ],\n \"timeoutMs\": 15500,\n \"retryOnFailure\": true,\n \"maxRetries\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://client-backend.oktivo.com/api/v2/webhooks/endpoints")
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 \"url\": \"<string>\",\n \"eventTypes\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"headers\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"enabled\": true\n }\n ],\n \"bodyTemplate\": \"<string>\",\n \"conditions\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"agentIds\": [\n \"<string>\"\n ],\n \"timeoutMs\": 15500,\n \"retryOnFailure\": true,\n \"maxRetries\": 5\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"requestId": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"data": "<unknown>",
"meta": {}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Headers
Body
application/json