os / slacker

Full-featured Python interface for the Slack API
Apache License 2.0
1.6k stars 245 forks source link

File.upload - supports as_user? #144

Closed psyciknz closed 5 years ago

psyciknz commented 6 years ago

Can the files.upload api call support as_user?

I use https://github.com/jpmens/mqttwarn, a service with slacker in it for posting notifications. There's a user parameter that can be set up that makes a post message appear as a user posted in the configuration of the service. It uses teh as_user parm of the chant message:

slack.chat.post_message(channel, text, as_user=as_user, username=username, icon_emoji=icon, unfurl_links=True)

I've been adding image support, so that an image can be posted to slack from the service (hence the issue: https://github.com/os/slacker/issues/140).

But when I post as image, it comes through as admin, rather than the user as per the chat message.

Though if I'm reading this right: https://api.slack.com/methods/files.upload it's not possible.

os commented 5 years ago

Hi @psyciknz,

You're right, unfortunately there's no such thing as as_user parameter. I think you need to create a bot token and use that one instead.