@stamp-lib/stamp-slack-plugin
v0.10.0
Published
1. Replace `<Stamp domain>` with your Stamp domain in [manifest](./manifest.yml). 2. Create a Slack App using the [manifest](./manifest.yml) and install it to your workspace: [Slack Manifest Documentation](https://api.slack.com/reference/manifests) 3. Dep
Readme
plugins - slack
How to setup
- Replace
<Stamp domain>with your Stamp domain in manifest. - Create a Slack App using the manifest and install it to your workspace: Slack Manifest Documentation
- Deploy cf-template.yaml (slack) to CloudFormation
How to use multiple workspaces
If you want to use multiple workspaces, you can create multiple instances of the Slack plugin.
- Each instance should have a different
basePath,workspaceIdandworkspaceNamein the configuration. dynamoDBTableNamePrefixshould be the same for all instances.- You need create a Slack App for each workspace and set the
slackSigningSecret,slackBotToken,slackVerificationToken,slackClientId,slackClientSecretfor each workspace.
const slackPluginForWorkspaceA = await createSlackPlugin({
slackSigningSecret: "XXXXX",
slackBotToken: "XXXXX",
slackVerificationToken: "XXXXX",
slackClientId: "XXXXX",
slackClientSecret: "XXXXX",
hostDomain: "example.com",
stampHubUrl: "http://localhost:4000",
dynamoDBTableNamePrefix: "XXXXX",
region: "us-west-2",
logLevel: "INFO",
basePath: "/plugin/slack-workspace-a", // Set For each workspace. Format is `/plugin/slack-<workspaceId>`.
workspaceId: "workspace-a", // Set For each workspace
workspaceName: "Workspace A", // Set For each workspace
});
const slackPluginForWorkspaceB = await createSlackPlugin({
slackSigningSecret: "XXXXX",
slackBotToken: "XXXXX",
slackVerificationToken: "XXXXX",
slackClientId: "XXXXX",
slackClientSecret: "XXXXX",
hostDomain: "example.com",
stampHubUrl: "http://localhost:4000",
dynamoDBTableNamePrefix: "XXXXX",
region: "us-west-2",
logLevel: "INFO",
basePath: "/plugin/slack-workspace-b", // Set For each workspace. Format is `/plugin/slack-<workspaceId>`
workspaceId: "workspace-b", // Set For each workspace
workspaceName: "Workspace B", // Set For each workspace
});
const config = await createConfigProvider({
catalogs: [
// Add your catalog config here
],
notificationPlugins: [slackPluginForWorkspaceA.notificationPluginConfig
, slackPluginForWorkspaceB.notificationPluginConfig],
],
});
const pluginRouter = createPluginRouter({
basePath: "/plugin",
plugins: {
// For each workspace, the plugin key should be `slack-<workspaceId>`
"slack-workspace-a": slackPluginForWorkspaceA.router,
"slack-workspace-b": slackPluginForWorkspaceB.router,
// Add other plugins here
},
});How to execute test
Required Environment Variables
Basic test environment variables:
export SLACK_BOT_TOKEN=<Slack bot token from your Slack app> export SLACK_CHANNEL_ID=<Slack channel ID for posting test messages> export TABLE_NAME_PREFIX=<TableNamePrefix you specified in CloudFormation template>Additional environment variables for integration tests (e.g.,
approveButton.test.ts):export SLACK_TEST_BOT_TOKEN=<Slack bot token from a separate test app>
Slack App Token Configuration
SLACK_BOT_TOKEN: Token from Slack App defined in manifest.yml- Required scopes (defined in manifest.yml):
channels:read,groups:read,usergroups:readim:write,chat:writeapp_mentions:read,im:historyincoming-webhook,commands
- Required scopes (defined in manifest.yml):
SLACK_TEST_BOT_TOKEN: Token from a separate test-only Slack App (optional, only for integration tests)- Required scopes:
channels:history(orgroups:historyfor private channels)
- Used for:
conversations.historyto verify message content after updates
- Required scopes:
Running Tests
plugins/slack % npm run test