Contact Us 1-800-596-4880

Configure Slack Integration

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:

    A workflow with the *Temporary Logger* component highlighted, both in the flow canvas UI and in the code view
    <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:

    A flow in the canvas UI with the *Add Component* button highlighted
  3. Click the (Search in Exchange) icon, type Slack, and select Slack Connector:

    A list of search results with the Slack connector highlighted
  4. Select the Chat: Post Message operation from the Slack section:

    A list of search results containing Slack connector components
  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:

    The Setup menu with the App Launcher button icon highlighted
  5. Select Cases > New Case:

    The Service navigation bar with the *New Case* button highlighted in the Cases section
  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