Skip to content

Commit

Permalink
[Handlers] SES, SNS, Twilio, Stored Procedure, SMTP (#284)
Browse files Browse the repository at this point in the history
* Adds SES, SNS, Stored Procedure, Twilio, and SMTP handlers, contributed by Roman Dobrik
  • Loading branch information
sfc-gh-gbutzi authored and sfc-gh-afedorov committed Sep 10, 2019
1 parent bc6db36 commit b5011a0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/runners/handlers/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def message_template(vars):
return payload


def handle(alert, recipient_email=None, channel=None, template=None, message=None, file_content=None, file_type=None, file_name=None, slack_api_token=None):
def handle(alert, recipient_email=None, channel=None, template=None, message=None, file_content=None, file_type=None,
file_name=None, slack_api_token=None):
if 'SLACK_API_TOKEN' not in os.environ and slack_api_token is None:
log.info(f"No SLACK_API_TOKEN in env, skipping handler.")
return None
Expand Down Expand Up @@ -121,7 +122,14 @@ def handle(alert, recipient_email=None, channel=None, template=None, message=Non
attachments=attachments
)

file_descriptor = sc.api_call("files.upload", content=file_content, title=text, channels=channel, filetype=file_type, filename=file_name)
file_descriptor = sc.api_call(
"files.upload",
content=file_content,
title=text,
channels=channel,
iletype=file_type,
filename=file_name,
)

if file_descriptor['ok'] is True:
file = file_descriptor["file"]
Expand Down

0 comments on commit b5011a0

Please sign in to comment.