Create message doesn't support adaptive cards
amankhoza opened this issue · 2 comments
amankhoza commented
Expected Behavior
I expect adding a parameter 'cards' with the stringified json for the adaptive card should work.
Current Behavior
There doesn't seem to be support for sending a card using create message.
Possible Solution (we welcome any logical suggestion)
Example:
let redirect_uri = `${window.location.protocol}//${window.location.host}`;
if (window.location.pathname) {
redirect_uri += window.location.pathname;
}
Steps to Reproduce
Environment Details
- SDK Version
- Node/Browser Version
- NPM Version
jpjpjp commented
Hi @amankhoza , the message object field isn't "cards" it's "attachments" as described in the Buttons and Cards Developers Guide. You must pass an array that consists of a single, well defined, adaptive card object.
Here is an example of using the SDK to post a card. Assume "webex" is a properly created instance of the Webex SDK and that "roomId" is the ID of a space that the SDK user is a member of:
const attachment = {
contentType: 'application/vnd.microsoft.card.adaptive',
content: {
type: 'AdaptiveCard',
version: '1.0',
body: [
{
type: 'TextBlock',
text: 'This is a really simple card'
}
]
}
};
webex.messages.create({
roomId: room.id,
text: "If you see this your card did not render.",
attachments: [attachment]
})
Does this resolve your issue?
amankhoza commented
Oops don't know where I got 'cards' from, attachments worked thanks :)