Hookway

Sns — destinations/sns

# examples/destinations/sns.yaml
#
# Reference config for an AWS SNS destination. Hookway publishes each
# webhook event envelope to an SNS topic. From there, SNS fan-out delivers
# to SQS queues, Lambda functions, HTTP endpoints, or any other subscriber.
#
# Credentials: omit access_key_id / secret_access_key to use the default
# AWS credential chain (IAM role, environment, ~/.aws). Set endpoint to
# http://localhost:4566 to use LocalStack during development.

server:
  addr: ":8080"
  max_body_bytes: 1048576

destinations:
  alerts:
    type: sns
    # How to handle an existing topic whose attributes differ from this config:
    #   reconcile (default): edit the topic's mutable attributes to match (needs sns:SetTopicAttributes)
    #   warn: log the difference and use the existing topic unchanged
    #   error: fail startup on any difference
    # Immutable conflicts (topic type, e.g. FIFO) always fail startup regardless.
    on_existing_conflict: reconcile
    sns:
      region: "us-east-1"
      # Uncomment to override the SNS endpoint, e.g. for LocalStack:
      # endpoint: "http://localhost:4566"   # or reference an env var you export
      # Omit both of the following to use the default AWS credential chain:
      # access_key_id: "AKIA..."
      # secret_access_key: "..."

flows:
  order_events:
    nodes:
      - {id: in, type: http_trigger, path: /webhooks/orders, methods: [POST]}
      - {id: body, type: read_body, max_bytes: 1048576}
      - {id: auth, type: auth, scheme: hmac_sha256_ts_colon, secret: "${ORDERS_WEBHOOK_SECRET}", signature_header: X-Signature, timestamp_tolerance: "5m"}
      - {id: env, type: envelope, body_format: json}
      # Target is the SNS topic name. Hookway will publish to this topic.
      # Previously set sns_options.subject: "order event" (not a publish-node field).
      - {id: out, type: publish, destination: alerts, target: order-alerts, create: true}
    edges: [in>body, body>auth, auth>env, env>out]