Skip to main content

Overview

Send data to HTTP endpoints as JSON payloads.

Configuration

sinks:
  my_webhook_sink:
    type: webhook
    from: my_transform
    url: https://api.example.com/endpoint
    secret_name: MY_WEBHOOK_SECRET
    one_row_per_request: true | false
    headers:
      Content-Type: application/json

Parameters

type
string
required
Must be webhook
from
string
required
The transform or source to read data from
url
string
required
The HTTP endpoint URL to send data to
secret_name
string
The name of a Goldsky httpauth secret containing an authentication header to include with each request. See secret creation below.
one_row_per_request
boolean
default:"false"
If true, sends each row individually. If false, sends batches of rows.
headers
object
Additional HTTP headers to include with each request.

Request Format

Data is sent as JSON: Single row (one_row_per_request: true):
{
  "id": "abc123",
  "address": "0x...",
  "value": "1000000",
  "timestamp": "2024-01-01T00:00:00Z"
}
Batch (one_row_per_request: false):
[
  {
    "id": "abc123",
    "address": "0x...",
    "value": "1000000"
  },
  {
    "id": "def456",
    "address": "0x...",
    "value": "2000000"
  }
]

Secret creation

To securely authenticate with your webhook endpoint, create an httpauth secret using the Goldsky CLI:
goldsky secret create
Select httpauth as the secret type and follow the prompts to provide a header name and value. For example, you might set the header name to Authorization and the value to Bearer <your-token>.
Secret names can only contain alphanumeric characters, underscores (_), and hyphens (-).
Then reference the secret in your webhook sink configuration:
sinks:
  my_webhook_sink:
    type: webhook
    from: my_transform
    url: https://api.example.com/endpoint
    secret_name: MY_WEBHOOK_SECRET
The authentication header is automatically included with every request sent to the webhook endpoint.

Example: Send High-Value Transfers to API

transforms:
  high_value_transfers:
    type: sql
    primary_key: id
    sql: |
      SELECT *
      FROM erc20_transfers
      WHERE CAST(value AS DECIMAL) > 1000000000000000000000

sinks:
  webhook_alerts:
    type: webhook
    from: high_value_transfers
    url: https://alerts.example.com/high-value-transfer
    secret_name: ALERTS_API_SECRET
    one_row_per_request: true
The webhook sink includes retry logic with exponential backoff for transient failures. Configure timeouts on your endpoint accordingly.