Browse the docs

Reply to webhook

Sets the answer to the webhook request that started the macro, when the trigger waits for a reply.

Reply to the webhook with status

Details #

Use this in a macro started by a Webhook with reply: "wait". The request stays open until this step runs; the status, headers and body you give are sent back to the caller. The first Reply step a run executes wins; a later one does nothing (the editor warns about it).

A string body is sent as text. An object or list is sent as JSON. With no Reply step, a waiting webhook answers 200 with the run's last result as text, or 500 with {error, step} if the macro failed.

The step does not end the macro: anything after it still runs, after the caller already has its answer.

Parameters #

ParameterTypeRequiredValuesWhat it does
bodyany valueText, or an object or list sent as JSON. Supports {{ }} values.
contentTypetextThe Content-Type. Defaults to text/plain for text and application/json for objects.
headersrecordAn object of response headers.
statusnumberThe HTTP status, 100 to 599. Defaults to 200.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Answer a webhook with JSON
When
  1. A GET webhook is called at /status
Do
  1. Reply to the webhook with 200
Open in Switchboard to try it

Gotchas #

  • Dry run. Simulated: nothing is sent.

  • A macro with this step and no webhook trigger set to wait has nobody to answer; the editor warns.

  • The traced output shows the status and size, not the whole body.

See also #

Webhook, Send HTTP request