Skip to content

Commit 1c1dc08

Browse files
committed
Added support for simple HeroCards (with only text and buttons) in Slack
1 parent ff63e5b commit 1c1dc08

File tree

1 file changed

+13
-0
lines changed
  • libraries/botbuilder-adapters-slack/botbuilder/adapters/slack

1 file changed

+13
-0
lines changed

libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_helper.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ def activity_to_slack(activity: Activity) -> SlackMessage:
5555
for att in activity.attachments:
5656
if att.name == "blocks":
5757
message.blocks = att.content
58+
59+
elif att.content_type == "application/vnd.microsoft.card.hero":
60+
message.blocks = [
61+
{"type": "section",
62+
"text": {"type": "mrkdwn", "text": att.content.text}
63+
},
64+
{"type": "actions",
65+
"elements": [{"type": "button",
66+
"text": {"type": "plain_text", "text": i.title},
67+
"value": i.value} for i in att.content.buttons]
68+
}
69+
]
70+
5871
else:
5972
new_attachment = Attachment(
6073
author_name=att.name, thumb_url=att.thumbnail_url, text="",

0 commit comments

Comments
 (0)