Deploy your appBETA

    ⚠️ Using Heroku dynos to complete this tutorial counts towards your usage. Delete your app as soon as you are done to control costs.

    Currently, Bolt applications cannot be deployed on Slack infrastructure. However, never fear - you can deploy your Bolt app to the Heroku platform to keep your app running at all hours of the day, not just during your development sessions!

    In this guide, you will find the steps needed to prepare and deploy your app to Heroku, as well as how to inspect your activity logs and make updates to your app.

    Before you begin

    Before you can deploy a Bolt app to Heroku, you’ll need a working Bolt app. If you haven’t created one yet, go ahead and make one! If you already have an app and want features of the next-generation platform, check out the Bolt for JavaScript setup guide.

    Additionally, you will need to have at least one trigger created for your application to confirm that your application has successfully deployed to Heroku. If you haven’t created one yet, you can learn about the different types of triggers and how to create a trigger for tapping into your workflows.

    💡 List your application’s existing triggers by running slack triggers list in your project directory and selecting a workspace where it is installed!

    With your app and trigger created, you can now use the slack run command to make sure your app starts successfully and appropriately responds to triggers from your machine.

    Since we’re deploying to Heroku, having a Heroku account will also be useful. If you don’t have one, create one here.

    In order to manage, deploy, and debug your app on Heroku, you’ll also need to install the Heroku CLI onto your machine and authenticate using heroku login.

    And lastly, to manage the version of your project being deployed, you’ll need to install Git and initialize your app’s repository using git init if you have not already done so.

    Create a Heroku app

    With a Bolt app ready to go and Heroku tools installed, you’re now ready to start deploying your Bolt app on Heroku!

    Creating new Heroku apps will use your existing Heroku plan subscription. When getting started or deploying many small apps, we recommend starting with Heroku’s low-cost Eco Dyno plan.

    💡 Eligible students can apply for platform credits through the Heroku for GitHub Student program.

    Create a new app

    From the command line, go to your project directory and start by creating a Heroku app with a unique name:

    $ heroku create your-heroku-app

    or have some fun with a random name:

    $ heroku create
    # Creating app... done, ⬢ aqueous-escarpment-85734
    # |

    After your Heroku app is created, you’ll be given app-specific information for use in later steps. From the example above:

    • App name: aqueous-escarpment-85734
    • Web address:
    • Git remote:

    Add environment variables

    The tokens and environment variables used by your Bolt app can be added to your Heroku app environment using the following commands:

    $ heroku config:set --app HEROKU_APP_NAME SLACK_APP_TOKEN=xapp-your-app-level-token
    $ heroku config:set --app HEROKU_APP_NAME SLACK_BOT_TOKEN=xoxb-your-bot-token

    These tokens can be collected from your App Config page. The app-level token can be found on the “Basic Information” page, while the bot-level token can be found under “OAuth & Permissions”.

    💡 Note that these tokens and variables don’t necessarily have to match those used in development! For instance, you may want to use tokens for a different app or a more verbose logging output in production. This is where you would set that.

    Prepare your app for Heroku

    For a successful deployment, you’ll need to set up a few additional things in your app.

    Add the Git remote

    Code is deployed to Heroku by pushing code from your local repository to the Git remote from when you created an app.

    You can check if this remote was automatically added by the Heroku CLI when your app was created like so:

    $ git remote -v
    # heroku (fetch)
    # heroku (push)

    But if there is no heroku remote, you can add one as follows:

    $ git remote add heroku

    Add a Procfile

    To specify the start command of your app for Heroku, a special file called Procfile must be created in your app’s root directory.

    The contents of this file will vary depending on if your app connects with Socket Mode or uses public HTTP endpoints to handle requests. To check whether Socket Mode is enabled for your application, you can either:

    • Check your app’s manifest to see if socketModeEnabled: true, or
    • Visit the “Socket Mode” section on your app’s App Config page to check if Socket Mode has been enabled:

    The toggle for connecting with Socket Mode on the App Config page is enabled

    If you are using Socket Mode, your Procfile should contain the following:

    worker: node app.js

    While those using default web connections will have the following Procfile:

    web: node app.js

    With this new file saved, go ahead and commit it to your Git repository:

    $ git add Procfile
    $ git commit -m "Add Procfile"

    Deploy your app

    After creating and configuring your Bolt and Heroku app, you’re ready for deployment!

    💾 The triggers created with the CLI for the local “(dev)” version of your app will continue to work after the app is deployed!

    Push your code

    But before you can deploy, you should ensure that you have committed all of the source code your app needs to run!

    You can view your unstaged changes using git status and commit those changes using the following flow:

    # Add all remaining unstaged changes
    $ git add .
    # Commit the added files
    $ git commit -m "Add in any final unstaged changes"

    After adding and committing the source code of your app to the main branch of your repo, push it to your Heroku remote to start a deployment:

    $ git push -u heroku main

    Logs showing the process of your app being built by Heroku will then begin to stream in. After a moment for installing dependencies, messages indicating a successful deployment should follow as so:

    remote: -----> Build succeeded!
    remote: -----> Discovering process types
    remote:        Procfile declares types     -> worker
    remote:        Default types for buildpack -> web
    remote: -----> Compressing...
    remote:        Done: 44.2M
    remote: -----> Launching...
    remote:        Released v6
    remote: deployed to Heroku
    remote: Verifying deploy... done.
       5856f44..e322699  main -> main
    branch 'main' set up to track 'heroku/main'.

    Start your app

    To kick things off on Heroku, you might have to scale up a dyno! Unlike the ancient creatures of an earlier era, these dynos are lightweight containers for running your app on the Heroku platform.

    The type of dyno you scale will depend on your connection type, but should be similar to what you used in your Procfile since the dyno type determines which process is run.

    Apps connecting with Socket Mode must stop the automatically created web dyno and start a worker dyno:

    $ heroku ps:scale web=0 worker=1

    While apps using web connections can be started with just the web dyno:

    $ heroku ps:scale web=1

    Settings for apps not using Socket Mode

    Apps that use a Request URL to receive events and actions from Slack should update this URL to match the web address of your new Heroku dyno. Apps that connect over Socket Mode can skip this step.

    For this, we will use the “Web URL” found from heroku info to update the Request URL on both the Interactivity & Shortcuts page and the Event Subscriptions page for your Slack app.

    💡 Your Request URL will end with /slack/events, such as

    Test your Slack app

    At this step your app should be live, listening for messages, events, or whatever else you have coded up! Go ahead and jump into a workspace with your app to test things out! 🚀

    Now would be a terrific time to try tripping your trigger to test that your workflows are executing as expected - however, make sure to confirm that you’re not running the app locally! A successfully deployed Heroku app is one that is not running locally and will still fully execute your trigger and all functionality associated with it.

    Inspecting the activity logs

    Sometimes problems arise in the deployment process that can be difficult to spot. If your app doesn’t seem to be running as expected, inspecting the activity logs may reveal the source of the problem.

    To inspect the live activity logs of your deployed app, run heroku logs --tail.

    2022-10-07T17:47:59.026002+00:00 app[api]: Scaled to web@0:Free worker@1:Free by user
    2022-10-07T17:48:01.606472+00:00 heroku[worker.1]: Starting process with command `node app.js`
    2022-10-07T17:48:02.353986+00:00 heroku[worker.1]: State changed from starting to up
    2022-10-07T17:48:03.620821+00:00 app[worker.1]: [DEBUG]  web-api:WebClient:1 apiCall('') start
    2022-10-07T17:48:03.621182+00:00 app[worker.1]: [DEBUG]  web-api:WebClient:1 will perform http request
    2022-10-07T17:48:03.662470+00:00 app[worker.1]: [DEBUG]  web-api:WebClient:1 http response received
    2022-10-07T17:48:03.663064+00:00 app[worker.1]: [DEBUG]  socket-mode:SocketModeClient:0 Transitioning to state: connecting:authenticated
    2022-10-07T17:48:03.666960+00:00 app[worker.1]: ⚡️ Bolt app is running! ⚡️
    2022-10-07T17:48:03.692653+00:00 app[worker.1]: [DEBUG]  socket-mode:SocketModeClient:0 Transitioning to state: connected:ready

    Here, you will find outputs and errors from your new Heroku app, giving you insight into your app’s activity!

    Updating the code

    New features, functionalities, or other updates to your app are automatically deployed after being committed and pushed to the main branch on your Heroku remote! This is all possible thanks to the Procfile made earlier.

    🎞 Different deployments of your app can be displayed with heroku releases, and you can rollback to a specific release using heroku releases:rollback v12.

    If you are using the Bolt for JavaScript Starter Template and want to see a change in action, you can update the greeting variable declaration in listeners/functions/hello-world.js like so:

    // listeners/functions/hello-world.js
    const greeting = `${salutation}, <@${recipient}>! :sparkles: A mysterious message has arrived for you: \n\n>${message}`;

    Then add, commit, and push your code to deploy this change to Heroku:

    $ git commit -am "Add mystery to the greeting message"
    $ git push -u heroku main

    After the “Build succeeded!” and “Verifying deploy… done.” messages appear, your app will have this newfound functionality! You can now test your trigger again to verify the new change.

    Next steps

    Congratulations! You’ve just deployed, updated, and inspected your next-generation Bolt for JavaScript app on Heroku! 🎉

    You can now go forth to explore and customize your app using the different capabilities of the next-generation platform! Check out some of these features that will help you build the next-gen app of your dreams:

    • Built-in functions, a collection of Slack-native actions like sending a message or creating a channel.
    • Custom functions for creating your own building blocks that accepts inputs, does something, and provides outputs.
    • Workflows that combine functions into a sequence of steps that are executed in order.
    • Triggers for invoking a workflow in response to a link click, scheduled time, or another event.

    Our next-generation platform is currently in beta. Your feedback is most welcome - all feedback will help shape the future platform experience!