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

custom webhooks and other webhook modifications #43

Merged
merged 3 commits into from
May 29, 2020

Conversation

audibleblink
Copy link
Contributor

@audibleblink audibleblink commented May 27, 2020

Currently, there is no implementation that is specific to Slack Webhooks, so this PR makes it more obvious that it's just POSTing to a URL with the pre-determined JSON template of {"text": "..."}.

Also, INFO felt too low for a notification-worthy log level on slack/mattermost/etc.

The resulting notification had ANSI color characters, making it hard to read, so those were stripped as well. ( #30 )

  • raises loglevel threshold for webhook notifications
  • remove ANSI color codes from HTTP payloads for cleaner notifications
  • modify docs/code to reflect generic capabilities of webhooks

@eth0izzle
Copy link
Owner

Thanks @audibleblink.

Do you think we need a setting for the JSON template? i.e. webhook_message_format: "{'text': '%s'}" in config.yaml. And do most webhooks work with {"text": "..."}? i.e. Discord as mentioned in #29.

@audibleblink
Copy link
Contributor Author

I looked at Discord and it has a few more requirements, but having the ability to define the JSON payload in the config would allow the most flexibility.

I'd be down with adding that config option.

  * raises loglevel threshold for webhook notifications
  * remove ANSI color codes from HTTP payloads for cleaner notifications
  * modify docs/code to reflect generic capabilities of webhooks
@audibleblink audibleblink changed the title tune for optimal webhook behaviour custom webhooks and other webhook modifications May 29, 2020
@audibleblink
Copy link
Contributor Author

Alright @eth0izzle, got this working with the template string in config.yaml.

For testing with Discord, this might be useful: https://discord.com/developers/docs/resources/webhook#execute-webhook

I believe one would just need to change text to content in the config.yml

Wanna give it a shot @CyberSecGuy?

@audibleblink
Copy link
Contributor Author

audibleblink commented May 29, 2020

Spun one up and tried.
image

config.yml entry

webhook_payload: |
  {
    "content": "%s"
  }

@eth0izzle eth0izzle merged commit eadd127 into eth0izzle:master May 29, 2020
@eth0izzle
Copy link
Owner

Thanks @audibleblink

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

Successfully merging this pull request may close these issues.

None yet

2 participants