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

Add support for all of Slack's Message API #26

Open
seanmuth opened this issue May 3, 2016 · 2 comments
Open

Add support for all of Slack's Message API #26

seanmuth opened this issue May 3, 2016 · 2 comments

Comments

@seanmuth
Copy link

seanmuth commented May 3, 2016

Not all of the different hashes supported by Slack's Message API are supported by this plugin.

For example the following config:

input {
  stdin {
  }
}

output {
  slack {
    url => "https://hooks.slack.com/services/mywebhookurl"
    channel => "@sean.muth"
    attachments => [
        { fallback      => "This is the FALLBACK Message" },
        { color         => "#ff0000" },
        { title         => "This is the Title" },
        { title_link    => "http://google.com" },
        { author        => "This is the author" },
        { author_link   => "http://google.com"},
        { fields        => [
                { title => "Error Message"},
                { value => "This is the error message."},
                { short => false}
          ]}
        ]
  }
}

Won't include the author at all, won't include the link for the title text, and isn't displaying the message "bar" in red. I'm also not sure how to add more than one field, as they are JSON arrays. (That could just be because I'm not formatting my attempts to add more than one field correctly)

The docs for Slack's Message API are here

@hatchetation
Copy link

@seanmuth I think your attachments is mal-formed - looks like you're accidentally trying to send a message with seven attachments.

You probably want to try something more like this:

attachments => [{
  text => "This is an example message"
  color => "#ff0000"
}]

@seanmuth
Copy link
Author

@hatchetation you could be onto something there. I know I messed with a ton of different configs trying to get it to allow me to include multiple nodes of an attachment, as per the Slack Docu, but never got anywhere.

Ended up just using the http{} output and constructing my own JSON payload for slack, works like a charm!

I'm also not at the company I did this for, so I haven't looked at it in a while

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

2 participants