Introduction
To develop and host a Slack bot on Square Cloud, it’s essential to follow a structured sequence of configurations and prerequisites. This technical guide will cover the entire process, from initial setup to production deployment.Prerequisites
- Square Cloud Account: Register through the signup page using your email.
- Active plan: Ensures dedicated resources and optimized performance for your application. Check our available plans and choose the most suitable for your needs.
Create the project
To create a Slack bot, you will need an account and permissions to create apps on Slack. Create or access your account on Slack before following the next steps.Bot application on Slack
- Go to the Slack API - Your Apps and click “Create New App”.
- Choose “From scratch”, give the app a name and select the workspace where you will install it.
- In the “Socket Mode” section, enable Socket Mode and generate an app-level token with the
connections:writescope. Copy it (it starts withxapp-): this is yourSLACK_APP_TOKEN. - In the “OAuth & Permissions” section, add the scopes your bot needs (e.g.
chat:write,app_mentions:read,commands), install the app to your workspace and copy the Bot User OAuth Token (it starts withxoxb-): this is yourSLACK_BOT_TOKEN. - In “Event Subscriptions”, enable events and subscribe to the
app_mentionbot event. In “Slash Commands”, create the/hellocommand. With Socket Mode enabled, neither asks for a Request URL.
Develop the bot
Use the tab for the language you choose. Both examples reply to mentions and to the/hello slash command.
- Node.js - @slack/bolt
- Python - slack_bolt
- Make sure Node.js is installed.
- Initialize a project and install dependencies:
Terminal
- Create an
index.jsfile with the following content:
index.js
Configure Square Cloud
Create asquarecloud.app file at the root of your project, next to your main file. It tells Square Cloud how to run your bot:
MAINis the file Square Cloud runs, andMEMORYis the bot’s RAM in MB. Bots need at least 256 MB; 512 MB leaves room to grow.AUTORESTART=truestarts the bot again if it crashes. See how auto restart works.- There is no
SUBDOMAIN: in Socket Mode, the bot needs no public URL.
Set the tokens
Your code reads both tokens from theSLACK_BOT_TOKEN and SLACK_APP_TOKEN environment variables, so they never go into your files. Set them in one of these ways:
- Dashboard: on the upload page, open Advanced configuration and add both variables. For a bot that is already deployed, add them on the application’s Environment Variables page and restart the bot.
- CLI: right after you upload the bot (see Deploy and verify), set them with
squarecloud app env setand restart the bot:
What goes in the ZIP
- Your main file (
index.jsorapp.py) and your other source files. package.jsonorrequirements.txt.squarecloud.app.
node_modules, .venv and __pycache__: Square Cloud installs your dependencies when the bot starts.
Deploy and verify
Create the ZIP described above, then upload it:Via dashboard
1
Access the Upload Page
Access the upload page and upload your project zip file.
2
Configure Your Environment
After uploading your zip, you will need to configure the name, main file or runtime environment and other settings for your project.
If you are uploading a web project, make sure to select “Web Publication” and set a subdomain to your project.
If you are uploading a web project, make sure to select “Web Publication” and set a subdomain to your project.
3
Deploy Your Project
Finally, click on the “Deploy” button to host your project on Square Cloud.
After deployment, you can monitor your project’s status and logs from the dashboard.
After deployment, you can monitor your project’s status and logs from the dashboard.

4
Confirm Your App Is Live
Your first deploy usually takes less than a minute. In the dashboard, wait for your application status to show as running and check the logs for any startup errors.
If you deployed a website or API, open
If you deployed a website or API, open
https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
Via CLI
To use this method, your project needs a configuration file namedsquarecloud.app at its root. It tells Square Cloud how to run your application.
Configuration file guide
Learn how to create the
squarecloud.app configuration file that defines your application’s environment.1
Install the CLI
Install the Square Cloud CLI. If you already have it, run the same command to update it:
2
Log In
Run the command below. It opens your browser: approve the login there and the CLI is ready. There is no API key to copy. For scripts and CI, see CLI authentication.
3
Upload Your Project
From your project folder, run the command below. The CLI zips the current folder, leaving out what To upload a zip you created yourself, pass it with
squarecloud.ignore lists, and uploads it:--file:4
Confirm Your App Is Live
Your first deploy usually takes less than a minute. Check your application status and logs directly from the terminal:If you deployed a website or API, open
https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
Test the bot
- In the Slack app settings, under “OAuth & Permissions”, install the app to the workspace (if you haven’t already).
- Check the application logs in the Square Cloud dashboard for startup errors. With Socket Mode there is no Request URL to configure: the bot connects to Slack as soon as it starts.
- Invite the bot to a channel, then mention it or run the
/hellocommand to validate responses.
Common errors
You must provide an appToken when socketMode is set to true
Bolt for JavaScript stops at startup with this message whenSLACK_APP_TOKEN is not set. Set the app-level token (the one that starts with xapp-) and restart the bot.
Either an env variable SLACK_BOT_TOKEN or token argument in the constructor is required
Bolt for Python stops at startup with this message when SLACK_BOT_TOKEN is not set. Set the Bot User OAuth Token (the one that starts with xoxb-) and restart the bot.
The bot doesn’t answer mentions
Check that the bot is a member of the channel, that “Event Subscriptions” subscribes to theapp_mention bot event, and that you reinstalled the app after adding scopes.
Use HTTP mode instead of Socket Mode
Apps that use Socket Mode can’t be listed in the public Slack Marketplace. If you need Slack to send events over HTTP instead, run the bot as a web application:- In the Slack app settings, disable Socket Mode and copy the Signing Secret (under “Basic Information”) into a
SLACK_SIGNING_SECRETenvironment variable, set the same way as the tokens. - Create the app with the signing secret instead of the app-level token, and listen on the port in the
PORTenvironment variable:
0.0.0.0), which Square Cloud requires.
- Add a
SUBDOMAINto your configuration file (or select “Web Publication” and set a subdomain when uploading from the dashboard) so the bot gets a public URL. Web applications need at leastMEMORY=512:
squarecloud.app
An application uploaded without a subdomain can’t get one later. If your bot already runs in Socket Mode, upload the HTTP version as a new application.
- In “Event Subscriptions” and in the
/helloslash command, set the Request URL tohttps://<subdomain>.squareweb.app/slack/events.
Next steps
App won't start
Fix missing modules, memory errors and other startup failures.
Environment variables
Manage your bot’s tokens and other secrets.
Discord bot
Host a Discord bot next to your Slack bot.

