Accelerator Slack System API - Implementation Template

(0 reviews)
Component of MuleSoft Accelerator for Salesforce Clouds

home

This API implementation template is a shared component of MuleSoft Accelerators, which accelerate the implementation of essential integration use cases.

The solution includes pre-built APIs, connectors, and integration templates that help unlock business-critical data from external systems and guide you in adopting best practices synthesized from thousands of customer implementations. Use these assets as is or extend them to meet your company’s unique needs.


Overview

This integration template implements the Slack System API specification. This API provides the functionality to send text messages to specific Slack channels.

Getting started

bulb.png The Getting Started with MuleSoft Accelerators guide provides general information on getting started with the accelerator components. This includes instructions on setting up your local workstation for configuring and deploying the applications.

Once your workstation has been set up and the application template imported into Anypoint Studio, proceed with the Prerequisites section.

Prerequisites

This implementation template has the following dependencies:

  • A channel configured in Slack
  • A connected app that can post to the channel

Creating a Connected App in Slack

  • Navigate in your browser to "https://api.slack.com/apps/"
  • On the top right, select "Your Apps". You may need to authenticate first if you are not running Slack locally.
  • Beside "Your Apps" there is a green "Create New App" button. Select it.
  • Enter an App Name and select the appropriate workspace that will be used. Select "Create App".
  • The application should now be a member of the "Your Apps" list. Select it by clicking on the name.
  • Select "OAuth & Permissions" on the left and scroll down to Scopes
  • "Bot Token Scopes" are only required if you plan to use a bot account rather than a user account to post messages to channels
  • Add the following scopes to either "Bot Token Scopes" or "User Token Scopes" (or both): channels:read chat:write
  • Click "Install to Workspace". Your organization may require permission from its Slack administrator.
  • Review the settings and click "Allow".
  • Copy the OAuth token and set it as the value for the slack-sys-api.slack.access-token property value, either on the command line when running locally or in the CloudHub-DEV profile (see below).

Deployment

Each Accelerator implementation template in Exchange includes Bash and Windows scripts for building and deploying the APIs to CloudHub. These scripts depend on repositories, global settings, deployment profiles, and associated properties configured in the Maven settings.xml file. In particular, make sure the common properties for your environment have been provided in the CloudHub-DEV profile (e.g., Anypoint Platform client ID and secret).

For additional details, please refer to the Application Deployment section of the Getting Started Guide.

Preparation

Ensure the Maven profile CloudHub-DEV has been properly configured in your settings.xml file. In particular, make sure the common properties for your environment have been provided (e.g., Anypoint Platform client ID and secret).

Required property overrides

Many templates can also be run from Anypoint Studio without having to customize the Run/Debug profiles. However, some templates make use of hidden deployment properties to protect sensitive information (e.g., passwords and secret keys). These properties must be supplied to the runtime by updating the configuration profile and adding them as VM arguments. At a minimum, the following properties must be customized to reflect the target deployment environment.

Property NameDescription
api.autodiscoveryIDRequired if using API Manager to secure this API
slack.hostHostname or IP address of the target Slack instance
slack.portPort number for the Slack API
slack.pathBase Path of the Slack API
slack.access-tokenAccess Token for the Slack API

Testing

Use Advanced Rest Client or Postman to send a request over HTTPS. The template includes a Postman collection in the src/test/resources folder. Be sure to update the collection variable(s) after successful import.

Additional resources


Reviews

TypeTemplate
OrganizationMulesoft Inc.
Published by
MuleSoft Solutions
Published onApr 23, 2024
Asset overview

Asset versions for 2.1.x

Asset versions
VersionActions
2.1.1