Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send message with different username and/or icon #76

Open
pintodossantos opened this issue Jul 4, 2018 · 1 comment
Open

Send message with different username and/or icon #76

pintodossantos opened this issue Jul 4, 2018 · 1 comment

Comments

@pintodossantos
Copy link

Hi,

is there any possibility to get a behavior similar to this other slack CLI-tool (https://www.npmjs.com/package/slack-cli), where a message can be sent with a different username and even with a different user-icon?
I think this would be a nice addition, so if I wanted to have a script post something to my slack channel, it would be easier to spot for the other users...
See also this youtube-video for clarification:
https://www.youtube.com/watch?v=WWljTSHRmmU&t=38s

Thank you for your help!

@pintodossantos
Copy link
Author

Hi,

I just looked through the code and it seems modifying the chatsend() function as follows would do the trick:

function chatsend() {
  [ -n "${stdin}" ] && [ -z "${text}" ] && text=\`\`\`${stdin//$'\n'/'\n'}\`\`\`

  local msg=$(\
    curl -s -X POST https://slack.com/api/chat.postMessage \
      --data-urlencode "username=testbot" \
...

Now, I saw that there is also a --user option... However, I did not yet understand what the best way would be to pass this option to chatsend() and in case it is missing use --as_user=true.
I would be very happy if you could implement that...

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant