Adios
← WORKFLOWS / WEBHOOK

Record weather when a station sends a webhook.

Receive a station’s JSON over HTTPS and write its temperature and humidity to the same table as scheduled API readings.

THE FLOW

From trigger to outcome.

Each row can be traced to the station that sent it.

  1. 01 →

    Receive

    The station sends a POST with its own shared secret.

  2. 02 →

    Extract

    Read the station timestamp and both measurements from the JSON body.

  3. 03 →

    Store

    The workflow labels each row station:madrid-rooftop.

USE THIS RECIPE

Your workflow,
in YAML.

  • Create the shared weather_readings table using the setup guide.
  • Set DATABASE_DSN and configure the public hostname for your workflow.
  • Configure the sender to pass STATION_WEBHOOK_SECRET in the X-Workflow-Secret header.

Create the table and test the recipes →

Configure secret references →

Copy or download the manifest, configure your values, and add it through Workflows or your AI workspace. Opening the console does not create or enable a workflow.

  1. Parse requests
  2. Query databases
receive-weather-webhook.yaml
Download
name: Receive Madrid rooftop weather
enabled: true
triggers:
  - type: webhook
    event: weather.observed
    public: true
    public_hosts: [hooks.example.com]
    public_path_pattern: /hooks/weather/madrid-rooftop
    public_methods: [POST]
    public_secret_ref: secret://STATION_WEBHOOK_SECRET
    response_mode: queued_json

steps:
  - step_id: reading
    kind: request-parser
    command:
      extract:
        time: .request.body.timestamp
        temp_c: .request.body.temperature_c
        humidity_pct: .request.body.humidity_pct

  - step_id: store
    kind: sql
    dependencies: [reading]
    command:
      driver: postgres
      dsn: secret://DATABASE_DSN
      write: true
      query: |
        WITH reading AS (
          SELECT convert_from(decode('{{ printf "%x" .steps.reading.output }}', 'hex'), 'UTF8')::jsonb AS data
        )
        INSERT INTO weather_readings (source, observed_at, metric_type, metric_value, unit)
        SELECT 'station:madrid-rooftop', to_timestamp((data->'time')::double precision), metric_type, metric_value, unit
        FROM reading
        CROSS JOIN LATERAL (VALUES
          ('temperature', (data->'temp_c')::numeric, '°C'),
          ('relative_humidity', (data->'humidity_pct')::numeric, '%')
        ) AS metrics(metric_type, metric_value, unit)
        ON CONFLICT (source, observed_at, metric_type) DO NOTHING

Setup Create the weather_readings table, set DATABASE_DSN and STATION_WEBHOOK_SECRET, and replace hooks.example.com with your verified workflow host.

Sample event payload{"timestamp":1796299200,"temperature_c":12.4,"humidity_pct":68}

EXPECTED RESULT

Know what to look for.

The sample records 12.4 °C and 68% humidity at 12:00 UTC on December 3, 2026.

Give each additional station its own endpoint, secret and source label.

TEST YOUR SETUP

Check a complete run.

  • Send the sample JSON to the configured path with Content-Type set to application/json.
  • Open the queued run and check that the store step wrote two rows.
  • Send the same body again and check that the row count stays the same.
Adapt this recipe with your AI agent

Map my station’s webhook body to this table. Show the source label, timestamp conversion and a duplicate delivery test before connecting the sender.

Open Workflows ↗

KEEP CONNECTING

More workflow recipes.