diff --git a/.gitignore b/.gitignore index fa73857..02a814d 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,5 @@ runmetest.py tests/jira_settings.json tests/zendesk_settings.json tests/zendesk_settings.json +install.bat +install2.bat diff --git a/serviceHelpers/slack.py b/serviceHelpers/slack.py index 19c2e95..36eb9f5 100644 --- a/serviceHelpers/slack.py +++ b/serviceHelpers/slack.py @@ -22,7 +22,7 @@ def __init__(self, token="", webhook="") -> None: self.webhook = webhook def post_to_slack_via_token( - self, text, channelID, parent_ts=None, unfurl: bool = True + self, text, channelID, parent_ts=None, unfurl: bool = True, attachment=None ): """Use the `chat.postMessage` api call to send a message to a specified channelID. @@ -35,6 +35,9 @@ def post_to_slack_via_token( if parent_ts is not None: body["thread_ts"] = parent_ts + + if attachment is not None: + body["attachments"] = attachment response = requests.post(url, data=json.dumps(body), headers=headers) try: