Skip to main content

Modify Response Action

The modify_response action overrides the HTTP response sent back to the webhook sender. Use it to return dynamic responses based on request data or values computed by earlier actions in the chain.

Configuration

{
"type": "modify_response",
"name": "Return order confirmation",
"config": {
"status_code": 200,
"headers": {
"X-Order-Id": "$variable.order_id$",
"Content-Type": "application/json"
},
"body": "{\"received\": true, \"order_id\": \"$variable.order_id$\"}"
}
}

Fields

FieldTypeRequiredDescription
status_codeintegerNoHTTP status code (100-599)
headersobjectNoResponse headers (values support interpolation)
bodystringNoResponse body (supports interpolation, max 10,000 bytes)

At least one field must be provided.

Relationship to mock response rules

Mock response rules are evaluated before the automation chain runs and determine the base response (status code, headers, body). The modify_response action can then override any part of that response.

If no mock rule matches, the endpoint's default response (202 Accepted with empty body) is used as the base.

Multiple modify_response actions

If your chain contains multiple modify_response actions, their effects accumulate:

  • Status code: last write wins
  • Body: last write wins
  • Headers: merged — each action's headers are added to (or override) existing response headers

Examples

Simple acknowledgment

{
"status_code": 200,
"body": "{\"ok\": true}"
}

Dynamic response with extracted data

Pair with an Extract JSON action to return computed values:

{
"status_code": 201,
"headers": {"Content-Type": "application/json"},
"body": "{\"processed\": true, \"event\": \"$variable.event_type$\", \"id\": \"$variable.object_id$\"}"
}

Add custom headers only

{
"headers": {
"X-Processed-By": "hooklistener",
"X-Request-Id": "$request.headers.x-request-id$"
}
}