---
schema_version: "1"
id: c7f9a2273e81567c5a60aa800c40426f32fb9bc625f2f0aeaa58a2ca1edfe41c
title: Configure Slack Integration
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-code-builder/tut-slack-configure-integration.md
canonical_url: https://docs.mulesoft.com/anypoint-code-builder/tut-slack-configure-integration
source_site: docs.mulesoft.com
content_type: documentation
content_hash: eee12cc6011d05c107549f5b8afe911933f63ad626f4833b854fa66199da0d86
description: MuleSoft Documentation Site
latest: true
---
---
product: Anypoint Code Builder
version: master
---

# Configure Slack Integration

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

With your email and Salesforce integration complete, you can now configure your Slack integration to
send a Slack message for a new case that is not escalated.

## Before You Begin

Complete these procedures:

1.  [Integrate Salesforce Data into Slack and Email Notifications](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-create-escalation-api).

2.  [Create a Configuration File for Slack and Salesforce](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-create-config-files-sfdc) and
    configure your Salesforce integration.

3.  [Extract Payload Information to Variables](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-extract-payload-information).

4.  [Add a Condition to Your Flow Logic](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-add-condition-to-your-flow).

## Add a Slack Action

1.  In Anypoint Code Builder, open your `new-case-salesforce.xml` file and delete **Temporary
    Logger** from the **Not Escalated** route of the Choice router:

    ![A workflow with the \*Temporary Logger\* component highlighted, both in the flow canvas UI and in the code view](/mulesoft/current/en-us/anypoint-code-builder/_images/delete-temporary-logger-slack.png)

    ```XML
    <logger doc:name="Temporary Logger" message='#["Please look into this new Case: " ++ payload]'/>
    ```

2.  Click the ![](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-plus.png) (**Add component**) icon after the **Not Escalated** route
    of the Choice router:

    ![A flow in the canvas UI with the \*Add Component\* button highlighted](/mulesoft/current/en-us/anypoint-code-builder/_images/add-slack-action-example-canvas.png)

3.  Click the ![](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-search-exchange.png) (**Search in Exchange**) icon, type `Slack`, and
    select **Slack Connector**:

    ![A list of search results with the Slack connector highlighted](/mulesoft/current/en-us/anypoint-code-builder/_images/add-slack-connector-canvas-exchange.png)

4.  Select the **Chat: Post Message** operation from the Slack section:

    ![A list of search results containing Slack connector components](/mulesoft/current/en-us/anypoint-code-builder/_images/select-post-message-operation.png)

5.  Configure the Slack operation using the following code sample:

    ```XML
    <slack:post-message channel="this-is-a-test" config-ref="Slack_Config" doc:name="Send Case to Slack"> (1)
      <slack:message ><![CDATA[#["Please handle this case. " ++ payload]]]></slack:message>
    </slack:post-message>
    ```

    <table><tbody><tr><td><i data-value="1"></i><b>1</b></td><td>Set the <code>channel</code> field to the channel name that you set earlier in the tutorial.</td></tr></tbody></table>

## Configure the Slack Connection

1.  In Anypoint Code Builder, open your `new-case-salesforce.xml` file, and add a new line under
    your `<email:smtp-config/>` element.

2.  Type `slack:` and select **slack:config**.

3.  Add the following configuration to your `<slack:config/>` element:

    ```XML
    <slack:config name="Slack_Config" doc:name="Slack Config">
      <slack:token-connection token="${slack.token}" />
    </slack:config>
    ```

## Test Your Mule Application

1.  To expedite the test, remove the breakpoint next to your Logger component.

2.  Select **Run** > **Start Debugging (F5)**.

3.  After your application deploys successfully, log in to your Salesforce account.

4.  From **App Launcher**, select **Service**:

    ![The Setup menu with the App Launcher button icon highlighted](/mulesoft/current/en-us/anypoint-code-builder/_images/salesforce-select-service.png)

5.  Select **Cases** > **New Case**:

    ![The Service navigation bar with the \*New Case\* button highlighted in the Cases section](/mulesoft/current/en-us/anypoint-code-builder/_images/salesfroce-create-new-case.png)

6.  Ensure that the **Status** of the new case is **New**.

7.  After a few seconds, ensure that your configured Slack channel received a message with the
    information configured in the case:

    ```none
    Please handle this case. Case Number: 00001030, Origin: Phone, Case Type: , Priority: Medium, Status: New
    ```

[Add a Condition to Your Flow Logic](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-add-condition-to-your-flow)
