Toggle webhook source
curl --request POST \
--url https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle', 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.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"accountId": "<string>",
"knowledgeBaseId": "<string>",
"name": "<string>",
"enabled": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"steps": [
{
"name": "<string>",
"order": 123,
"url": "<string>",
"method": "GET",
"headers": [
{
"key": "<string>",
"value": "<string>"
}
],
"body": "<string>",
"extractions": [
{
"variableName": "<string>",
"jsonPath": "<string>",
"useAsContext": false
}
],
"fanOut": {
"sourcePath": "<string>",
"itemVariable": "item",
"rateLimit": {
"delayMs": 123
}
},
"retry": {
"maxAttempts": 0,
"initialDelayMs": 1000,
"maxDelayMs": 30000,
"backoffMultiplier": 2
},
"onError": "fail",
"timeoutMs": 123
}
],
"flowInputs": [
{
"name": "<string>",
"value": "<string>"
}
],
"url": "<string>",
"method": "<string>",
"headers": {},
"body": "<string>",
"auth": {},
"intervalMinutes": 123,
"timeoutMs": 123,
"lastTriggeredAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}Knowledge Bases
Toggle Webhook Source
Toggles a webhook source between enabled and disabled states.
Requires knowledge:upload permission.
POST
/
api
/
knowledge-bases
/
{id}
/
webhooks
/
{whId}
/
toggle
Toggle webhook source
curl --request POST \
--url https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle', 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.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.naturalead.ai/api/knowledge-bases/{id}/webhooks/{whId}/toggle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"accountId": "<string>",
"knowledgeBaseId": "<string>",
"name": "<string>",
"enabled": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"steps": [
{
"name": "<string>",
"order": 123,
"url": "<string>",
"method": "GET",
"headers": [
{
"key": "<string>",
"value": "<string>"
}
],
"body": "<string>",
"extractions": [
{
"variableName": "<string>",
"jsonPath": "<string>",
"useAsContext": false
}
],
"fanOut": {
"sourcePath": "<string>",
"itemVariable": "item",
"rateLimit": {
"delayMs": 123
}
},
"retry": {
"maxAttempts": 0,
"initialDelayMs": 1000,
"maxDelayMs": 30000,
"backoffMultiplier": 2
},
"onError": "fail",
"timeoutMs": 123
}
],
"flowInputs": [
{
"name": "<string>",
"value": "<string>"
}
],
"url": "<string>",
"method": "<string>",
"headers": {},
"body": "<string>",
"auth": {},
"intervalMinutes": 123,
"timeoutMs": 123,
"lastTriggeredAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}Authorizations
Bearer token using an API key (format nl_live_* or nl_test_*)
Response
Toggled webhook source
Unique identifier
Owning account ID
Parent knowledge base ID
Webhook source name
Whether the webhook source is active
Ordered list of execution steps
Show child attributes
Show child attributes
Input variables for the step flow
Show child attributes
Show child attributes
URL to fetch content from
HTTP method
HTTP headers
Show child attributes
Show child attributes
Request body
Authentication configuration
Polling interval in minutes
Request timeout in milliseconds
Timestamp of the last trigger