{
"attachments": [
{
"type": "divider",
"color": "#36A64F"
},
{
"type": "image",
"title": {
"type": "plain_text",
"text": "image1",
"emoji": true
},
"title": "XXXXXX",
"image_url": "https://s3.amazonaws.com/report.png",
"alt_text": "image1",
"color": "#36A64F"
}
]
}
I am using s3 bucket to publish an image, and once the image is published, that image will be removed from s3 bucket, the image appears broken in slack once the url becomes invalid
This is not an error, but works as designed.
When you provide an image link, Slack does not copy the image, but only references it (it will cache it for a while though). Just like a normal HTML page.
If you want to preserve the image you need to copy it yourself / upload it to a persistent storage.
Here is another answer that explains how to upload an image to Slack: Can I upload an image as attachment with Slack API?
Related
Really hoping someone can help out on this.
I'm trying to achieve - a no-code chat bot using QnAMaker.ai and Azure Bot Services with AdaptiveCards to serve rich content.
I have a knowledgebase set up and published, I have a bot in Azure set up to serve that content and it seems to work okay at the first stage.
Now I'm trying to add AdaptiveCards without opening and editing the solution in VSCode - I really want to keep all this contained in a no-code solution.
I Googled how to add custom cards/content and found this post by LiveTiles - excellent - I thought, I can just add minified JSON and it will render what I want - lovely stuff!
However; despite there being a live output render on the LiveTiles site, when I take that JSON I cannot get it to render through either Web Chat or the Bot Framework Emulator.
I've tried...
Copy/pasting the raw JSON into a QnAPair
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Image",
"url": "",
"size": "stretch",
"selectAction": {
"type": "Action.OpenUrl",
"title": "Test",
"url": "https://www.livetiles.nyc/"
}
},
{
"type": "TextBlock",
"text": "This is an adaptive card - if this renders it means it's worked!",
"wrap": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Let's get started!",
"url": "Let's get started!"
}
]
}
}
Copy/pasting minified JSON into a QnAPair
{"contentType":"application/vnd.microsoft.card.adaptive","content":{"type":"AdaptiveCard","version":"1.0","body":[{"type":"Image","url":"","size":"stretch","selectAction":{"type":"Action.OpenUrl","title":"Test","url":"https://www.livetiles.nyc/"}},{"type":"TextBlock","text":"This is an adaptive card - if this renders it means it's worked!","wrap":true}],"actions":[{"type":"Action.Submit","title":"Let's get started!","url":"Let's get started!"}]}}
Making a Source Excel File (which includes the JSON) and adding that to the knowledge base
All my attempts end up with the bot spitting the actual JSON at me when I ask it. Not the lovely rendered card I wanted.
Renders on the LiveTiles site:
Doesn't render on the Emulator
Or on the Web Chat
In QnAMaker.ai Test Function
Really hoping someone can offer some insight or advice to this.
Please try below json it works for me ,
{
//"contentType": "application/vnd.microsoft.card.adaptive",
//"content": {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Image",
"url": "",
"size": "stretch",
"selectAction": {
"type": "Action.OpenUrl",
"title": "Test",
"url": "https://www.livetiles.nyc/"
}
},
{
"type": "TextBlock",
"text": "This is an adaptive card - if this renders it means it's worked!",
"wrap": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Let's get started!",
"url": "Let's get started!"
}
]
//}
}
I have added a screenshot below please check
code for send card as an attachment :
var cardAttachment = Common.CreateAdaptiveCardAttachment();
await turnContext.SendActivityAsync(MessageFactory.Attachment(cardAttachment), cancellationToken);
I am trying to initiate a call when pressing a button within an adaptive card (in microsoft teams)
I add URL as callto:[useremail]
eventhough when I write this in the search bar in chrome it works, but when pressing the button in the adaptive card it gives me an error on the chrome page.
any idea why might this happen?
Edit:
Here's a sample card of what I used:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"size": "small",
"style": "person",
"type": "Image",
"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
"selectAction":{
"type": "Action.OpenUrl",
"url": "callto:rex#gmail.com"
}
}
]
}
]
}
]
}
]
}
It looks like links inside Teams don't support any protocols other than the usual HTTP/S. You can turn your callto link into an https link using a redirect URL service like these: https://www.cnet.com/news/10-links-to-shorten-your-links/
If you need to generate your callto links dynamically, I'm not sure how many of those services have API's your bot can use. TinyURL does though.
It's also pretty simple to just host your own redirection service in your own domain. You could even use the same domain that your bot is running on, so your link might end up looking something like this: https://rexbot.azurewebsites.net/api/callto/rex#gmail.com
Also, you might consider getting support for this from Teams directly. You can request that they support more URL protocols.
I've been trying to send cards to Teams channels through a connector. The cards do appear but any hero image I try to send isn't displayed.
The Message Card Playground displays the image correctly but it simply doesn't show up in Teams. I have no issues with the "normal" images.
Here is the JSON that I'm sending through the webhook, but I've also tried the Twitter - Hero image sample card and it doesn't work either :
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"summary": "Hero card testing",
"title": null,
"text": null,
"themeColor": "19b5fe",
"sections": [
{
"title": null,
"activityImage": "https://pbs.twimg.com/profile_images/862653089916096512/ljJwcmFp_bigger.jpg",
"activityTitle": "Hero image card",
"activitySubtitle": "This is a test",
"facts": [],
"text": null,
"heroImage": {
"image": "https://pbs.twimg.com/media/DFv74A0XkAEdwQ_.jpg"
},
"images": []
}
]
}
Am I missing something ?
I hit the same problem. It looks like as a sort of workaround you can use the inline image markdown syntax in a non-section's text.
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"summary": "Summary",
"title": "Title",
"text": "![Alt text for the image](https://pbs.twimg.com/media/C8NK1XGUIAA-CJK.jpg)",
"themeColor": "E81123"
}
I describe it as a workaround though because the image is not scaled in any way when displayed. As you can see from this example a large image is left very large and overflowing the container.
HeroImage is not currently supported in Teams. This is on the backlog but no ETA at this point.
Hero Images ('heroImage') are currently support only in Outlook. Would be available in Teams sometime in future.
Card with a hero image
Try the sample Twitter markup for in the card playground: https://aka.ms/messagecardplayground
I am trying to create a bot and deploy it onto different platforms, but when I return images in the carousel for the chatbot, Skype doesn't render them, while the same works for Facebook and even on the web widget provided by Gupshup.
If you want to know the chatbot platform i'm using it would be Gupshup with api.ai hooked for nlp , do you know the problem i am encountering?
I have tried different ways of getting the image. First I got it from the site I am making the chatbot for, then I tried shortening the url using google and finally I tried uploading the image on Google drive.The image format is jpg could that be the issue?
http://imgur.com/a/19aG3
[Update:7/5/2017] - Skype issue is now resolved. The carousel code that is working for Facebook Messenger will also work for Skype.
Sample JSON for Carousel on Skype:
{
"type": "catalogue",
"msgid": "cat_212",
"items": [{
"title": "White T Shirt",
"subtitle": "Soft cotton t-shirt \nXs, S, M, L \n$10",
"imgurl": "https://pixel.nymag.com/imgs/fashion/daily/2016/06/02/t-shirt/everlane.w710.h473.2x.jpg",
"options": [{
"type": "url",
"title": "View Details",
"url": "https://pixel.nymag.com/imgs/fashion/daily/2016/06/02/t-shirt/everlane.w710.h473.2x.jpg"
},
{
"type": "text",
"title": "Buy"
}
]
},
{
"title": "Grey T Shirt",
"subtitle": "Soft cotton t-shirt \nXs, S, M, L \n$12",
"imgurl": "https://cdn.shopify.com/s/files/1/0407/0829/products/Grey_t-shirt_front_1024x1024.jpg?v=1466588290",
"options": [{
"type": "url",
"title": "View Details",
"url": "https://cdn.shopify.com/s/files/1/0407/0829/products/Grey_t-shirt_front_1024x1024.jpg?v=1466588290"
},
{
"type": "text",
"title": "Buy"
}
]
}
]}
Result:
Images are not loading for the carousel on Skype because there have
been recent changes in Microsoft framework which are not yet
incorporated in Gupshup's bot platform. Although next week you should
be able to see those images load once we at Gupshup pushes the fix
into production. There will be no need of changing the code from your
end as the same code for carousel works across the supported
platforms.
I will update this answer once the fix is live into production.
PS: I work for Gupshup.
I am using the Bot framework to create a chat bot. And I want to create message card (Hero or Thumbnail).
If you look at the skype bot api doc, there is a way to encode image bytes directly as the content url. https://docs.botframework.com/en-us/skype/chat/
"type": "message/image",
"attachments": [
{
"contentUrl": "<base64 encoded image>",
"thumbnailUrl": "<base64 encoded thumbnail>", // optional
"filename": "bear.jpg" // optional
}
]
This works fine for showing an image only. But I want the image to be part of a card.
The card is
{
"type":"message/card.carousel",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.hero",
"content":{
"images":[
{
"image":"https://foo.com/path/image.jpg",
}
I have tried to set the image url property to the encoded bytes, but the client can't show it. What's the best way to achieve this?
You've got the basic idea. Use this instead:
"attachments": [
{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "Title",
"subtitle": "SubTitle",
"text": "Text",
"images": [
{
"url": "image/jpeg;base64,{YOUR IMAGE}",
"alt": "Alt Image Description"
}
]
}
}
],