Skip to main content

Ephemeral slash-command response

Explicitly request a private response for the invoking user. Return the serialized body from the relevant slash-command or interaction handler.

Output

Local preview of the selected language’s tested example. Slack client appearance may differ; controls here do not send requests.

Only visible to you
🔎 Searching... I'll DM you when I'm done.
Serialized output
{
"mrkdwn": true,
"blocks": [
{
"type": "section",
"block_id": "<generated-block-id>",
"text": {
"type": "mrkdwn",
"text": ":mag: Searching... I'll DM you when I'm done."
}
}
],
"text": "",
"replace_original": false,
"response_type": "ephemeral"
}

Code​

Reply to a slash command with a message only the invoking user sees:

from slackblocks import MessageResponse, SectionBlock

body = MessageResponse(
blocks=SectionBlock(":mag: Searching... I'll DM you when I'm done."),
ephemeral=True,
).json()
print(body) # return this body from your slash-command handler