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

# Using ClarityQ in Mattermost

> Get task results, ask questions, and link your account without leaving Mattermost.

Once your Mattermost server is [connected](https://docs.clarityq.ai/integrations/mattermost/connecting-mattermost.md), the ClarityQ bot can post task results in channels and answer questions in channels and direct messages. This page covers the day-to-day use.

## Receiving Task Results

When a [task](https://docs.clarityq.ai/automations/what-are-tasks.md) runs, its result is posted in the Mattermost channel you picked for it. Each post includes:

* The task name and a summary of the result.
* An image of the dashboard, when the result includes one.
* A **View Chat** button that opens the full conversation in ClarityQ.

Reply in the post's thread to ask a follow-up question. ClarityQ starts a new chat for you from that result and answers in the thread.

## Agent Approvals and Results

A [workflow agent](https://docs.clarityq.ai/automations/workflows-and-agents.md) that delivers to a Mattermost channel posts its approval requests and the result of every run there. An approval request has **Approve**, **Discard**, and **View Chat** buttons. Anyone in the channel who has a ClarityQ account with access to the agent's workspace can answer. See [Agent Runs & Approvals](https://docs.clarityq.ai/automations/agent-runs-and-approvals.md#approvals).

## Asking ClarityQ in Mattermost

You can ask in three ways:

* **Mention the bot in a channel** it is a member of, for example `@clarityq what's revenue by region this quarter?`
* **Send the bot a direct message.**
* **Reply in a ClarityQ thread** to ask a follow-up.

The bot first replies that it is working on it, then replaces that message with the answer. Each answer has a **View Chat** button.

### Workspace resolution

ClarityQ needs to know which workspace to query. It works this out in order:

* **Explicit selection.** Start your question with the workspace name in brackets, for example `@clarityq [Web App] how many signups last week?`
* **Single workspace.** If you have access to one workspace only, ClarityQ uses it.
* **Default workspace.** Otherwise ClarityQ uses your default, which starts as the workspace you use most. Change it with `/clarityq set-default-product`.
* **Buttons.** If ClarityQ still can't tell, it shows a button for each workspace. Only the person who asked can pick one.

The bot's own messages call a workspace a "product".

> [!WARNING]
>
> ClarityQ does not check whether everyone in a Mattermost channel has access to the workspace being queried. Anyone in the channel can read the bot's answers. Be mindful of which channels you ask in if your data is sensitive.

### How Mattermost chats work

* **One owner per thread.** Only the person who asked can continue the conversation. Anyone else who replies is told to mention the bot in a new message.
* **Chat history.** The conversation is saved in your chat history in ClarityQ, marked with a Mattermost icon.
* **Opening in ClarityQ ends the thread.** Once the chat is continued in ClarityQ, the Mattermost thread stops taking new questions. Mention the bot in a new message to ask something new.
* **Other people in the channel.** They can click **View Chat** to see a read-only copy of the conversation.
* **Very long answers are cut.** The post says so, and **View Chat** opens the full answer.

## Commands

Run these in any channel or direct message. Only you see the reply.

| Command | What it does |
| - | - |
| `/clarityq help` | Shows how to use ClarityQ in Mattermost. |
| `/clarityq connect` | Links your Mattermost account to your ClarityQ account. |
| `/clarityq products` | Lists the workspaces you can ask about, and marks your default. |
| `/clarityq set-default-product <name>` | Sets the workspace ClarityQ uses when you don't name one. Without a name, it shows buttons to pick from. |

## Linking Your Account

ClarityQ matches you by email. If your Mattermost email is the one you sign in to ClarityQ with, there is nothing to do.

If the emails differ, run `/clarityq connect` once. ClarityQ replies with a link that expires in 10 minutes. Open it while signed in to ClarityQ, and your accounts are linked. Until then the bot can't answer your questions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.