# Workflow button element

A button that carries a workflow trigger with customizable inputs. In Repzo Chat, clicking it notifies your app, which runs the workflow.

| | |
|---|---|
| **Type** | `workflow_button` |
| **Available in** | Messages, Modals, Home tab |
| **Works in blocks** | [Section block](https://workstation.repzo.com/docs/developers/block-kit/blocks/section-block), [Actions block](https://workstation.repzo.com/docs/developers/block-kit/blocks/actions-block) |

## Usage

Repzo Chat has no Slack workflows, so a click doesn't start anything by itself: it's delivered to the app that posted the message as a `block_actions` payload, carrying the button's `workflow` object:

```json
{
  "type": "workflow_button",
  "action_id": "start_onboarding",
  "block_id": "onboarding_kickoff",
  "workflow": {
    "trigger": {
      "url": "https://hooks.example.com/workflows/customer-onboarding",
      "customizable_input_parameters": [
        { "name": "account_id", "value": "ACC-5521" },
        { "name": "plan", "value": "professional" }
      ]
    }
  },
  "action_ts": "1793786400.000000"
}
```

Your app decides what to run with it — for example, start the onboarding in your own system with the input parameters. The `trigger.url` is never opened by Repzo. Values in `customizable_input_parameters` are visible to clients, so don't put secrets in them.

See the [button element](https://workstation.repzo.com/docs/developers/block-kit/elements/button-element) for the rest of the payload.

## Fields

| Field | Type | Description | Required? |
|---|---|---|---|
| `type` | String | The type of element. In this case `type` is always `workflow_button`. | Required |
| `text` | [Text object](https://workstation.repzo.com/docs/developers/block-kit/objects/text-object) | A text object that defines the button's text. Can only be of `type: plain_text`. `text` may truncate with ~30 characters. Maximum length for the `text` in this field is 75 characters. | Required |
| `workflow` | [Workflow object](https://workstation.repzo.com/docs/developers/block-kit/objects/workflow-object) | A workflow object that contains details about the workflow to run when the button is clicked. `workflow.trigger.url` is required. | Required |
| `action_id` | String | An identifier for the action triggered when the button is clicked. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other `action_id`s in the containing block. Maximum length is 255 characters. If you leave it out, Repzo generates one. | Optional |
| `style` | String | Decorates buttons with alternative visual color schemes. Use this option with restraint. `primary` gives buttons a green look, ideal for affirmation or confirmation actions, and should only be used for one button within a set. `danger` gives buttons a red look and should be used when the action is destructive. Use `danger` even more sparingly than `primary`. If you don't include this field, the default button style will be used. | Optional |
| `accessibility_label` | String | A label for longer descriptive text about the button. This label will be read out by screen readers _instead of_ the button `text` object. Maximum length is 75 characters. | Optional |

> **How Repzo Chat differs from Slack**
>
> - Repzo has no Slack workflows: the click goes to the posting app as `block_actions` (with the `workflow` object) instead of running a link trigger.
> - Also works in modals and the Home tab; Slack shows it in messages only.
> - `action_id` is optional: Repzo generates one when it's missing.

## Examples

### A section with a workflow button

```json
{
  "blocks": [
    {
      "type": "section",
      "block_id": "onboarding_kickoff",
      "text": {
        "type": "mrkdwn",
        "text": "*Northwind Traders* signed the Professional plan. Start the customer onboarding?"
      },
      "accessory": {
        "type": "workflow_button",
        "action_id": "start_onboarding",
        "text": {
          "type": "plain_text",
          "text": "Start onboarding"
        },
        "style": "primary",
        "workflow": {
          "trigger": {
            "url": "https://hooks.example.com/workflows/customer-onboarding",
            "customizable_input_parameters": [
              {
                "name": "account_id",
                "value": "ACC-5521"
              },
              {
                "name": "plan",
                "value": "professional"
              }
            ]
          }
        }
      }
    }
  ]
}
```

## Related

- [Block elements](https://workstation.repzo.com/docs/developers/block-kit/elements)
- [Block Kit overview](https://workstation.repzo.com/docs/developers/block-kit)
