Skip to content
Latchkey

How to Send Ephemeral Responses to Slack ChatOps Commands

An ephemeral Slack reply is seen only by the user who ran the command, ideal for acknowledgements and validation errors.

Return response_type: ephemeral from the slash command handler so the immediate reply is private. Use in_channel only for results the whole channel should see.

Steps

  • Ack the command within 3 seconds with an ephemeral message.
  • Use response_type: ephemeral for private replies.
  • Post an in_channel message only for shared results.

Ephemeral reply

Terminal
# immediate response body from the slash command handler
{
  "response_type": "ephemeral",
  "text": "Deploy to staging queued. You will get a DM when it finishes."
}

# later, an in_channel result via response_url
curl -X POST -H 'Content-type: application/json' \
  --data '{"response_type":"in_channel","text":"Deploy to staging succeeded."}' \
  "$RESPONSE_URL"

Gotchas

  • Slack requires a response within 3 seconds; ack ephemerally and finish the work asynchronously.
  • The response_url is valid for a limited time and a limited number of posts.
  • Keep authorization errors ephemeral so you do not leak who tried what to the channel.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →