I am created slack bot, is there is any possible way send reply message as file? (I need to sent some file as reply message based on input). I tried using api file.upload it make the file as private not able access using url, but if i am upload to channel using sampe api, file is public, is there any way to send direct message as file by bot)
Yes. You can share a file directly and privately with a user by sharing it in a direct message channel with the user.
Just put the {user-id}
of the user you want to share the file with in the channels
parameter of the files.upload API method and you are all set.
Your slack app will need the files:write:user
scope. This also works with bots.
Example for user with ID U12345678
:
curl -F content="Hello" -F channels=U12345678 -F token=xoxp-your-token-here https://slack.com/api/files.upload
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With