---
schema_version: "1"
id: 54a97233f8e224dd40f26f56caa757f872d64fced8fc57d84b3dd32cd50972c8
title: Integrate Salesforce Data into Slack and Email Notifications
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-code-builder/tut-slack-create-escalation-api.md
canonical_url: https://docs.mulesoft.com/anypoint-code-builder/tut-slack-create-escalation-api
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 761003eb90f398d8c9ab4a10d00c54ebf305ba20cf458f729510598b2462916b
description: MuleSoft Documentation Site
latest: true
---
---
product: Anypoint Code Builder
version: master
---

# Integrate Salesforce Data into Slack and Email Notifications

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

Create an integration that notifies you through email or Slack when a new case is created in
Salesforce.

The integration that you build contains a flow with the following logic:

- The creation of a new case in Salesforce triggers your flow.

- If the case is escalated, your application sends an email to the regional leader including the
  case number, origin, reason, priority, and status.

- If the case is not escalated, your application sends a message to a Slack channel with the same
  information.

## Before You Begin

Before you begin, ensure you:

- Set up your MuleSoft environment.

  See [Getting Started with Anypoint Code Builder](https://docs.mulesoft.com/anypoint-code-builder/start-acb) for more information.

- Set up a Salesforce demo environment.

  - [Sign up for a developer organization](https://www.salesforce.com/products/free-trial/developer/).

  - [Create a developer security token](https://help.salesforce.com/s/articleView?id=sf.user_security_token.htm&type=5).

- Have a personal or business Gmail account.

- Have a personal or business Slack account.

### Set Up Your Slack Workspace

1.  Navigate to [Slack](https://slack.com/) and log in using your organization credentials.

    If your work organization restricts users from creating new workspaces, log in using your
    personal email account.

2.  Create a new Workspace called **Integration Test**.

3.  Skip the step to invite new users and type a brief description of your Workspace, for example,
    **This is a test Workspace**.

4.  Navigate to [Your Apps](https://api.slack.com/apps) and click **Create an App**:

    ![Create an App in Slack](/mulesoft/current/en-us/anypoint-code-builder/_images/slack-create-app.png)

5.  Select **From scratch**.

6.  Name your app **OAuth for Anypoint Code Builder**, and select your **Integration Test**
    workspace.

7.  Click **Generate**:

    ![Generate a configuration token in Slack](/mulesoft/current/en-us/anypoint-code-builder/_images/generate-token.png)

8.  Click **Create App**:

    ![Name your app and select a workspace in Slack](/mulesoft/current/en-us/anypoint-code-builder/_images/slack-create-app-workspace.png)

9.  Click **Install App**:

    ![Install an app in Slack](/mulesoft/current/en-us/anypoint-code-builder/_images/slack-install-app.png)

10. Click **Permission scope**:

    ![Click permission scope in Slack](/mulesoft/current/en-us/anypoint-code-builder/_images/slack-install-permission-scope.png)

11. Scroll down to the **Scopes** section and, under **Bot Token Scopes**, select **Add an OAuth
    Scope**, and select **chat:write.public**:

    ![Add OAuth scope in Slack](/mulesoft/current/en-us/anypoint-code-builder/_images/slack-bot-permissions-chat-write.png)

12. Select **Add scopes** when prompted to add other necessary scopes for `chat:write.public`.

13. Scroll up to the **OAuth Tokens for Your Workspace** and select **Install to Workspace**.

14. Click **Allow**:

    ![Allow OAuth access to workspace](/mulesoft/current/en-us/anypoint-code-builder/_images/slack-allow-install-app-workspace.png)

15. Under **Bot User OAuth Token**, click **Copy** and save it on a safe location.

    ![Copy OAuth token for Bot User](/mulesoft/current/en-us/anypoint-code-builder/_images/slack-copy-oauth-token.png)

    You use this token to connect to your Slack workspace from Anypoint Code Builder:

16. Create a new public channel called "this-is-a-test" in your **Integration Test** workspace.

17. Add the OAuth for Anypoint Code Builder app to the `this-is-a-test` channel.

### Set up an App Password for Your Email

Later in this tutorial, you configure the Email Connector to send emails to your configured email
account. To avoid using your email password, follow
[Google instructions](https://support.google.com/accounts/answer/185833?visit_id=637917932546436561-2352829986&p=InvalidSecondFactor&rd=1)
to configure an App password.

> [!IMPORTANT] The Gmail account must have 2-factor authentication enabled to configure an App
> password.

## Create an Integration

1.  Navigate to Anypoint Code Builder.

2.  Open the Command Palette.

    Show me how

    - Use the keyboard shortcuts:

      - Mac: Cmd+Shift+p

      - Windows: Ctrl+Shift+p

    - Select **View** > **Command Palette**.

3.  Provide the following command:

    ```command
    MuleSoft: Develop an Integration
    ```

4.  Provide integration project properties to the **Develop an Integration** form:

    ![Develop an Integration form](/mulesoft/current/en-us/anypoint-code-builder/_images/int-create-integration-scratch.png)

    1.  Under **Project Name**, provide the name **New Case Salesforce**.

    2.  Under **Project Location**, click **Browse**, and then select your home directory.

    3.  Under **Create**, select **Empty Project**.

    4.  Select a **Mule runtime** and **Java** version.

        You can select from locally available Mule runtime and Java versions. The dropdown shows
        only the Mule runtime versions that are installed on your local disk, including bundled Mule
        runtime versions that are available immediately after installation. Anypoint Code Builder
        saves your version settings to the project’s `mule-artifact.json` file. Bundled Mule runtime
        versions enable instant project opening and design. To install additional Mule runtime
        versions, use the `MuleSoft: Install Runtime` command. For information about version support
        and automated Mule patch updates, see
        [Mule and Java version support](https://docs.mulesoft.com/anypoint-code-builder/acb-release-notes#versions-mule-jdk). To set default Mule
        runtime and Java versions for the projects you create, see
        [Version Settings for Mule, Java, and Connectors](https://docs.mulesoft.com/anypoint-code-builder/int-versions).

5.  Click **Create Project**.

    Projects open instantly using the bundled Mule runtime versions. Anypoint Code Builder provides
    a notification only if you must download a specific Mule runtime version or Java version for
    running or debugging your application. The Mule runtime versions download to
    `${user.home}/AnypointCodeBuilder/runtimes`, and the selected Java version downloads to
    `${user.home}/AnypointCodeBuilder/java`.

6.  Proceed to
    [Create a Configuration File for Slack and Salesforce](https://docs.mulesoft.com/anypoint-code-builder/tut-slack-create-config-files-sfdc) to
    create configuration files for connectors.

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