Create a webhook endpoint
Registers a new endpoint. The response includes the signing secret in the `secret` field **once** — save it to your environment, since Dolores stores only an encrypted form.
Authorization
AuthorizationRequiredBearer <token>Send your API key in the Authorization header on every request:
Authorization: Bearer sk_live_.... Keys are created in the admin UI under
Settings → API Keys and are project-scoped.
In: header
Request Body
application/jsonRequiredurlRequiredstring"uri"enabledbooleantrueevent_filtersarray<string>livemodebooleanTag this endpoint live or test. Defaults to true.
truelabelstringdescriptionstringResponse Body
Endpoint created. Includes plaintext secret (shown once).
TypeScript Definitions
Use the response body type in TypeScript.
idRequiredstringobjectRequiredstring"webhook_endpoint"urlRequiredstringHTTPS URL Dolores POSTs events to.
"uri"enabledRequiredbooleanevent_filtersarray<string>Event types or wildcards to subscribe to. Empty array (or omitted)
subscribes to all events. Supported prefixes: appointment.,
customer., session.. Wildcards: appointment.*.
@minItems 0
livemodeRequiredbooleanlabelstring | null | nulldescriptionstring | null | nullsecret_prefixstringFirst 13 chars of the signing secret (e.g. whsec_8fK2x). Shown for identification only.
secretstringPlaintext signing secret. Only returned once on create and rotate.
Use it to verify the Dolores-Signature header on incoming deliveries.
created_atRequiredstring"date-time"updated_atRequiredstring"date-time"Validation failed.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectcurl -X POST "https://app.meetdolores.ai/v1/webhook_endpoints" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.example.com/dolores/webhook",
"event_filters": [
"appointment.*"
],
"label": "Production appointments"
}'const body = JSON.stringify({
"url": "https://api.example.com/dolores/webhook",
"event_filters": [
"appointment.*"
],
"label": "Production appointments"
})
fetch("https://app.meetdolores.ai/v1/webhook_endpoints", {
headers: {
"Authorization": "Bearer <token>"
},
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://app.meetdolores.ai/v1/webhook_endpoints"
body := strings.NewReader(`{
"url": "https://api.example.com/dolores/webhook",
"event_filters": [
"appointment.*"
],
"label": "Production appointments"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://app.meetdolores.ai/v1/webhook_endpoints"
body = {
"url": "https://api.example.com/dolores/webhook",
"event_filters": [
"appointment.*"
],
"label": "Production appointments"
}
response = requests.request("POST", url, json = body, headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
})
print(response.text)require 'net/http'
require 'json'
require 'uri'
uri = URI('https://app.meetdolores.ai/v1/webhook_endpoints')
req = Net::HTTP::Post.new(uri, {
'Authorization' => "Bearer #{ENV['DOLORES_API_KEY']}",
'Content-Type' => 'application/json',
})
req.body = {
url: "https://api.example.com/dolores/webhook",
event_filters: ["appointment.*"],
label: "Production appointments"
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.body<?php
$ch = curl_init('https://app.meetdolores.ai/v1/webhook_endpoints');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DOLORES_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://api.example.com/dolores/webhook',
'event_filters' => ['appointment.*'],
'label' => 'Production appointments'
]),
]);
echo curl_exec($ch);{
"id": "whk_01HXY7P3K9ABCDEFGHJKMNPQRS",
"object": "webhook_endpoint",
"url": "http://example.com",
"enabled": true,
"event_filters": [
"appointment.*"
],
"livemode": true,
"label": "string",
"description": "string",
"secret_prefix": "string",
"secret": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}{
"error": {
"type": "invalid_request_error",
"code": "phone_invalid_format",
"message": "Phone must be in E.164 format (e.g. +15551234567).",
"param": "phone",
"request_id": "req_01HXY7P3K9ABCDEFGHJKMNPQRS"
}
}