Register a command in your test workspace
Start with a Slack app already connected in Socket Mode. In the app’s Slash Commands settings, create /bh-check and give it a short description. Confirm the installation has the commands scope. Reinstall the app to the test workspace if Slack asks you to approve new scopes.
Use the same app and workspace as the deployment’s SLACK_BOT_TOKEN and SLACK_APP_TOKEN. For a new app, follow the Socket Mode setup before adding the handler.
Acknowledge first and send a test reply
Add the handler to the language’s existing starter before it opens the socket. Keep the rest of the starter initialization and its dependency manifest. The reply goes only to the user who invoked the command.
app.command('/bh-check', async ({ ack, respond }) => {
await ack();
await respond({ text: 'Hosted worker checked in.', response_type: 'ephemeral' });
});@app.command("/bh-check")
def check(ack, respond):
ack()
respond(text="Hosted worker checked in.", response_type="ephemeral")Slack expects acknowledgment within three seconds. Acknowledge before waiting on a database or external API. Slack’s slash command response rules.
Check the result from Slack and Console
- Upload the changed file and restart, or use the connected GitHub branch. Stop local test copies first.
- Open a channel in the workspace where the app is installed and run
/bh-check. Look for Hosted worker checked in. - If Slack reports a timeout, check whether the deployed code registered the handler and called
ack(). If the command is missing, check the command name and workspace installation.
A successful test confirms the handler running in the hosted worker. If mentions also go unanswered, use the Socket Mode event troubleshooting guide.