Setup an existing app BETA

    If you would like to setup an existing Slack app with the beta tools from the next-generation platform, this guide is for you!

    If you do not have an existing Bolt for JavaScript application but are looking to get started with the next-gen platform, check out the Getting Started guide.


    Prerequisites

    Before we get started, make sure you’ve followed the steps up to the “Accept the Beta Terms of Service” section to install required dependencies in the Getting Started guide.


    Set up your app to work with the Slack CLI

    Clone your app to your local file system.

    Update your project’s version of Bolt in your package.json to the next-gen distribution and reinstall your dependencies: rm -rf node_modules package-lock.json && npm install

    1
    2
    3
    
      "dependencies": {
        "@slack/bolt": "next-gen",
      }
    

    Add a slack.json file to your local project root containing this.


    Add your manifest

    Head to your app’s App Config Page and navigate to Features > App Manifest. Download a copy of your app manifest in the JSON file format.

    Add this manifest.json to your project root. This represents your project’s existing configuration.

    Now let’s add a new file in the project root entitled manifest.js and initialize a Manifest with the runOnSlack property set to false.

    1
    2
    3
    4
    
    const { Manifest } = require('@slack/bolt');
    module.exports = Manifest({
        runOnSlack: false,
    });
    

    runOnSlack is a required property of the manifest if you intend to use next-generation platform features - functions, workflows, triggers. It means that your app will run on your own hosting solution and not on Slack and currently must be set to false

    Bolt will handle merging properties defined in this Manifest() and in any manifest.json in the project, but we encourage you to begin to migrate other features into code. Check out our more detailed guide on app manifests.


    Now let’s run the Slack CLI command slack manifest to generate your merged manifest. It should contain at least these settings.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    {
      "_metadata": {
        "major_version": 2
      },
      "oauth_config": {
        "token_management_enabled": true  
      },
      "settings": {
        "interactivity": {
          "is_enabled": true
        },
        "function_runtime": "remote",   
      },
      "org_deploy_enabled": true       
    }
    

    Run slack manifest validate to validate your App’s configuration with Slack API.


    Run your app!

    Run the Slack CLI command slack run to start your app in local development.

    The CLI will create and install a new development app for you with its own App ID, allowing you to keep your testing changes separate from your production App). It will also start your app in local development mode (SocketMode) and turn logging on.

    Now you’re ready to start adding functions and workflows to your app!


    Updating your app configuration

    You have probably made changes to your app’s manifest (adding a function or a workflow, for example). To sync your production app’s configuration with the changes you’ve made in development:

    • Authenticate the Slack CLI with your desired production workspace using slack login.
    • Head over to ./slack/apps.json and make sure an entry exists for your workspace with the current app_id and team_id of the workspace.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    {
      "apps": {
        "<your-workspace-name>": {
          "name": "<your-workspace-name>",
          "app_id": "A041G4M3U00",
          "team_id": "T038J6TH5PF"
        }
      },
      "default": "<your-workspace-name>"
    }
    
    • Run slack install and select your app. Select your workspace from the list prompt to install.

    Conclusion

    Congratulations on migrating your app to the your next-generation Slack Platform! 🎉 You can continue your journey by learning about app manifests or looking into adding functions and workflows to your app!