mrkaye97 / slackr

An R package for sending messages from R to Slack
https://matthewrkaye.com/slackr/
Other
307 stars 84 forks source link

Not resolved - "icon_emoji bug?" (in closed) #69

Closed nataliagalant closed 3 years ago

nataliagalant commented 6 years ago

I think you are misunderstanding the problem. People here are not talking about adding an emoticon to some text BUT posting "some text" and using an emoticon as the ICON displayed next to their username...

you need to change this in your slackr and slackr_msg functions: According to the slack api documentation (https://api.slack.com/methods/chat.postMessage), icon_emoji and username parameters are ignored if as_user is TRUE. You simply need to change

resp <- POST(url="https://slack.com/api/chat.postMessage", body=list(token=api_token, channel=slackr_chtrans(channel), username=username, icon_emoji=icon_emoji, text=output, as_user=TRUE, link_names=1, ...))

to: resp <- POST(url="https://slack.com/api/chat.postMessage", body=list(token=api_token, channel=slackr_chtrans(channel), username=username, icon_emoji=icon_emoji, text=output, as_user=FALSE, link_names=1, ...))

and these functions will actually change icon_emoji and username as expected