Logic apps- Post a choice of options as the flow bot to group chat - post

I can see that logic app has Microsoft teams "Post a choice options as the Flow bot to a user" action. However, I would like something where I can present options to a group chat or channel. The reason for not sending multiple individual messages are because I would like only 1 person to response in first come first serve kind of way.
Is there any way I can achieve this?

I can see that logic app has Microsoft teams "Post a choice option as the Flow bot to a user
Yes, you can use Post a choice of options as the flow bot to a user connector in logic Apps to present options to a user as shown in below images.
I would like something where I can present options to a group chat or channel.
But if you want to present options to a group chat or channel AFAIK there is no such built-in connector available in logic Apps. You can achieve this using Adaptive cards.
Adaptive cards for Microsoft teams
By following this document, you can add radio buttons or by changing test as an option you can create buttons labeled option1 and option2 as per your requirement.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Text Block",
"text": "Please select an option:"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Option 1",
"data": {
"id": "option1"
}
},
{
"type": "Action.Submit",
"title": "Option 2",
"data": {
"id": "option2"
}
},
]
}
Reference link

Related

MS Teams Bot sign-in not working, says "This action can't be performed since the app does not exist or has been uninstalled."

I am creating a simple MS Teams messaging bot that requires auth/sign-in.
I am using https://smba.trafficmanager.net/amer/v3/conversations/{conversationId}/activities to send a non-reply bot message to user that includes a hero card with a sign-in button.
The body looks somewhat like this:
{
"type": "message",
"from": {
"id": "abc",
"name": "messaging-bot"
},
"conversation": {
"id": "789",
"name": "test",
"tenantId": "456",
"role": "bot",
"conversationType": "personal"
},
"recipient": {
"id": "123",
"name": "test"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "title goes here",
"subtitle": "subtitle goes here",
"text": "descriptive text goes here",
"buttons": [
{
"type": "signin",
"title": "Click me to sign in",
"value": "<my-signin-url>"
}
]
}
}
]
}
When user receives hero card and clicks sign in button, user gets the following error:
This action can't be performed since the app does not exist or has been uninstalled.
I have added my sign-in domain to valid domains, and uploaded app package to MS Teams, so not sure why I am getting this error.
The app is created through Developer Portal in Ms Teams. For now, we are just creating a simple messaging app that relies on the bot messaging endpoint
May someone help with this?
If you are using Microsoft AD, Please add below in valid domain section of your app manifest:
token.botframework.com
login.microsoftonline.com
Quick update on answer. I found that installing/uninstalling app when sideloading app is a bit buggy. Things worked after I closed my MS Teams client and re-opened it

Can't add Teams bot to a channel

This was originally a support ticket to Microsoft. However they told they don't do dev support without paying for it. They directed me to Stack Overflow, so here goes nothing.
I'm developing a Bot for Microsoft Teams. I have registered my bot with Azure Active Directory, & Bot Framework. I have uploaded my app to Team, without any errors. My bot is currently able to send direct messages to Teams users. However, when I try to add my bot to a Teams channel, I get unhelpful errors.
I click the dropdown under my app in the Apps tab:
I click "Add to a Team", then select a channel:
After clicking the button "Set up a bot", I get the following error message:
I have checked & rechecked my webApplicationInfo.id & webApplicationInfo.applicationPermissions numerous times, and I'm at a loss for what could be amiss. I don't see how either of these fields could be wrong given, I can authenticate with both the Microsoft Graph & Bot Framework apis using these values. Here's a slightly redacted version of my Teams app manifest:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.8/MicrosoftTeams.schema.json",
"manifestVersion": "1.8",
"version": "1.0.15",
"id": "<TEAMS_APP_ID>",
"packageName": "ambition",
"developer": {
"name": "Ambition",
"websiteUrl": "https://ambition.com",
"privacyUrl": "https://ambition.com/privacy",
"termsOfUseUrl": "https://ambition.com/pages/terms"
},
"icons": {
"color": "logo_opaque_192x192.png",
"outline": "logo_transparent_32x32.png"
},
"name": {
"short": "Ambition",
"full": ""
},
"description": {
"short": "Motivate & Recognize",
"full": "Ask Marketing"
},
"accentColor": "#FFFFFF",
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"ambition.com"
],
"bots": [
{
"botId": "<AZURE_ACTIVE_DIRECTORY_CLIENT_ID>",
"scopes": [
"team",
"personal",
"groupchat"
],
"isNotificationOnly": true
}
],
"webApplicationInfo": {
"id": "<AZURE_ACTIVE_DIRECTORY_CLIENT_ID>",
"resource": "https://ambition.com",
"applicationPermissions": [
"Channel.ReadBasic.All",
"ChannelMessage.Send",
"Group.Read.All",
"Notifications.ReadWrite.CreatedByApp",
"Team.ReadBasic.All",
"User.Read",
"User.ReadBasic.All"
]
}
}
The webApplicationInfo section is really only for two things: Tab SSO, and Resource-Specific Consent. Are you trying to implement either one of those? If not, removing it is definitely the best option, as you've noted in your answer.
In addition, I see that the resource values you've put in there are Microsoft Graph Scopes, whereas the applicationPermissions section is expecting a different list of options (they look kind of similar, but their not the same thing). See here for more: https://learn.microsoft.com/en-gb/microsoftteams/platform/graph-api/rsc/resource-specific-consent#resource-specific-permissions
Don't really know why this works, but I compared my app manifest to the one generated by going through this tutorial: https://learn.microsoft.com/en-us/microsoftteams/platform/build-your-first-app/build-bot.
Removing the webApplicationInfo property from my manifest fixed the issue. Don't really understand why it was causing a problem in the first place.
https://learn.microsoft.com/en-us/microsoftteams/platform/resources/schema/manifest-schema#webapplicationinfo

