Contact Us 1-800-596-4880

Configure Slack Integration

logo cloud IDE Cloud IDE

logo desktop IDE Desktop IDE

Open Beta Release: The cloud IDE is in open beta. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.

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.

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:

    delete temporary logger slack
    <logger doc:name="Temporary Logger" message='#["Please look into this new Case: " ++ payload]'/>
  2. Click the (Add component) icon after the Not Escalated route of the Choice router:

    add slack action example canvas
  3. Click the (Search in Exchange) icon, type Slack, and select Slack Connector:

    add slack connector canvas exchange
  4. Select the Chat: Post Message operation from the Slack section:

    select post message operation
  5. Configure the Slack operation using the following code sample:

    <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>
    1 Set the channel field to the channel name that you set earlier in the tutorial.

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:

    <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:

    salesforce select service
  5. Select Cases > New Case:

    salesfroce create new case
  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:

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