A Slack slash command is an HTTP integration: Slack sends a form-encoded POST to your Flask route, your app verifies the signed request, acknowledges it within 3,000 milliseconds, and returns an immediate or delayed result. The reliable implementation order is to create the command in a Slack app, expose a public HTTPS endpoint, verify the raw request body, read the form fields, and move slow work behind the acknowledgement.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
How a Slack slash command works
A custom slash command belongs to a Slack app. When a user types a command such as /lookup dragon in the message composer, Slack sends an HTTP POST to the command’s configured Request URL. Your Flask application is that Request URL: it receives the request, decides whether it is authentic and authorized, and sends a response back to Slack.
As an Amazon Associate I earn from qualifying purchases.
The request is normally encoded as application/x-www-form-urlencoded, not JSON. The important fields are:
| Field | Purpose | How to use it |
|---|---|---|
command |
The invoked command, such as /lookup. |
Route or validate the command when one endpoint handles several commands. |
text |
Everything typed after the command. | Treat it as untrusted user input; parse and validate it before acting. |
response_url |
A temporary Slack URL for follow-up responses. | Use it for results that are not ready before the acknowledgement deadline. |
trigger_id |
A short-lived identifier for interactive Slack actions. | Keep it only when your workflow opens a modal or performs another supported interactive action. |
user_id |
Stable identifier for the invoking user. | Use it for authorization, auditing, and ownership checks. |
team_id |
Identifier for the Slack workspace. | Use it to select tenant configuration and enforce workspace access. |
channel_id |
Identifier for the conversation. | Use it for logging, permissions, and channel-specific behavior. |
Display names can change, so prefer the IDs for security decisions and persistent records. A custom slash command also cannot be invoked inside a message thread; make the supported conversation context clear in the command’s help text.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Prerequisites and installation
Create the Slack app and command
- Create a Slack app in the Slack API dashboard and open its Slash Commands settings.
- Add a command, for example
/lookupor/weather, and set its Request URL to the deployed Flask route, such ashttps://example.com/slack/commands. - Choose a distinctive name. Slash-command names are not namespaced; if multiple installed apps claim the same name, Slack can favor the most recently installed app.
- Install the app in the workspace where you will test it, then copy the app’s signing secret into your server’s secret manager or environment configuration.
Slack’s public-distribution setup expects a publicly reachable HTTPS endpoint with a verifiable certificate. A localhost URL is useful only when a secure tunnel or another public development gateway forwards requests to your machine.
Install Python dependencies
Flask is sufficient for a low-level route. Add the official Python Slack SDK when you want its signature and webhook helpers; choose Bolt for Python when you want a higher-level command listener with built-in acknowledgement and response helpers.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →python -m venv .venv
# macOS/Linux
source .venv/bin/activate
# Windows PowerShell
# .venvScriptsActivate.ps1
pip install Flask slack_sdk
Keep the signing secret out of source control. Set it through the deployment environment, for example with a variable named SLACK_SIGNING_SECRET.
Verify Slack requests before parsing them
Every request should be authenticated with the app’s signing secret. Slack sends the X-Slack-Signature and X-Slack-Request-Timestamp headers. The signature is an HMAC over the versioned timestamp and the exact raw request body. Read the raw bytes first, reject timestamps outside a short replay window, compute the expected signature, and compare it safely. Only after those checks should you read request.form.
Slack describes the signing secret as the per-app secret that replaces the older verification-token approach. Do not accept a request merely because a form field looks correct; an attacker can submit that field without possessing the secret.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Using the SDK’s verifier
import os
from flask import Flask, jsonify, request
from slack_sdk.signature import SignatureVerifier
app = Flask(__name__)
verifier = SignatureVerifier(
signing_secret=os.environ["SLACK_SIGNING_SECRET"]
)
@app.post("/slack/commands")
def command():
# request.get_data() preserves the exact body for verification.
if not verifier.is_valid_request(request.get_data(), request.headers):
return "invalid request", 401
text = request.form.get("text", "").strip()
if not text:
return jsonify(text="Usage: /lookup <query>"), 200
return jsonify(text=f"You asked for: {text}"), 200
The verifier method and constructor can differ between installed SDK versions, so check the reference for the version in your environment. The ordering is the critical part: capture the raw body, validate the timestamp and signature, then parse fields.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Manual verification when you need full control
The algorithm is straightforward when a framework helper is not suitable:
- Read the timestamp header and parse it as an integer.
- Reject the request if its timestamp is outside your replay tolerance. A five-minute window is a common operational choice; select and document the value for your service.
- Build the basestring
v0:{timestamp}:{raw_body}, whereraw_bodyis the unmodified byte sequence decoded exactly as received. - Compute an HMAC-SHA256 digest with the signing secret, prefix the hexadecimal digest with
v0=, and compare it withX-Slack-Signatureusing a constant-time comparison. - Return HTTP 401 for a missing, malformed, stale, or mismatched signature and do no application work.
Never log the signing secret or the complete signed body if it can contain sensitive user data. Record a request identifier, workspace ID, and verification outcome instead.
Read and validate the command payload
After verification, use request.form.get("text", "") to obtain the argument string. Empty text is valid from Slack’s perspective, so decide whether your command should show usage instructions or perform a default action. Validate length, allowed syntax, and any identifiers before passing values to a database, shell command, URL fetch, or game-service API.
Keep the other fields available for the parts of the application that need them:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
command_name = request.form.get("command", "")
argument_text = request.form.get("text", "").strip()
user_id = request.form.get("user_id", "")
team_id = request.form.get("team_id", "")
channel_id = request.form.get("channel_id", "")
response_url = request.form.get("response_url", "")
Authorize using team_id and user_id rather than mutable display names. For a sensitive operation, check that the workspace is enrolled, the user has the required role, and the command is allowed in the supplied channel.
Acknowledge within 3,000 milliseconds
Slack requires confirmation within 3,000 milliseconds of sending the request. If that deadline is missed, the user sees an operation_timeout error even if your server eventually finishes. The acknowledgement is an HTTP 200 response, optionally containing an immediate message.
Return before doing network calls, slow database queries, large computations, or blocking subprocesses. A minimal acknowledgement can be an empty 200 response:
return "", 200
For a quick command, return the result in the same response. For anything slower, enqueue a job, return a short confirmation, and let a worker post the completed result to response_url.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsImmediate response formats
Plain text is enough for a simple answer. Use JSON when you need a response type, Block Kit blocks, or attachments.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
| Response choice | Visibility | Typical use |
|---|---|---|
| Plain text | Slack displays the text according to the command’s normal private response behavior. | Usage guidance or a short personal result. |
{"response_type":"ephemeral"} |
Only the invoking user sees it. | Validation errors, private account data, and confirmations. |
{"response_type":"in_channel"} |
The channel sees the response. | A result intended for the whole conversation. |
Omitting response_type or explicitly selecting ephemeral keeps the response private. Choose in_channel deliberately: it can expose arguments or results to everyone in the channel.
Send delayed results through response_url
The request’s response_url is designed for follow-up messages after the initial acknowledgement. Queue the work, retain the URL only for the period your job needs it, and POST a JSON response when the result is ready. Slack’s archived Slash Commands API reference documents up to five responses through that URL within 30 minutes.
from slack_sdk.webhook import WebhookClient
def publish_result(response_url: str, message: str, public: bool = False) -> None:
payload = {"text": message}
if public:
payload["response_type"] = "in_channel"
else:
payload["response_type"] = "ephemeral"
WebhookClient(response_url).send_dict(payload)
In production, place the slow operation on a real task queue or worker rather than starting an unmanaged thread inside the Flask request process. Return a job reference in the immediate acknowledgement if users need a way to correlate the later result. Treat the response URL as a secret capability: do not publish it in logs, and do not let a user-supplied URL replace the one Slack sent.
A route that queues work
import os
from flask import Flask, jsonify, request
from slack_sdk.signature import SignatureVerifier
app = Flask(__name__)
verifier = SignatureVerifier(os.environ["SLACK_SIGNING_SECRET"])
@app.post("/slack/commands")
def command():
if not verifier.is_valid_request(request.get_data(), request.headers):
return "invalid request", 401
text = request.form.get("text", "").strip()
response_url = request.form.get("response_url", "")
team_id = request.form.get("team_id", "")
user_id = request.form.get("user_id", "")
if not text:
return jsonify(response_type="ephemeral",
text="Usage: /lookup <query>"), 200
enqueue_lookup(text=text, team_id=team_id, user_id=user_id,
response_url=response_url)
return jsonify(response_type="ephemeral",
text="I’m checking that now and will reply here."), 200
enqueue_lookup is intentionally an application-specific boundary. The worker should validate the stored arguments again, perform the lookup, and call publish_result; do not assume that an authenticated initial request makes every later internal operation safe.
Flask route or Bolt for Python?
Both approaches can implement the same command. The choice is mainly about how much HTTP plumbing you want to own.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
| Concern | Hand-written Flask route | Bolt for Python |
|---|---|---|
| HTTP control | Full control over the route, raw body, headers, status codes, and serialization. | Handled by Bolt’s adapter and listener layer. |
| Verification | You call SignatureVerifier or implement the checks yourself. |
Bolt performs the standard request verification when configured correctly. |
| Acknowledgement | You must return HTTP 200 within the deadline. | The listener receives an ack() helper designed for the deadline. |
| Responses | Build JSON yourself or use WebhookClient for follow-ups. |
Use the listener’s respond() helper for follow-up messages. |
| Testing | Easy to exercise as a normal Flask view with a test client and signed headers. | Convenient command dispatch tests, with an additional framework layer to configure. |
| Dependency surface | Smallest implementation when Flask already serves your application. | More framework behavior, less repetitive Slack-specific code. |
Whichever framework you choose, signing-secret protection, replay rejection, input validation, authorization, and fast acknowledgement remain your responsibility as application concerns.
Test the endpoint before installing it widely
Unit-test verification and parsing
- Send a valid signed body and confirm a 200 response.
- Change one byte of the body after generating the signature and confirm a 401 response.
- Use an old timestamp and confirm the replay check rejects it.
- Omit
textand verify that the usage response is returned without an exception. - Test long, malformed, and unexpected arguments against your parser.
- Confirm that a slow mocked dependency is queued rather than awaited in the request handler.
Exercise the deployed URL
Install the app in a test workspace and invoke the command from a normal channel. Check application logs for the command name, workspace ID, user ID, status code, and elapsed time, but redact the signing secret, response URL, and sensitive arguments. Confirm both private and channel-visible response modes with test users who can see the relevant conversation.
Troubleshoot common failures
operation_timeout appears
- Measure time from request receipt to the first 200 response, not to completion of the business operation.
- Move API calls, database work, and computation behind a queue or worker.
- Check cold starts, DNS, TLS negotiation, overloaded workers, and synchronous logging.
- Return the acknowledgement before creating optional response formatting or performing nonessential checks.
Every request returns 401
- Verify that the configured secret belongs to the installed app and has no extra whitespace.
- Make sure the raw body is passed to the verifier before accessing or rewriting form data.
- Confirm that a reverse proxy forwards both Slack signature headers unchanged.
- Check server clock accuracy; an incorrect clock can make valid timestamps appear stale.
The command reaches Flask but the argument is empty
Read request.form, not request.get_json(). Slack normally sends form encoding. Inspect the content type and use request.form.get("text", ""); do not assume a missing field is an error.
The result is visible to the wrong people
Inspect response_type. Use ephemeral for private output and in_channel only when the channel should see the result. A delayed response must also set its intended response type in the JSON sent to response_url.
The command works in a channel but not in a thread
That is expected for custom slash commands. Offer a channel-level invocation, a message action, or another interaction pattern when a threaded workflow is essential.
Production checklist
- Use a public HTTPS Request URL with a valid certificate.
- Store the signing secret in a secret manager or protected environment variable and rotate it through deployment configuration.
- Verify the raw body, reject stale timestamps, and compare signatures safely before parsing or authorizing.
- Authorize by workspace, user, and channel IDs for sensitive operations.
- Validate and bound command text before sending it to downstream systems.
- Return HTTP 200 within 3,000 milliseconds, then process slow work asynchronously.
- Protect and redact
response_urlvalues. - Document whether each command response is private or channel-visible.
- Record latency and failure metrics so timeout regressions are visible before users report them.
- Provide a usage response for empty or malformed arguments and a clear explanation of unsupported thread usage.
Request lifecycle at a glance
- Slack matches the user’s command to your installed app.
- Slack sends a signed, form-encoded POST to the configured Flask URL.
- Flask reads the raw body, validates the timestamp and signature, and rejects failures.
- The route extracts
textand stable IDs, validates authorization, and chooses a response mode. - The route returns a 200 acknowledgement before the 3,000-millisecond deadline.
- A worker completes slow work and optionally posts up to five follow-up responses through the supplied URL within its 30-minute validity window.
This separation keeps the HTTP handler predictable: authentication and acknowledgement happen synchronously, while expensive work and presentation of the final result happen independently.
Recommended Free Tools
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




