> For the complete documentation index, see [llms.txt](https://developer.kizen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.kizen.com/docs/integrations-and-plugins/integrations/slack-beta/use-slack-in-an-agentic-workflow.md).

# Use Slack in an Agentic Workflow

{% hint style="success" %}
**Audience:** Admins, Developers, Solution Architects

**Purpose:** Explains how to add the Get Username, Send Slack Message, and Send Slack Block Message action steps to an <code class="expression">space.vars.automation</code> and configure their inputs, outputs, and error handling
{% endhint %}

## Overview

{% hint style="warning" %}
**Caution:** This setup reflects Kizen's default configuration. Your administrator may have customized your layout, so columns or navigation may appear differently. Trial accounts may have limited features.
{% endhint %}

Build <code class="expression">space.vars.automations</code> to look up Slack® user names from email addresses and send plain-text or formatted Slack messages.

***

## Before You Begin

To use Slack in an <code class="expression">space.vars.automation</code>, you need an active Slack workspace at any membership tier and the Slack integration installed and configured.

See [Set Up Slack in Kizen](/docs/integrations-and-plugins/integrations/slack-beta/set-up-slack-in-kizen.md) for details.

***

## Add Slack to an Agentic Workflow

To add Slack to an <code class="expression">space.vars.automation</code>:

{% stepper %}
{% step %}

#### Go to the Agentic Workflow builder

In the global navigation, select **Agentic Workflows**. Then, to open the builder, do one of the following:

* Select **New Agentic Workflow**.
* Select the name of an existing <code class="expression">space.vars.automation</code>.

<div data-with-frame="true"><figure><img src="/files/lzKaVI7e5AOZZ1FMqBl2" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Add an action to the workflow

Select **+**, and then select **Add Action**.

<div data-with-frame="true"><figure><img src="/files/pfOWt92LF708cXIyg4Ah" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Select the Slack action

In the Add Action modal that opens, scroll to the Integration section, and select the Slack card.

<div data-with-frame="true"><figure><img src="/files/VGg6ynB1CRGUgNQMwjBp" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Choose the function to perform

In the Action Settings section of the Add Action modal, select the **Action** dropdown menu, and do one of the following:

* To get the user name of someone on Slack, select **Get Username**, and set up the action. For more information, see [Set Up a Get Username Action](#set-up-a-get-username-action) below.
* To send a plain-text message to a Slack channel, select **Send Slack Message**, and set up the action. For more information, see [Set Up a Send Slack Message Action](#set-up-a-send-slack-message-action) below.
* To send a rich-text message to a Slack channel, select **Get Send Slack Block Message**, and set up the action. For more information, see [Set Up a Send Slack Block Message Action](#set-up-a-send-slack-block-message-action) below.
  {% endstep %}

{% step %}

#### Configure error handling

In the Error Handling section of the modal, specify how to handle errors in this step of the <code class="expression">space.vars.automation</code>.

<div data-with-frame="true"><figure><img src="/files/IszFUFi3jUadPIvZTPa4" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Save the Slack action

Select **Save**.
{% endstep %}
{% endstepper %}

***

## Set Up a Get Username Action

The Get Username action gives you the user name of any Slack member on your workspace from their email address. The integration returns the user name in the form of a Slack mention, like this: `<@U012AB3CD>`.

{% hint style="info" %}
**Note:** Because the user name comes back as a mention, you can tag this person in a Slack message in a later step of your <code class="expression">space.vars.automation</code> without parsing the output in any way. The value renders correctly in Slack when you send it to a channel through the Send Slack Message or Send Slack Block Message action.
{% endhint %}

To set up a Get Username Action:&#x20;

{% stepper %}
{% step %}

#### Configure the source for the email address

The action takes one of the following:

* The `Team Member` field of the Slack user in <code class="expression">space.vars.Kizen\_company\_name</code>
* The email address of the Slack user as a string

Find the Email field in the Script Inputs section of the Add Action modal, select the source of the email address from the **Input Source** dropdown menu, and then configure the source with the additional controls that appear.

<div data-with-frame="true"><figure><img src="/files/HepK9785XC415iD1sqTH" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Configure the destination for the Slack user name

The person's user name comes back as a string. Find the User Mention field in the Script Outputs section of the modal, select the destination of the user name from the **Output Source** dropdown menu, and then configure the destination with the additional controls that appear.

<div data-with-frame="true"><figure><img src="/files/zYx5LH5NKZJ284JvQVKG" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}
{% endstepper %}

***

## Set Up a Send Slack Message Action

The Send Slack Message action sends a plain-text Slack message to the specified Slack channel on your workspace.

{% hint style="info" %}
**Note:** This type of message can have a maximum of 40,000 characters. Slack truncates any text beyond this limit.
{% endhint %}

To set up a Send Slack Message action, for each of the fields in the Script Inputs section of the Add Action modal, select the source of the field's value from the **Input Source** dropdown menu, and then configure the source with the additional controls that appear.

<div data-with-frame="true"><figure><img src="/files/mv5yOKnYgOgLUvnTKG6E" alt="" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field       | Type     | Description                                     | Required? |
| ----------- | -------- | ----------------------------------------------- | --------- |
| **Message** | `String` | The plain-text message to send                  | Yes       |
| **Channel** | `String` | The ID or name of the destination Slack channel | Yes       |

{% hint style="info" %}
**Note:** Whenever possible, identify the channel by its ID (`C123456789`) instead of its name (`#channel`). Using the ID requires fewer API calls.
{% endhint %}

***

## Set Up a Send Slack Block Message Action

The Send Slack Block Message action sends a formatted or interactive message to the specified Slack channel on your workspace.

To set up a Send Slack Block Message action:

{% stepper %}
{% step %}

#### Build the message from Slack blocks

*Blocks* in Slack are JSON objects that represent message components like text, images, code listings, and videos. Build the message to send as an array of these blocks.

For more details, see Slack's [Block Kit documentation](https://docs.slack.dev/block-kit/).

{% hint style="info" %}
**Note:** Be sure to create the JSON object for the block as a long text variable, not with a static string input field. This way, you can see the entire structure of the object more easily.
{% endhint %}

To build the block payload visually, use Slack's [Block Kit Builder](https://app.slack.com/block-kit-builder/).

{% hint style="info" %}
**Note:** Slack limits you to a maximum of 50 blocks per payload. Each section block has a limit of 3000 characters per text field, and each header block has a limit of 150 characters per headline text field. Exceeding any one of these limits causes the entire payload to fail.

See the [Blocks reference](https://docs.slack.dev/reference/block-kit/blocks/) for advanced information.&#x20;
{% endhint %}
{% endstep %}

{% step %}

#### Configure the sources for the script inputs

For each of the fields in the Script Inputs section of the Add Action modal, select the source of the field's value from the **Input Source** dropdown menu, and then configure the source with the additional controls that appear.

<div data-with-frame="true"><figure><img src="/files/XnGWORuqscYqQ6LMU3vv" alt="" width="563"><figcaption></figcaption></figure></div>

The fields are as follows:

| Field       | Type     | Description                                     | Required? |
| ----------- | -------- | ----------------------------------------------- | --------- |
| **Channel** | `String` | The ID or name of the destination Slack channel | Yes       |
| **Message** | `String` | The message to send in blocks                   | Yes       |

{% hint style="info" %}
**Note:** Like with the Send Slack Message action, identify the channel by its ID (`C123456789`) instead of its name (`#channel`) whenever you can. Using the ID results in fewer API calls.
{% endhint %}
{% endstep %}
{% endstepper %}

***

## What's Next

Continue to [Troubleshoot Slack](/docs/integrations-and-plugins/integrations/slack-beta/troubleshoot-slack.md) for solutions to common technical problems.

<details>

<summary><strong>Related Topics</strong></summary>

* [Slack - Beta](/docs/integrations-and-plugins/integrations/slack-beta.md)
* [Set Up Slack in Kizen](/docs/integrations-and-plugins/integrations/slack-beta/set-up-slack-in-kizen.md)
* [Troubleshoot Slack](/docs/integrations-and-plugins/integrations/slack-beta/troubleshoot-slack.md)

</details>

***

*Slack is a registered trademark and service mark of Slack Technologies, Inc. Kizen's Slack integration is not created by, affiliated with, or supported by Slack Technologies, LLC.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.kizen.com/docs/integrations-and-plugins/integrations/slack-beta/use-slack-in-an-agentic-workflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
