首页 > 解决方案 > 我需要提供什么链接才能使用 Bolt 正确安装我的 Slack 应用程序?

问题描述

我一直在想办法在我的工作区正确安装我的 Slack 应用程序。我正在使用 Bolt Node.js 框架来执行此操作,并且我正在使用以下端点进行安装

https://mysite/slack/install

但是,一旦我导航到此页面,它就会说找不到该页面。我以为这个页面应该返回一个按钮来安装应用程序?

另外,我列出了重定向 URL 到这个端点,但我仍然得到同样的错误。

这是一些代码

const app = new Bolt.App({
  token: BOT_TOKEN,
  clientId: CLIENT_ID,
  clientSecret:CLIENT_SECRET,
  signingSecret: SIGNING_SECRET,
  scopes: ['chat:write','commands','channels:history','groups:history','users:read'],
  installationStore: {
    storeInstallation: async (installation) => {
      console.log(installation)
      if (installation.isEnterpriseInstall && installation.enterprise !== undefined) {
        console.log(installation.enterprise.id)
      }
      if (installation.team !== undefined) {
        console.log(installation.team.id)
      }
    },
    fetchInstallation: async (installQuery) => {
      console.log(installQuery)
      if (installQuery.isEnterpriseInstall && installQuery.enterpriseId !== undefined) {
          console.log(installQuery.enterpriseId)
      }
      if (installQuery.teamId !== undefined) {
        console.log(installQuery.teamId)
      }
    },
    deleteInstallation: async (installQuery) => {
      console.log(installQuery)
      if (installQuery.isEnterpriseInstall && installQuery.enterpriseId !== undefined) {
          console.log(installQuery.enterpriseId)
      }

      if (installQuery.teamId !== undefined) {
        console.log(installQuery.teamId)
      }

    }
  }
})

标签: javascriptslackslack-api

解决方案


推荐阅读