Storage Layer
Introduction
Webhooked supports multiple storage backends for persisting webhook data. You can write to one or multiple backends simultaneously, with each backend supporting its own formatting and transformation.
Storage Context Variables
Variables available in security conditions:
.SpecName
Name of the current spec as defined in config
"user-events"
.SpecEntrypointURL
EntrypointURL of the current spec as defined in config
"/user-events"
.ConnID
Unique connection ID
123549841
.ConnTime
Connection established time
time.Time object 2025-08-20T21:10:00Z
.Host
Host header of request
"example.com"
.IsTLS
Whether request is HTTPS
true
.Method
HTTP method used
"POST"
.Payload
Raw request body
{"data": "value"}
.QueryArgs
Query parameters object
fasthttp.Args{"id":"123","token":"abc"}
.RemoteAddr
Remote Addr
"192.168.1.10:54321"
.RemoteIP
Remote network address
"192.168.1.1"
.RequestTime
Time when request was received
time.Time object 2025-08-20T21:10:00Z
.Request
Full fasthttp.Request object
&fasthttp.Request{...}
.URI
Request URI
"/webhooks/..."
.UserAgent
Client User-Agent header
"Mozilla/5.0 (X11; Linux x86_64)"
.StorageType
Type as defined in spec
"redis"
Storages Providers
Redis
storage:
- type: redis
specs:
host: localhost # Valuable - see doc "Sourcing (Valuable)" for more info
port: 6379 # Valuable - see doc "Sourcing (Valuable)" for more info
username: user # Valuable - see doc "Sourcing (Valuable)" for more info
password: pass # Valuable - see doc "Sourcing (Valuable)" for more info
database: 0 # integer
key: "webhooks:events" # stringhost
string
Host of the redis server
port
integer
Port of the redis server
username
string
Username to connect to redis
password
string
Password to connect to redis
database
integer
Database to use (default to 0)
key
string
Key used to store with RPush command
PostgreSQL
storage:
- type: postgres
specs:
databaseUrl: postgres://user:password@localhost:5432/webhooks?sslmode=disable
query: |
INSERT INTO webhook_events (name, payload, received_at)
VALUES (:name, :payload, NOW())
args:
name: "{{ .WebhookName }}"
payload: "{{ .Payload }}"databaseUrl
string
Database URL of the postgres server
query
string
The query to execute with named arguments
args
map
Map of naed arguments used in the query
RabbitMQ Storage
storage:
- type: rabbitmq
specs:
databaseUrl: amqp://user:password@localhost:5672/
queueName: webhook-events
maxAttempt: 10
durable: true
deleteWhenUnused: false
exclusive: false
noWait: false
exchange: webhooks
contentType: text
mandatory: false
immediate: falsedatabaseUrl
string
Database URL of the rabbitmq server
queueName
string
Name of the queue
maxAttempt
integer
Maximum retry attempts
durable
bool
Survive broker restart
deleteWhenUnused
bool
Don't delete when unused
exclusive
bool
Not exclusive to connection
noWait
bool
Wait for confirmation
exchange
string
Exchange to bind the queue
contentType
string
Content type for messages
mandatory
bool
Return message if not routable
immediate
bool
Deliver immediately or fail
IMPORTANT: Configuration of the queue and exchange must match your existing declaration. If no queue are present, webhooked try to defined it.
NoOp
NoOp storage is for testing and development where persistence isn't needed.
storage:
- type: noopStorage Formatting
Each storage can have its own data transformation.
storage:
# Raw JSON to Redis
- type: redis
specs: # ...
formatting:
templateString: "{{ .Payload }}"
# Structured data to RabbitMQ
- type: rabbitmq
specs: # ...
formatting:
templateString: |
{
"id": "{{ (fromJSON .Payload).id }}",
"type": "{{ (fromJSON .Payload).type }}",
"timestamp": "{{ now }}"
}Last updated