Send an event to a Loop (key in the URL)
curl --request POST \
--url https://api.reason.bot/webhooks/automations/{publicToken}/{key} \
--header 'Content-Type: application/json'import requests
url = "https://api.reason.bot/webhooks/automations/{publicToken}/{key}"
headers = {"Content-Type": "application/json"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'Content-Type': 'application/json'}};
fetch('https://api.reason.bot/webhooks/automations/{publicToken}/{key}', 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.reason.bot/webhooks/automations/{publicToken}/{key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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"
"net/http"
"io"
)
func main() {
url := "https://api.reason.bot/webhooks/automations/{publicToken}/{key}"
req, _ := http.NewRequest("POST", url, nil)
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.reason.bot/webhooks/automations/{publicToken}/{key}")
.header("Content-Type", "application/json")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reason.bot/webhooks/automations/{publicToken}/{key}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
response = http.request(request)
puts response.read_body{
"accepted": true,
"duplicate": true,
"event_id": "<string>",
"work_item_id": "<string>"
}Loops
Send an event to a Loop (key in the URL)
Send an event to a Loop with the key as the URL’s last path segment, for a sender that only takes a URL. Prefer the bearer header or a signature.
POST
/
webhooks
/
automations
/
{publicToken}
/
{key}
Send an event to a Loop (key in the URL)
curl --request POST \
--url https://api.reason.bot/webhooks/automations/{publicToken}/{key} \
--header 'Content-Type: application/json'import requests
url = "https://api.reason.bot/webhooks/automations/{publicToken}/{key}"
headers = {"Content-Type": "application/json"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'Content-Type': 'application/json'}};
fetch('https://api.reason.bot/webhooks/automations/{publicToken}/{key}', 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.reason.bot/webhooks/automations/{publicToken}/{key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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"
"net/http"
"io"
)
func main() {
url := "https://api.reason.bot/webhooks/automations/{publicToken}/{key}"
req, _ := http.NewRequest("POST", url, nil)
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.reason.bot/webhooks/automations/{publicToken}/{key}")
.header("Content-Type", "application/json")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reason.bot/webhooks/automations/{publicToken}/{key}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
response = http.request(request)
puts response.read_body{
"accepted": true,
"duplicate": true,
"event_id": "<string>",
"work_item_id": "<string>"
}Delivers an event to the Loop whose webhook this is. A Loop with a webhook wakes on each accepted event: the event opens a Session of its Reason, or continues the Session of earlier events with the same correlation key. The webhook URL and its key come back once, from the
createReasonLoop (or updateReasonLoop) call that adds the webhook.
This form carries the key as the URL’s last path segment, for a sender that only takes a URL. Prefer the bearer header or a signature where the sender allows one: a URL is easier to leak.
A retry with the same event id is answered 202 with duplicate: true and is not queued again. A paused or deleted Loop refuses events (409 automation_disabled).
Auth: the Loop’s webhook key (bearer, body signature, or URL segment) only; API keys are not acceptedHeaders
Path Parameters
Response
Accepted, or a duplicate of an event already accepted.

