
# The Action form

The Action form is a block (type `action`) that puts a [webhook workflow](https://developers.unvop.com/guides/workflows.md#webhooks) in front of visitors. It is a real form: its heading, introduction, fields and button text are editable like any other block. When a visitor presses the button, it posts the fields as JSON to `/api/hooks/<name>` and shows what the workflow answers.

Use it for anything that takes a few words in and gives something back: a quote, a generated picture, a lookup, a booking request.

## The pieces

| Field | What it holds |
|---|---|
| `title`, `intro` | The heading and introduction above the form |
| `fields` | Each field's `label`, `key`, `kind` (`text`, `textarea`, `email` or `number`) and whether it is `required` |
| `button` | The button's text |
| `endpoint` | Which of the site's webhook workflows runs |
| `result` | How to show the answer: `image`, `text` or `message` |

Each field is sent under its key: a field with the key `prompt` arrives in the workflow as `trigger.body.prompt`.

## Wire it up

1. Make a webhook workflow whose trigger has `access: "public"` (visitors have no key or secret) and whose last step is `respond.json`.
2. Have `respond.json` answer a body with `image` (a URL; the form shows it with a download link), `text`, or `message`.
3. Add the Action form to a page and pick the workflow in its inspector, or set its `endpoint` prop to the workflow's webhook name through the API.

Here an `ai.draft` step with the id `draft` wrote a reply, and the form shows it as text:

```json title="A respond.json step"
{
  "id": "answer",
  "type": "respond.json",
  "config": { "status": 200, "body": { "text": "{{steps.draft.reply}}" } }
}
```

## What visitors see when it fails

A workflow that calls a connection with no key yet answers `not_configured`, and the form says "This isn't set up yet." Anything else that fails reads "Something went wrong, please try again." The details stay in the workflow's runs, never on the page.

When a build's prompt asks for an automation, Unvop plans the workflow and puts an Action form on the right page for you.
