> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cattix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Frontend Actions

> All FrontendAction values the backend sends via chat responses and how to handle them

<Note>
  Ця сторінка також доступна [українською](/guides/frontend-actions-uk).
</Note>

## Overview

When the AI assistant performs actions during a chat conversation, the backend
signals the frontend via `frontend_actions` — an array of string values
included in every chat message response.

```json theme={null}
{
  "role": "assistant",
  "content": "Done! I've updated the budget.",
  "frontend_actions": ["update_campaign_draft"]
}
```

The array can contain **zero or more** actions per message. Handle each one
independently.

***

## All actions

| Action                      | Context             | When it's sent                                                              | What the frontend should do                                   |
| --------------------------- | ------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `enable_submit_button`      | **Onboarding only** | Assistant finished onboarding and the user can proceed                      | Enable the "Submit" / "Continue" button                       |
| `disable_submit_button`     | **Onboarding only** | Assistant needs more input before onboarding can complete                   | Disable the submit button                                     |
| `update_campaign_draft`     | Campaign wizard     | Assistant modified draft data (keywords, ad groups, RSAs, extensions, etc.) | Re-fetch the campaign draft from the API to show updated data |
| `set_campaign_draft_step_1` | Campaign wizard     | Assistant wants to navigate to Step 1 (Campaign Settings)                   | Switch the wizard UI to step 1                                |
| `set_campaign_draft_step_2` | Campaign wizard     | Assistant wants to navigate to Step 2 (Ad Groups)                           | Switch the wizard UI to step 2                                |
| `set_campaign_draft_step_3` | Campaign wizard     | Assistant wants to navigate to Step 3 (Ads / RSAs)                          | Switch the wizard UI to step 3                                |
| `set_campaign_draft_step_4` | Campaign wizard     | Assistant wants to navigate to Step 4 (Extensions)                          | Switch the wizard UI to step 4                                |

<Warning>
  `enable_submit_button` and `disable_submit_button` are used **exclusively in
  the onboarding flow**. They are not related to campaign creation. Do not
  confuse them with campaign wizard actions.
</Warning>

***

## Handling details

### `update_campaign_draft`

This is the most common action. It fires whenever the assistant creates, updates,
or deletes any part of a draft — ad groups, keywords, RSAs, extensions, bidding
strategy, etc.

**Expected behavior:** re-fetch the full draft via `GET /api/v1/campaigns/drafts/{id}`
and update the wizard UI with the fresh data.

### `enable_submit_button` / `disable_submit_button`

These actions are **onboarding-specific**. The assistant toggles the submit
button during the onboarding conversation flow. They are not sent during
campaign creation.

### `set_campaign_draft_step_N` (new)

Pure navigation signals. The assistant sends these when it wants to direct the
user's attention to a specific wizard tab — e.g., after editing keywords it may
navigate to Step 2 so the user can review.

**Expected behavior:** switch the active tab to step N (1–4). No data refetch
needed — these are often sent alongside `update_campaign_draft`, which already
handles the data refresh.

***

## Example: multiple actions in one message

The assistant can send several actions at once. For example, after editing
keywords and wanting to show the Ad Groups tab:

```json theme={null}
{
  "role": "assistant",
  "content": "I've added 5 keywords to the 'Brand' ad group. Take a look!",
  "frontend_actions": [
    "update_campaign_draft",
    "set_campaign_draft_step_2"
  ]
}
```

Process both: re-fetch the draft **and** switch to step 2.
