Http

HTTP hooks enable you to make HTTP requests to external services as part of your replication workflow. This is particularly useful for integrating with external APIs, sending notifications, or triggering other systems.

Configuration

- type: http
  url: "https://api.example.com/webhook"  # Required
  method: GET                             # Optional: GET/POST/PUT/DELETE (default: GET)
  payload: '{"status": "{run.status}"}'   # Optional: Request body (also accepts YAML object)
  timeout: 10                             # Optional: Request timeout seconds (default is 30sec)
  headers:                                # Optional: Request headers
    Authorization: "Bearer token"
  auth:                                   # Optional: Authentication configuration
    type: basic                           # basic, aws-sigv4, or hmac
    username: "myuser"
    password: "mypass"
  proxy: "http://user:[email protected]:8080"  # Optional: HTTP/HTTPS proxy URL
  write_to: local/path/to/response.json   # Optional: Save response to a file
  on_failure: abort                       # Optional: abort/warn/quiet/skip
  id: my_id                               # Optional. Will be generated. Use `log` hook with {runtime_state} to view state.

Properties

Property
Required
Description

url

Yes

The URL to send the request to

method

No

HTTP method (GET/POST/PUT/DELETE). Defaults to GET

payload

No

The request body (for POST/PUT requests)

headers

No

Map of HTTP headers to include in the request

auth

No

Authentication configuration (see Authentication section)

proxy

No

HTTP/HTTPS proxy URL (e.g., http://user:[email protected]:8080)

write_to

No

Location to save the response bytes to a file (e.g., local/path/to/response.json, s3/folder/response.csv)

on_failure

No

What to do if the request fails (abort/warn/quiet/skip)

Output

When the HTTP hook executes successfully, it returns the following output that can be accessed in subsequent hooks:

You can access these values in subsequent hooks using the following syntax (jmespath):

  • {state.hook_id.status} - Status of the hook execution

  • {state.hook_id.request.method} - HTTP method used

  • {state.hook_id.request.url} - The URL called

  • {state.hook_id.request.headers} - Request headers

  • {state.hook_id.request.payload} - Request body

  • {state.hook_id.response.status} - HTTP status message

  • {state.hook_id.response.status_code} - HTTP status code

  • {state.hook_id.response.text} - Raw response body

  • {state.hook_id.response.json} - Parsed JSON response

  • {state.hook_id.response.size} - Size of response in bytes

  • {state.hook_id.written_to.location} - Location where response was saved

  • {state.hook_id.written_to.uri} - Absolute URI of saved response file

Examples

Slack Notification

Send a notification to Slack after replication completes:

Microsoft Teams Alert

Send an alert to Microsoft Teams when replication fails:

REST API Integration

Fetch configuration from an external API before starting replication:

API with Basic Authentication

Call an API endpoint that requires basic authentication:

API with HMAC Signature

Call an API that requires HMAC signature authentication:

Trigger External Workflow

Trigger an external workflow system after successful replication:

Data Quality Service Integration

Send data quality metrics to a monitoring service:

Error Tracking Integration

Send error details to an error tracking service when replication fails:

Download and Save API Response

Fetch data from an API and save the response to a file:

Authentication

The HTTP hook supports multiple authentication methods through the auth property:

Basic Authentication

Use HTTP Basic Authentication with username and password:

AWS Signature V4

Sign requests using AWS Signature Version 4 (for AWS services):

Note: AWS credentials can also be loaded from environment variables or AWS profiles if not explicitly provided.

HMAC Signature

Sign requests using HMAC (Hash-based Message Authentication Code) for custom API authentication:

Available template variables for signing_string and request_headers:

  • {http_method} - HTTP method (GET, POST, etc.)

  • {http_path} - Request path including query string

  • {http_body_md5} - MD5 hash of request body (hex)

  • {http_body_sha1} - SHA1 hash of request body (hex)

  • {http_body_sha256} - SHA256 hash of request body (hex)

  • {http_body_sha512} - SHA512 hash of request body (hex)

  • {http_body_raw} - Raw request body as string

  • {http_query} - Canonical query string (sorted, URL-encoded)

  • {http_headers} - Canonical headers string (lowercase, sorted)

  • {unix_time} - Current Unix timestamp (seconds)

  • {unix_time_ms} - Current Unix timestamp (milliseconds)

  • {date_iso} - Current date in ISO 8601 format (RFC3339)

  • {date_rfc1123} - Current date in RFC1123 format

  • {nonce} - Random nonce (if nonce_length is set)

  • {signature} - The computed HMAC signature (available in request_headers)

Example with complete HMAC flow:

Bearer Token (via Headers)

For Bearer token authentication, use the headers property instead of auth:

Proxy Configuration

If your network requires routing HTTP requests through a proxy server, you can configure it using the proxy property:

Proxy with Authentication

For proxies that require authentication, include credentials in the proxy URL:

The proxy URL format is: http://[username:password@]host:port

Notes:

  • Both HTTP and HTTPS proxies are supported

  • Authentication credentials in the proxy URL are automatically handled

  • The proxy applies to all HTTP/HTTPS requests made by this hook

Last updated

Was this helpful?