# Build a Slack notification workflow

> Compose a dynamic Slack message from workflow data and send it to a channel via Integration Service connector.

**What you'll build:** A workflow that composes a dynamic Slack message from workflow data and sends it to a channel. You can attach this pattern to any trigger — a scheduled job, an incoming webhook, or an event from another system — to add real-time notifications to any automation.

## What you'll need

- A UiPath Automation Cloud account with access to Maestro Flow.
- A Slack workspace where you have permission to add an app.
- A Slack connection configured in Integration Service (UiPath's connector platform). To set it up, go to **Integration Service** in the UiPath Platform, find the Slack connector, and authorize it with your workspace.

## Nodes used

- [Manual Trigger](node-manual-trigger.md) — starts the workflow on demand (replace with your real trigger later)
- [Script](node-script.md) — composes the message text dynamically
- Slack integration node — sends the message to a Slack channel

## Steps

### 1. Create a new Flow and add a trigger

1. Open **Maestro** → **Flow** and create a new workflow.
2. Drag a **Manual Trigger** onto the canvas.
3. In the trigger's configuration panel, add input variables for any data you want to include in the message — for example, `recordName` (string) and `status` (string).

### 2. Compose the message

1. Drag a **Script** node onto the canvas and connect it to the trigger.
2. In the code editor, write the message text using your input variables:

```js
return `✅ Update: *${recordName}* is now ${status}.\nTriggered at: ${new Date().toISOString()}`;
```

3. Set **Output variable name** to `messageText`.

Adjust the format to match your team's conventions. Slack supports basic markdown in messages (`*bold*`, `_italic_`, `\n` for line breaks).

### 3. Add the Slack Send Message node

1. In the node panel, open **Integration nodes** and find the Slack connector.
2. Drag the **Send message** action onto the canvas and connect it to the Script node.
3. In the configuration panel:
   - Select your Slack **Connection**.
   - Set **Channel** to the channel ID or name where the message should be sent (for example, `#alerts`).
   - Map **Message** to `{{ $vars.messageText }}`.

### 4. Test and debug

1. Select **Test**.
2. In the trigger dialog, enter sample values for `recordName` and `status`.
3. Run the test.

Check the Slack channel after the run completes. If the message does not appear:

- Verify the Slack connection is active in Integration Service.
- Check the channel name — use the channel ID (starts with `C`) rather than the display name if you get a "channel not found" error.
- Inspect the Slack node's output in the execution trace for any error details from the Slack API.

## Result

Your workflow fires on demand, composes a dynamic Slack message from the trigger inputs, and posts it to the configured channel. You can confirm success by checking the channel directly and by inspecting the Slack node's output in the execution trace.

## Extend this workflow

- **Add a condition** — Before the Slack node, add a [Decision](node-decision.md) node to only send the message when a certain threshold is met (for example, only notify on `Failed` status).
- **Replace the trigger** — Swap the Manual Trigger for an integration trigger or a [Scheduled Trigger](node-scheduled-trigger.md) to send notifications automatically.
- **Send to multiple channels** — Add a [Switch](node-switch.md) node to route the message to different channels based on priority or team.
