Beta sign in

Pipe library / webhook-relay

webhook-relay

Filter a public JSON list and POST the digest to a webhook. The default URL is httpbin, which echoes the body and allows this.

Utilities

hn.algolia.comhttpbin.org

CLI

pipes run examples/webhook-relay.pipe.yaml

MCP call

{
  "name": "pipe__webhook-relay",
  "arguments": {}
}

Pipe file

examples/webhook-relay.pipe.yaml

pipes: 0
name: webhook-relay
version: 0.1.0
description: Filter a public JSON list and POST the digest to a webhook. The default URL is httpbin, which echoes the body and allows this.
permissions:
  network: [hn.algolia.com, httpbin.org]
inputs:
  type: object
  properties:
    keyword:
      type: string
      minLength: 1
      default: a
    webhook:
      type: string
      format: uri
      default: https://httpbin.org/post
  required: [keyword, webhook]
outputs:
  type: object
  properties:
    text: { type: string }
    status: { type: integer }
  required: [text]
output:
  text: "${steps.format.text}"
  status: "${steps.notify.status}"
steps:
  - id: fetch
    block: fetch_http
    with:
      url: https://hn.algolia.com/api/v1/search
      query:
        tags: front_page
        hitsPerPage: "5"
      max_bytes: 400000
    retry: { max: 2, backoff_ms: 400 }
    timeout_ms: 15000
  - id: hits
    block: parse_json
    in: "${steps.fetch}"
    with:
      path: hits
  - id: matched
    block: filter
    in: "${steps.hits}"
    with:
      where: { field: title, op: contains, value: "${inputs.keyword}" }
    on_item_error: drop
  - id: capped
    block: limit
    in: "${steps.matched}"
    with: { n: 5 }
  - id: format
    block: format
    in: "${steps.capped}"
    with:
      header: "Relay:\n"
      item_template: "- ${item.title}"
      separator: "\n"
  - id: notify
    block: emit_webhook
    in: "${steps.format}"
    with:
      url: "${inputs.webhook}"
      body:
        text: "${steps.format.text}"
      skip_if_empty: true
    retry: { max: 2, backoff_ms: 500 }
    timeout_ms: 15000