Adding an adaptive card to bot framework with python

六眼飞鱼酱① 提交于 2019-12-03 17:26:05

You need to create the Attachment for the activity that is sent to the user:

ADAPTIVE_CARD_ATTACHMENT = Attachment(content_type='application/vnd.microsoft.card.adaptive',
                                      content=ADAPTIVE_CARD)

After this, you can attach it to your response activity like this:

response.attachments = [ADAPTIVE_CARD_ATTACHMENT]

Or you could add it when you create the response:

response = Activity(type='message', attachments=[ADAPTIVE_CARD_ATTACHMENT])

Note: I left out the additional code needed to create a valid activity for brevity, you still need to add the fields such as channel_id, recipient and from_property, etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!