Skip to content

Commit

Permalink
handle attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ctri-The-Third committed Apr 6, 2022
1 parent e96c75e commit b45722b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ runmetest.py
tests/jira_settings.json
tests/zendesk_settings.json
tests/zendesk_settings.json
install.bat
install2.bat
5 changes: 4 additions & 1 deletion serviceHelpers/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down

0 comments on commit b45722b

Please sign in to comment.