# Interaction

## MAESTROSDK.confirm(request)

Shows a native confirmation dialog attached to the Cowork window and waits for the person's answer.

### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `request.title` | `string` | Yes | Dialog title |
| `request.message` | `string` | Yes | The question |
| `request.confirmLabel` | `string` | No | Text of the confirm button; default Cowork's own OK |
| `request.cancelLabel` | `string` | No | Text of the cancel button; default Cowork's own Cancel |

### Returns

`Promise<boolean>`: `true` when the person confirms, otherwise `false`.

### Returns `false` when

| Case | Why |
|---|---|
| The person cancels or closes the dialog | No answer is a no |
| This tab is not the active tab | Only the tab in front may ask, so a background tab cannot interrupt. Inside a `beforeRefresh` handler for a refresh the person started, the tab may ask even if it is not in front |
| `title` or `message` is missing or not a string | Invalid request |
| Another confirmation is already open in the same window | One dialog at a time |
| The page has no Cowork tab identity, or Cowork cannot show the dialog | Not available |

### Example

```js
const ok = await MAESTROSDK.confirm({
  title: 'Delete draft',
  message: 'Delete this draft? This cannot be undone.',
  confirmLabel: 'Delete',
  cancelLabel: 'Keep'
});
if (ok) deleteDraft();
```

## Related

- [Lifecycle](https://docs.micromeet.ai/miniapp-sdk/lifecycle.md): Ask before the tab refreshes
- [Overview](https://docs.micromeet.ai/miniapp-sdk/overview.md): All modules of the Mini App SDK
