davidclin/cloudcustodian-policies

Slack webhook

Closed this issue · 2 comments

@davidclin, could you please share how you deal with slack webhooks. I've tried the last custodian release, but got an error when executed a mailer:
Traceback (most recent call last):
File "/root/cloud-custodian/c7n_mailer/bin/c7n-mailer", line 11, in
load_entry_point('c7n-mailer', 'console_scripts', 'c7n-mailer')()
File "/root/cloud-custodian/tools/c7n_mailer/c7n_mailer/cli.py", line 146, in main
MailerSqsQueueProcessor(mailer_config, aws_session, logger).run()
File "/root/cloud-custodian/tools/c7n_mailer/c7n_mailer/sqs_queue_processor.py", line 126, in run
self.process_sqs_message(sqs_message)
File "/root/cloud-custodian/tools/c7n_mailer/c7n_mailer/sqs_queue_processor.py", line 145, in process_sqs_message
sqs_message = json.loads(zlib.decompress(base64.b64decode(body)))
File "/usr/lib/python3.5/json/init.py", line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not 'bytes'

Not sure whether my settings are correct. Could you please share how you specify webhook in the configuration

@arnitolog Apologies for the delay. I didn't realize an issue had been opened until now (well >1 year)!

Anyway, hopefully you were able to figure out the problem.

Just for closure, I use a Slack webtoken and specify the token in the c7n_mailer mailer.yml file like so:

# sample Slack token
slack_token: xoxb-XXXXXXXXXXXX-<24 character string>

I'm going to close this out, but you can visit the Cloud Custodian support community in Gitter for similar requests in the future. It's a great resource.