I'm building a Slack bot with slash commands and I would like to post a message with an attachment as a specific user (specifically, the user that called the slash command).
I know this is possible because the Giphy Slack integration does so when responding to the /giphy [image]
command, by responding as the user with a gif image.
- I tried using the
chat.meMessage
method but this does not appear to support attachments. - I tried using the
as_user
argument in thechat.postMessage
method, but this inherits the authenticated user rather than the user that called the slash command. - Responding to the slash command immediately or performing a delayed response (using
response_url
) doesn't seem to support non-bot responses. If they do, I can't seem to find where it's documented.
In the slash request Slack does provide both user_id
and user_name
parameters, so I imagine I can make use of those.