In my Adaptive card, I want to show the users photo. like so:
So when I put in the photo, it doesn't display in Outlook
So my card looks like this:
{
"type": "Image",
"url": "https://graph.microsoft.com/v1.0/users/me#email.com/photo/$value",
"size": "small",
"style": "person"
}
It doesn't appear in outlook:
Any ideas on how to get the user photo from MS Graph showing on the Adaptive Card?
Typical, as soon as you pose a question, you find a solution.
If your URL for the photo is:
https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=me#email.com&UA=0&size=HR96x96
Then the photo shows up when testing in Outlook 365 on the web
Unfortunately it just shows nothing in Outlook on Windows
Any other ideas?
In your two examples, you are retrieving the image from:
An authenticated endpoint (Graph API), which just won’t work (images need to be accessible anonymously)
By calling into an undocumented OWA API, which works in OWA because your card is running in the same context but won’t work in Outlook (or anywhere else) because, well, it’s not OWA
Please do not retrieve images from authenticated or undocumented APIs. I unfortunately do not have a good solution for retrieving the user's picture to show in your card at this time.
Related
https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/bots-filesv4 describes a consent-based file sending process where a bot receives a users consent to upload a file to their onedrive and is able to send a FileAttachment card which renders a nice File chicklet view in the users Teams client. The chicklet view lets the user view the file in the Teams built in browser or download it or save it etc. More sample code here: https://techcommunity.microsoft.com/t5/microsoft-teams-blog/working-with-files-in-your-microsoft-teams-bot-preview/ba-p/199441
The final file attachment JSON looks like this
{
"attachments": [{
"contentType": "application/vnd.microsoft.teams.card.file.info",
"contentUrl": "https://contoso.sharepoint.com/personal/johnadams_contoso_com/Documents/Applications/file_example.txt",
"name": "file_example.txt",
"content": {
"uniqueId": "1150D938-8870-4044-9F2C-5BBDEBA70C8C",
"fileType": "txt",
}
}]
}
The rendering on the Teams client looks like this (taken from a different file send). Clicking on the icon opens the Teams built in File Viewer and
In our case our bot is already hosting a set of files that it needs to send a user. We can obviously just send a URL to the file location using Markdown but that causes the Teams client to download the file, user then has to go locate the file in their Downloads folder, and then view the file. (A multi-step process to view the file)
We are hoping to find an attachment type that has the same UX as the built in FileAttachment above i.e does not rely on first uploading to user's onedrive etc. When we try to use the same FileCard format but use our own contentURL , the click actions, unsurprisingly, fail.
Q: Is there a similar attachment type available in the Bot Framework for Teams which will generate a similar experience for the user (nice chicklet view, leverage built in Teams viewer, with option to open in browser or download) but with a file that is hosted by the bot at a reachable web URL (rather than first uploading to a user's One Drive)? Anyone attempted to do this using an adpative card?
(p.s sending image files has a work around which causes images to render inline, so this is about other file types such as PDF or Powerpoint)
Unfortunately, there isn't a built-in card (or a version of the File info card) that supports downloading from arbitrary urls - this can only be used for files hosted in OneDrive or SharePoint (depending on the context).
One possible option is to display a "regular" adaptive card with an action that launches a task module and then handle the file download yourself from there using JS and the Teams SDK.
I am building a bot that takes some sensitive inputs. As I would like to add this bot to an MS team/group, how do I hide/mask user's input to the bot from other users. Is that possible?
Currently it's not possible to send masking data to bot from compose message area. Instead you can use adaptive card to send masking data to bot.
{
"type": "Input.Text",
"id": "secretThing",
"style": "password"
}
Microsoft will always focus on customer’s feedback and experience, some new features would be added to the services based on customers' feedback in the future, we also recommend you give your new idea in Teams UserVoice here if this needs to be consider as a future request.
I am working on an adaptive card that is posted to users in Teams using Power Automate. The final thing I would like to add to the adaptive card, is a action button, that the user can click to call a person.
I have tried using both tel and sip in the URL. However nothing happens when the button is clicked.
Is this a limitation of Teams - or am I just doing it wrong?
"actions": [
{
"type": "Action.OpenUrl",
"title": "Call Matt",
"url": "tel:+4599999999",
"id": "callMeId"
}
]
Adaptive Card Designer
BR,
Niels
You need to set the Microsoft Teams as default Apps for Tel Protocol.
You can try putting following in browser: +46890510
it will navigate you to the Microsoft Teams
it will open one pop up for Teams asking to call or not
I'm developing a Teams bot app that generates a thumbnail card (application/vnd.microsoft.card.thumbnail) via unfurl or search extension. This card contains 3 buttons from which one of them invokes a task. Everything was working as expected for a while but then I noticed that if I click on that button on a card that's been posted more than a week ago, nothing happens, my server does not receive any request from MS Teams. Actually in the Teams web app you can see an error log in the JS console saying:
AppsService: getInstalledAppForTeam - Invalid teamId and/or appId
specified
If I post a new card from the same app (same app version without updating it), the button works again, but only for a week or so.
This is the JSON definition of that invoke button I use:
{
"type": "invoke",
"title": "Invoke task",
"value": {
"type": "task/fetch",
"someObjectId": "123",
"command": "myCommand"
}
}
Not sure if I miss anything there but according to doc it does not seem like that.
Is there some defined period after which the invoke buttons are "retired"?
The app is installed via Teams Admin Center https://learn.microsoft.com/en-us/microsoftteams/manage-apps
I've not looked into this scenario, so I can't say 100% for sure what's going on, but what I suspect is this: Your App Id/App Password are important because they're being used to secure the payload in some way, and that process might have a time limit to ensure stale messages aren't resent (i.e. replayed by an invalid party), or something like that. As a result, it's not that the app id is per se expired, but rather that the message somehow is. Again, just a theory...
I'm working with BotBuilder in .NET C#.
I can't figure out how I can send an attachment to the bot using Teams client - I've tried using the Windows desktop app and the web client but neither shows an attachment button in a chat with the bot.
I also tried with the Android client and found that I could send image attachments but not other file types, which I then went back and found that I could do the same in desktop/web clients by pasting the image into the chat box.
Using this method I do get an item in Activity.Attachments with ContentType="image/*". Any other type of file that I try to attach in the Android client is not sent to the bot (nothing in the Activity.Attachments collection) and as I said the other clients won't allow me to even attach anything in 1:1 chat.
Attaching a file in a Teams Channel adds the file to the Channel but I don't get any reference to the attachment if I #mention the bot along with the attachment.
The only mention of consuming attachments in bot sent via Teams I can find is here where it's stated that you'll need to use a JwtToken to access the file. I'm guessing this is currently a limitation in Teams as I'm able to send/receive attachments from other channels, but I'd like to confirm that there isn't some nuance that I'm missing.
Currently, Microsoft Teams does not support the ability to send non-image files to bots.
We are currently working on delivering this feature, but we do not yet have an ETA.
Image attachment can be send through Teams by copy pasting them in the Chat window.Teams have pushed the new Build where you can have Attachment Functionality available in Chat BOT. Now you can attach any file in the teams channel but you need to continue to send the Jwt token.
You can explore the type FileDownloadInfo which can be used to know the file type, content and other required details after you send the attachment to the BOT.
To answer your first question. Microsoft Teams does not show "attachment" button by default. You can install "App Studio" in Teams, and create an app for your bot, specify your app allows upload attachments. And install it in your own Team account for testing.
The second question, you can't get the image attachment. The JSON from Microsoft Teams channel is different from other channels.
You may notice the "contentType" is different, and the "contentUrl" requires a login in order to download the image. You need to use "content.downloadUrl" instead.
"attachments": [
{
"contentType": "application/vnd.microsoft.teams.file.download.info",
"contentUrl": "https://xxx-xxx.sharepoint.com/personal/xxxx/Documents/Microsoft Teams Chat Files/Cloud section in Singapore.PNG",
"content": {
"downloadUrl": "https://xxxx-xx.sharepoint.com/personal/xxxx/_layouts/15/download.aspx?UniqueId=a3cf2177-1cc7-433b-8344-129140c0694e&Translate=false&tempauth=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvc2FnZTM2NS1teS5zaGFyZXBvaW50LmNvbUAzZTMyZGQ3Yy00MWY2LTQ5MmQtYTFhMy1jNThlYjAyY2Y0ZjgiLCJpc3MiOiIwMDAwMDAwMy0wMDAwLTxxxxx&ApiVersion=2.0",
"uniqueId": "xxxx-1cc7-433b-8344-xxxxxx",
"fileType": "png"
},
"name": "Cloud section in Singapore.PNG",
"thumbnailUrl": null
}
]