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

# Tutorial: Build a deal close alert

> Step-by-step guide to building a workflow that notifies your team when a deal closes and shares AI-generated insights from the winning conversation.

This tutorial walks you through building a complete workflow from scratch. By the end, you'll have a working automation that:

1. Triggers when a Salesforce opportunity closes
2. Uses Ask Attention to extract winning insights from the final sales call
3. Sends a celebratory Slack message to your team channel

**Time to complete:** 15–20 minutes

**Prerequisites:**

* Admin or Builder access in Attention
* Salesforce integration connected
* Slack integration connected

***

## Step 1: Create a new workflow

1. Click your name in the top left corner of Attention
2. Navigate to **Settings** > **Builder**
3. Click **+ Create workflow** in the top right
4. Name your workflow "Deal Close Alert"

You'll see an empty canvas with a placeholder for your trigger.

***

## Step 2: Add the Salesforce trigger

The trigger determines when your workflow runs. For this workflow, we want it to fire whenever an opportunity is marked as Closed Won.

1. Click the **+** icon on the canvas to add a trigger
2. Search for **Salesforce** and select **Record Updated**
3. In the configuration panel:
   * **Connection**: Select your Salesforce connection (or create one if needed)
   * **Object**: Select **Opportunity**
4. Click **Test** to pull in sample data from a recent opportunity update

> [!TIP]
>
> Testing the trigger populates the Data Selector with real field values you can reference in later steps.

***

## Step 3: Add a filter for Closed Won deals

Not every opportunity update should trigger an alert—only closed-won deals. Add a filter to control this.

1. Click the **+** icon below your trigger
2. Search for **Router** and select it
3. In the configuration panel:
   * **Condition**: Set up the following logic:
     * Field: `Stage` (from the Salesforce trigger data)
     * Operator: `equals`
     * Value: `Closed Won`
4. Click **Test** to verify the condition evaluates correctly

The router creates two branches: one for when the condition is true (Closed Won) and one for when it's false. You'll only add steps to the "true" branch.

***

## Step 4: Fetch the related conversation

Now we need to find the Attention conversation associated with this deal. This lets us extract insights from the winning sales call.

1. On the **true** branch, click **+** to add a step
2. Search for **Attention** and select **List Conversations**
3. In the configuration panel:
   * **Filter by**: CRM Record ID
   * **Value**: Click into the field, open the **Data Selector**, and insert the Opportunity ID from your Salesforce trigger
4. Click **Test** to retrieve matching conversations

This step returns all conversations linked to the opportunity. In most cases, you'll want the most recent one.

***

## Step 5: Generate insights with Ask Attention

This is where the magic happens. Use Ask Attention to analyze the conversation and extract what made the deal successful.

1. Click **+** to add another step
2. Search for **Ask Attention** and select it
3. In the configuration panel:
   * **Conversation**: Use the Data Selector to insert the conversation ID from the previous step
   * **Prompt**: Enter a prompt like:

```text theme={null}
Analyze this sales conversation and provide:
1. The key factors that helped close this deal
2. Any objections the prospect raised and how they were handled
3. A memorable quote from the call that captures the win
Keep the response concise (under 150 words).
```

4. Click **Test** to see the AI-generated insights

> [!TIP]
>
> Be specific in your prompts. The more focused your request, the more useful the output.

***

## Step 6: Send a Slack notification

Finally, share the win with your team by sending a Slack message.

1. Click **+** to add the final step
2. Search for **Slack** and select **Send Message**
3. In the configuration panel:
   * **Connection**: Select your Slack connection
   * **Channel**: Choose your team's sales channel (e.g., `#sales-wins`)
   * **Message**: Compose your message using the Data Selector to pull in dynamic values:

```text theme={null}
🎉 *Deal Closed!*

*Account:* {{Salesforce trigger → Account Name}}
*Amount:* {{Salesforce trigger → Amount}}
*Owner:* {{Salesforce trigger → Owner Name}}

*Winning Insights:*
{{Ask Attention → Output}}
```

4. Click **Test** to send a test message to the channel

***

## Step 7: Activate your workflow

Once all steps are configured and tested:

1. Review the complete workflow on the canvas
2. Toggle the workflow to **Active** in the top right
3. Click **Save**

Your workflow is now live. Every time an opportunity is marked Closed Won in Salesforce, your team will receive a Slack notification with AI-powered insights.

***

## Troubleshooting

| Issue | Solution |
| - | - |
| Trigger not firing | Verify your Salesforce connection is active and has the correct permissions |
| No conversations found | Ensure conversations are linked to the Opportunity in Attention via CRM sync |
| Slack message not sending | Check that the Slack connection has permission to post to the selected channel |
| Empty AI insights | Confirm the conversation has been fully analyzed before the workflow runs |

***

## Next steps

Now that you've built your first workflow, try these variations:

* **Add a second channel**: Use another Slack step to notify the account executive directly via DM
* **Update the CRM**: Add a Salesforce step to log the AI insights back to the Opportunity record
* **Weekly digest**: Create a scheduled workflow that summarizes all closed deals from the past week


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