Skip to content

Commit 4229fd2

Browse files
author
Matthias
committed
Changelog fragment
1 parent d71a6e8 commit 4229fd2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

changelogs/fragments/slack.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- Slack upload file - feature added support for uploading files to Slack (https://github.com/ansible-collections/community.general/pull/9472).

plugins/modules/slack.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@
148148
type: dict
149149
description:
150150
- Specify details to upload a file to Slack. The file can include metadata such as an initial comment, alt text, snipped and title.
151-
- See Slack's file upload API for details at U(https://api.slack.com/methods/files.getUploadURLExternal) and U(https://api.slack.com/methods/files.completeUploadExternal).
151+
- See Slack's file upload API for details at U(https://api.slack.com/methods/files.getUploadURLExternal).
152+
- See Slack's file upload API for details at U(https://api.slack.com/methods/files.completeUploadExternal).
152153
suboptions:
153154
path:
154155
type: str
@@ -171,6 +172,10 @@
171172
type: str
172173
description:
173174
- Optional title for the uploaded file.
175+
thread_ts:
176+
type: str
177+
description:
178+
- Optional timestamp of parent message to thread this message, see U(https://api.slack.com/docs/message-threading).
174179
"""
175180

176181
EXAMPLES = r"""
@@ -293,6 +298,7 @@
293298
alt_text: ''
294299
snippet_type: ''
295300
title: ''
301+
thread_ts: ''
296302
"""
297303

298304
import re
@@ -476,7 +482,7 @@ def do_notify_slack(module, domain, token, payload):
476482

477483
def get_channel_id(module, token, channel_name):
478484
url = SLACK_CONVERSATIONS_LIST_WEBAPI
479-
headers = {"Authorization": f"Bearer {token}"}
485+
headers = {"Authorization": "Bearer " + token}
480486
params = {
481487
"types": "public_channel,private_channel,mpim,im",
482488
"limit": 1000,
@@ -654,7 +660,7 @@ def main():
654660
initial_comment=dict(type="str"),
655661
thread_ts=dict(type="str"),
656662
title=dict(type="str")
657-
)
663+
)
658664
),
659665
),
660666
supports_check_mode=True,

0 commit comments

Comments
 (0)