Slack API - how to send multiple images so they are shown in a gallery

When I send multiple images via api using blocks like this:
{
"blocks": [
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Please enjoy this photo of a kitten"
},
"image_url": "http://placekitten.com/500/500",
"alt_text": "An incredibly cute kitten."
},
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Please enjoy this photo of a kitten"
},
"image_url": "http://placekitten.com/500/500",
"alt_text": "An incredibly cute kitten."
},
{
"type": "image",
"title": {
"type": "plain_text",
"text": "Please enjoy this photo of a kitten"
},
"image_url": "http://placekitten.com/500/500",
"alt_text": "An incredibly cute kitten."
}
]
}
Slack shows them like a separate blocks and doesn't combine them into a gallery:
slack screenshot - API
When I upload them using Slack app in one message - it combines them into a gallery:
slack screenshot - with gallery
I've tried blocks, attachments, third-party urls, permalinks after file.upload - the result is the same, Slack doesn't combine them into gallery.
So, the question is - how do I make it that Slack shows several images in a gallery?
UPD:
Just got an answer from Slack developers support:
slack dev support answer screenshot
Unfortunately, horizontal/gallery formatting of images is not possible
using the block kit builder. However, I'm going to go ahead and pass
your email on to our product team so that they can take this into
consideration for future updates.
Based on your comment,
[...] permalinks after file.upload [...]
this related answer might help (I also added this clarification there).
When uploading files and collecting their permalinks, you must link them in the text param in the message payload (putting them in a mrkdwn block in the blocks param will not work).
In javascript, this looks like:
const result1 = await web.files.upload({...})
const result2 = await web.files.upload({...})
await web.chat.postMessage({
text: `Here are files in a gallery view <${result1.file.permalink| ><${result2.file.permalink| >`,
...
})

Slack API chat.postMessage URL Unfurling

I have a bot app that sends a message to the slack channel. I am using https://api.slack.com/methods/chat.postMessage/ to send messages to the slack channel.
My message sometimes has few links (GIF) which are being rendered in the channel as a plain link.
I want them to be unfurled so that it can display animated GIF on the channel itself.
I tried passing unfurl_links: true to the API parameter however it doesn't work.
Here is my JSON payload
{
"text": "Anniversary Alert :confetti_ball:",
"channel": "C01AGGP63ST",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Anniversary Alert :confetti_ball:\n\nLet's all take a moment to congratulate <#U024FCGPW> on their 10 year anniversary!\n\nWe wish you a very happy anniversary and many more great years ahead with us.\n\nhttps://media0.giphy.com/media/1yjpDZgvGkb6nTynq3/giphy.gif?cid=cbd9d2f95475c686b1a293a6cf43de5f3f640e4eb012f714&rid=giphy.gif"
}
}
],
unfurl_links: true
}
Can someone please help?
Used "attachments" property of the API payload and it unfurls the link
{
"text": "Anniversary Alert :confetti_ball:",
"channel": "C01AGGP63ST",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Anniversary Alert :confetti_ball:\n\nLet's all take a moment to congratulate <#U024FCGPW> on their 10 year anniversary!\n\nWe wish you a very happy anniversary and many more great years ahead with us.\n\nhttps://media0.giphy.com/media/1yjpDZgvGkb6nTynq3/giphy.gif?cid=cbd9d2f95475c686b1a293a6cf43de5f3f640e4eb012f714&rid=giphy.gif"
}
}
],
"attachments": [
{
"text": "",
"image_url": "https://media0.giphy.com/media/1yjpDZgvGkb6nTynq3/giphy.gif?cid=cbd9d2f95475c686b1a293a6cf43de5f3f640e4eb012f714&rid=giphy.gif"
}
]
}
The big gotcha here is that slack unfurl is only triggered when it's a user (bots do not trigger unfurls). Too bad - I'm running into the same issue - unfurl was going to be the way to go but I missed the fine print. I think I'm going to just go with a chat threaded reply (which is way less pretty).

Microsoft Graph: insert a message (mail) to user inbox

I have a Microsoft application (with Mail.Read/Write permissions) and I need to insert a mail (.eml extension file) to a user inbox.
Is that possible? I know that with Gsuite that can be done using the 'insert' API and was wondering if something similar exist with Graph API.
I'm not talking about sending new mail to the user or about inserting an attachment to existing message in the user inbox, but to insert completely new email to his inbox (without having to go through SPF or whatever checks that take place before mails usually get into end users inboxes).
Looking into Mail section under Graph API documentation wasn't so helpful.
If that not possible, perhaps there is a workaround?
EDIT: seems like the best option is to use "send mail" API and specify "saveToSentItems": False.. the only issue here as that my application will need to request the Mail.Send permission as well..
Thanks
You don't need to use the send mail api as all your doing is creating an Item in the Mailbox. If you want it to appear as a Sent Mail (rather then a draft) you do need to set the PidTagMessageFlags extended property (the same as you would in EWS https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-import-items-by-using-ews-in-exchange). Also if you want it to appear if its been sent in the past there are few additional extended properties you need to set. eg
{
"Subject": "test1234",
"Sender": {
"EmailAddress": {
"Name": "blah",
"Address": "blah#blah.com"
}
},
"Body": {
"ContentType": "HTML",
"Content": "123Body"
},
"SingleValueExtendedProperties": [
{
"PropertyId": "Integer 0x0E07",
"Value": "1"
},
{
"PropertyId": "SystemTime 0x0039",
"Value": "2019-06-12T10:10:47.2048+10:00"
},
{
"PropertyId": "SystemTime 0x0E06",
"Value": "2019-06-12T10:10:47.2048+10:00"
}
]
}

Resources