curl --request POST \
--url https://api.nlbs.ai/webhooks/endpoints \
--header 'Content-Type: application/json' \
--data '
{
"name": "Frontend callback",
"subscribed_events": [
"webhook.test"
],
"url": "https://example.com/webhooks/nllabs"
}
'import requests
url = "https://api.nlbs.ai/webhooks/endpoints"
payload = {
"name": "Frontend callback",
"subscribed_events": ["webhook.test"],
"url": "https://example.com/webhooks/nllabs"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Frontend callback',
subscribed_events: ['webhook.test'],
url: 'https://example.com/webhooks/nllabs'
})
};
fetch('https://api.nlbs.ai/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://api.nlbs.ai/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([
'name' => 'Frontend callback',
'subscribed_events' => [
'webhook.test'
],
'url' => 'https://example.com/webhooks/nllabs'
]),
CURLOPT_HTTPHEADER => [
"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.nlbs.ai/webhooks/endpoints"
payload := strings.NewReader("{\n \"name\": \"Frontend callback\",\n \"subscribed_events\": [\n \"webhook.test\"\n ],\n \"url\": \"https://example.com/webhooks/nllabs\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.nlbs.ai/webhooks/endpoints")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Frontend callback\",\n \"subscribed_events\": [\n \"webhook.test\"\n ],\n \"url\": \"https://example.com/webhooks/nllabs\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nlbs.ai/webhooks/endpoints")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Frontend callback\",\n \"subscribed_events\": [\n \"webhook.test\"\n ],\n \"url\": \"https://example.com/webhooks/nllabs\"\n}"
response = http.request(request)
puts response.read_body{
"consecutive_failures": 123,
"created_at": "2023-11-07T05:31:56Z",
"disabled_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"last_success_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"secret": "<string>",
"status": "active",
"subscribed_events": [
"webhook.test"
],
"updated_at": "2023-11-07T05:31:56Z",
"url": "<string>",
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": "Resource not found."
}{
"detail": "Resource not found."
}Criar endpoint de webhook
Registra um novo endpoint de webhook para o cliente autenticado. O segredo de assinatura em texto puro é retornado apenas nesta resposta.
curl --request POST \
--url https://api.nlbs.ai/webhooks/endpoints \
--header 'Content-Type: application/json' \
--data '
{
"name": "Frontend callback",
"subscribed_events": [
"webhook.test"
],
"url": "https://example.com/webhooks/nllabs"
}
'import requests
url = "https://api.nlbs.ai/webhooks/endpoints"
payload = {
"name": "Frontend callback",
"subscribed_events": ["webhook.test"],
"url": "https://example.com/webhooks/nllabs"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Frontend callback',
subscribed_events: ['webhook.test'],
url: 'https://example.com/webhooks/nllabs'
})
};
fetch('https://api.nlbs.ai/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://api.nlbs.ai/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([
'name' => 'Frontend callback',
'subscribed_events' => [
'webhook.test'
],
'url' => 'https://example.com/webhooks/nllabs'
]),
CURLOPT_HTTPHEADER => [
"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.nlbs.ai/webhooks/endpoints"
payload := strings.NewReader("{\n \"name\": \"Frontend callback\",\n \"subscribed_events\": [\n \"webhook.test\"\n ],\n \"url\": \"https://example.com/webhooks/nllabs\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.nlbs.ai/webhooks/endpoints")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Frontend callback\",\n \"subscribed_events\": [\n \"webhook.test\"\n ],\n \"url\": \"https://example.com/webhooks/nllabs\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nlbs.ai/webhooks/endpoints")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Frontend callback\",\n \"subscribed_events\": [\n \"webhook.test\"\n ],\n \"url\": \"https://example.com/webhooks/nllabs\"\n}"
response = http.request(request)
puts response.read_body{
"consecutive_failures": 123,
"created_at": "2023-11-07T05:31:56Z",
"disabled_at": "2023-11-07T05:31:56Z",
"last_failure_at": "2023-11-07T05:31:56Z",
"last_success_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"secret": "<string>",
"status": "active",
"subscribed_events": [
"webhook.test"
],
"updated_at": "2023-11-07T05:31:56Z",
"url": "<string>",
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": "Resource not found."
}{
"detail": "Resource not found."
}Body
Nome legível do endpoint de webhook.
1 - 128"Frontend callback"
Tipos de evento de webhook entregues a este endpoint.
1webhook.test, adverse_media.completed, adverse_media.failed ["webhook.test"]
URL de destino HTTPS que vai receber os eventos de webhook.
1 - 2048"https://example.com/webhooks/nllabs"
Response
Successful Response
Contagem atual de falhas de entrega consecutivas.
Timestamp de criação do endpoint.
Timestamp de quando o endpoint foi desativado.
Timestamp da última entrega com falha.
Timestamp da última entrega bem-sucedida.
Nome legível do endpoint de webhook.
Segredo de assinatura em texto puro, retornado só uma vez.
Status do ciclo de vida do endpoint.
active, disabled Tipos de evento assinados.
webhook.test, adverse_media.completed, adverse_media.failed Timestamp da última atualização do endpoint.
URL de destino.
UUID do endpoint de webhook.

