Can't add Teams bot to a channel - microsoft-graph-api

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

Related

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

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

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

Google Workspace Marketplace addon present in Gmail Web and Android but missing in Gmail iOS

We have developed a Google Workspace Addon which uses Alternate Runtimes. It works fine on the WEB and ANDROID platforms, but not on iOS. No addon icon is present at the bottom when opening an email in the Gmail iOS app.
To clarify, the addon is entirely missing from the account, so there might be an interpretation issue with the manifest file. No logging is being created in Cloud Console's Logs Explorer, so no details there.
Opened a support ticket with Google which escalated it to the engineering team and they said:
"We received an update today and we have been able to reproduce this scenario on our end and it seems the problem is related to the add on and not the way it was deployed to Marketplace.
In this case since the issue is related to the Add on deployment we will not be able to further investigate on our end but if you believe it is related to a bug on our end you can submit a bug by accessing the following link https://developers.google.com/gmail/api/support#bug or you can also visit Stack Overflow as we have hundreds of developers and Google engineers that can provide you some insight about the issue that you are experiencing."
What is wrong with this deployment? I thought the Workspace addons were unified across all platforms. Manifest file below.
{
"oauthScopes": ["https://www.googleapis.com/auth/gmail.send", "https://www.googleapis.com/auth/gmail.addons.execute", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/script.locale", "https://www.googleapis.com/auth/gmail.addons.current.message.readonly", "https://www.googleapis.com/auth/gmail.addons.current.action.compose", "https://www.googleapis.com/auth/gmail.addons.current.message.metadata"],
"addOns": {
"common": {
"name": "***",
"logoUrl": "***",
"useLocaleFromApp": true,
"universalActions": [{
"label": "My Emails",
"openLink": "***"
}, {
"label": "Frequently Asked Questions",
"openLink": "***"
}, {
"label": "Mobile Help",
"openLink": "***"
}, {
"label": "Contact us",
"openLink": "***"
}, {
"label": "My Account",
"openLink": "***"
}]
},
"gmail": {
"contextualTriggers": [{
"unconditional": {
},
"onTriggerFunction": "redacted"
}],
"composeTrigger": {
"selectActions": [{
"text": "redacted",
"runFunction": "redacted"
}],
"draftAccess": "METADATA"
},
"homepageTrigger": {
"runFunction": "redacted"
}
}
}
}
For anyone else down the rabbit hole I've been down in the last few hours.
The Google Workspace instructions on Set up an Apple push certificate might have helped.
However I still couldn't get the add-on to appear deploying as an alternative runtime from Node JS. Instead I refactored the UI in App Scripts and just fetched data that required more work from a server hosted on Cloud Run.

Create Plan (BETA) doesn't seem to work

I'm trying to create a planner plan using Graph as per http://graph.microsoft.io/en-us/docs/api-reference/beta/api/user_post_plans
but I'm consistently getting the following BadRequest response:
"error": {
"code": "BadRequest",
"message": "Write requests are only supported on contained entities",
"innerError": {
"request-id": "eae08944-6f47-477e-9950-ade31c473dd7",
"date": "2016-03-07T11:59:04"
}
As per the docs I'm POSTing to https://graph.microsoft.com/beta/me/plans with the following body:
"createdBy": "<my uuid>",
"owner": "<a previously generated group uuid>",
"title": "Blah Plan"
with no luck. The previously generated group looks like the following:
{
"id": "<uuid>",
"classification": null,
"createdDateTime": "2016-03-07T09:53:26Z",
"description": "Int Test",
"displayName": "Int Test",
"groupTypes": [
"Unified"
],
"mail": "<email_address>",
"mailEnabled": true,
"mailNickname": "IntTest",
"onPremisesLastSyncDateTime": null,
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"proxyAddresses": [
"SMTP:<email_address>"
],
"renewedDateTime": "2016-03-07T09:53:26Z",
"securityEnabled": false,
"visibility": "Public"
}
I've tried various combinations of request bodies. With and without createdBy values. With and without owner values. Nothing seems to work.
Any ideas where I'm going wrong? The error is consistent across my integration tests as well as through the graph explorer.
Thanks
As Sriram mentioned, this was a documentation bug. It has just been fixed. The updated URL is: https://graph.microsoft.io/en-us/docs/api-reference/beta/api/plan_post_plans
The issue was in which endpoint to call to create a plan. You should call "/plans" instead of "/me/plans". You should also be aware that some of the data you are passing in is read-only. You should not include "createdBy" because this is a read-only property set by the service, not you. The plan resource documentation will show you all of the properties that can be set on a plan.
The last thing to keep in mind is that you can only have one plan per group. If you try to make a second plan, you'll receive an error about this from the API.
In Juli 2017 the API was modified and released. The new endpoint for creating a plan now is:
https://graph.microsoft.com/v1.0/planner/plans
with a request body e.g. like this:
{
"owner": "<group-id>",
"title": "my plan title"
}
where <group-id> must be the id of a previously created group.
Apologies for the confusion here. The documentation has a bug will be updated shortly. To create a plan, please ensure that a group is created, and the user is member of group. Then create the plan with owner set to group id, and createdBy set to user id.
For this issue, can you please try following the below steps exactly?
Create a unified group
Add user to be member of unified group
Create plan by sending {“owner”: group-id, “title”: string} - do not send "createdBy" field since it's a read-only field
For adding tasks to buckets, it should work just fine if you sent
{“planId”: plan-id, “bucketId”: bucket-id, “title”: string}
If this still doesn't work, feel free to reach out to me at lixian#microsoft.com.
Thanks,
Sean

How to get "Project Id" to create a Direct Link?

I have my project name, but not the numeric Project Id. The latter is needed to use HTML Direct Links.I'm using JIRA 5.0.1
How do I get the numeric Project Id for a given project name?
I've searched the Project Administration area, several other places, the documentation, Google, etc but still can't find a way to get that value.
Thanks.
This solution does not require admin rights:
Navigate to https://jira.YOURDOMAIN.TLD/rest/api/2/project/YOURPROJECTNAME and read the id in the JSON response:
{
"self":"https://jira.YOURDOMAIN.TLD/rest/api/2/project/YOURPROJECTNAME",
"id":"12345", ☜ Project Id
"key":"YOURPROJECTNAME",
"description":..
:
}
Navigate to https://jira.YOURDOMAIN.TLD/rest/api/2/project to get a JSON list of projects.
Bonus: here's a one-liner in Groovy to get the ID:
groovy -e "println new groovy.json.JsonSlurper().parseText("https://jira.YOURDOMAIN.TLD/rest/api/2/project/YOURPROJECTNAME".toURL().text)?.id ?: 'not found'"
A java.io.FileNotFoundException probably means that your JIRA server requires authentication.
Here's a one-liner to list all the visible projects and their ID:
groovy -e "new groovy.json.JsonSlurper().parseText('https://jira.YOURDOMAIN.TLD/rest/api/2/project'.toURL().text)?.each{println it.key+' = '+it.id}"
The easiest way is to do it from the web browser:
Go to the Administration page.
Select the Project from the menu.
Hover over 'Edit Project' link and check the link href (in the status bar).
It should be something like http://servername:8080/secure/project/EditProject!default.jspa?pid=10040
Where pid is the id you are looking for.
For Jira 6.x:
place the cursor on EDIT Project button and
look at the url being redirected at bottom left of the screen
This solution doesn't require admin rights and shows you all of the projects the current user can view.
https://example.com/rest/api/2/project
Responses found here.
https://docs.atlassian.com/jira/REST/latest/#d2e4972
returns a json array.
[
{
"self": "http://www.example.com/jira/rest/api/2/project/EX",
"id": "10000",
"key": "EX",
"name": "Example",
"avatarUrls": {
"24x24": "http://www.example.com/jira/secure/projectavatar?size=small&pid=10000",
"16x16": "http://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10000",
"32x32": "http://www.example.com/jira/secure/projectavatar?size=medium&pid=10000",
"48x48": "http://www.example.com/jira/secure/projectavatar?size=large&pid=10000"
},
"projectCategory": {
"self": "http://www.example.com/jira/rest/api/2/projectCategory/10000",
"id": "10000",
"name": "FIRST",
"description": "First Project Category"
}
},
{
"self": "http://www.example.com/jira/rest/api/2/project/ABC",
"id": "10001",
"key": "ABC",
"name": "Alphabetical",
"avatarUrls": {
"24x24": "http://www.example.com/jira/secure/projectavatar?size=small&pid=10001",
"16x16": "http://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10001",
"32x32": "http://www.example.com/jira/secure/projectavatar?size=medium&pid=10001",
"48x48": "http://www.example.com/jira/secure/projectavatar?size=large&pid=10001"
},
"projectCategory": {
"self": "http://www.example.com/jira/rest/api/2/projectCategory/10000",
"id": "10000",
"name": "FIRST",
"description": "First Project Category"
}
}
]
Exporting a ticket in XML reveals the project ID for me. I am not admin, so can't access the admin page. The rest/json trick didn't work for me, either. The XML of an issue has the following,
<project id="1234" key="test">TEST Project</project>

Resources