SlackApp

Represents a Slack app. This type extends the MetadataWithContent metadata type and inherits its content and fullName fields.

The file suffix is .slackapp for the Slack app configuration file. The accompanying metadata file is named YourAppName.slackapp-meta.xml. The files are stored in the slackapps folder in the corresponding package directory.

Slack apps are available in API version 54.0 and later.

To use this metadata type, your org must have Slack capabilities and packaging enabled. You must also enable user permissions to connect Salesforce with Slack.

Field NameField TypeDescription
appKeystringRequired. The app ID, as shown on the Slack app's Basic Information page.
appTokenstringRequired. The app token, as shown on the Basic Information page. The app token starts with xapp- . Retrieving this field isn't supported. The app token is always returned as *.
botScopesstringThe comma-separated list of scopes that determine what your app can access, as shown on the OAuth & Permissions page. For example, chat:write lets your app post messages. See Slack API: Permission scopes.
clientKeystringRequired. The client ID, as shown on the Basic Information page. Retrieving this field isn't supported. The client ID is always returned as *.
clientSecretstringRequired. The client secret, as shown on the Basic Information page. See Slack API: oauth.v2.access. Retrieving this field isn't supported. The client secret is always returned as *.
contentbase64BinaryThe page content. Base 64-encoded binary data. Prior to making an API call, client applications must encode the binary attachment data as base64. Upon receiving a response, client applications must decode the base64 data to binary. This conversion is usually handled for you by a SOAP client. This field is inherited from the MetadataWithContent component.
fullNamestringThe developer name used as a unique identifier for API access. fullName can contain only underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. This field is inherited from the Metadata component.
isProtectedbooleanIndicates whether the Slack app is protected (true) or not (false). If true, only this package can reference the Slack app directly.
masterLabelstringRequired. Name of the Slack app that appears in the Salesforce user interface.
signingSecretstringRequired. The string that Slack uses to sign the request. Retrieving this field isn't supported. The signing secret is always returned as *.
userScopesstringThe comma-separated list of scopes that access user data and act on behalf of users that authorize them. For example, channels:write manages a user's public channels and create new ones on a user's behalf. See Slack API: Permission scopes.

SlackApp enables you to configure your app's info, configuration, and connection.

Create the following files:

  • <appname>.slackapp-meta.xml defines your app connection, such as your app key and token.
  • <appname>.slackapp defines your app handlers for slash commands, shortcuts, and event handlers in YAML format.

By default, posting to Slack on behalf of the app is restricted. If the app is protected, Apex references to the app, like Slack.App.namespace.AppName, fail at save time.

This is the definition of a Slack app in the MySlackApp.slackapp-meta.xml file.

Replace the botScopes, userScopes, and other field values with your own.

The corresponding MySlackApp.slackapp configuration file in YAML format, which defines the commands and shortcut handlers. See Define an App.

In the /classes directory, create the SayHello.cls Apex class and the SayHello.cls-meta.xml files. This class retrieves the hello example view definition. See ViewDefinition.

The SayHello.cls-meta.xml file looks like this.

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.