Fetch Team Channels throws an ErrorResponseException
See original GitHub issueAffected Versions
Tested it in 4.6.0-preview8 and 4.6.0-preview7
Descriptions
When fetching the channel list of a team:
List<ChannelInfo> channels = TeamsInfo
.getTeamChannels(turnContext, teamInfo.getId())
.get();
The following exception is thrown:
java.util.concurrent.ExecutionException: com.microsoft.bot.connector.rest.ErrorResponseException: Status code 405, {"message":"The requested resource does not support http method 'POST'."}
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2063)
at com.newswhip.teams.BotActivityHandler.onTeamsMembersAdded(BotActivityHandler.java:119)
at com.microsoft.bot.builder.teams.TeamsActivityHandler.onTeamsMembersAddedDispatch(TeamsActivityHandler.java:691)
at com.newswhip.teams.BotActivityHandler.onTeamsMembersAddedDispatch(BotActivityHandler.java:352)
at com.microsoft.bot.builder.teams.TeamsActivityHandler.onConversationUpdateActivity(TeamsActivityHandler.java:530)
at com.newswhip.teams.BotActivityHandler.onConversationUpdateActivity(BotActivityHandler.java:312)
at com.microsoft.bot.builder.ActivityHandler.onTurn(ActivityHandler.java:74)
at com.microsoft.bot.integration.BotFrameworkHttpAdapter$$Lambda$504/0000000000000000.invoke(Unknown Source)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityInternal(MiddlewareSet.java:99)
at com.microsoft.bot.builder.MiddlewareSet.lambda$receiveActivityInternal$1(MiddlewareSet.java:110)
at com.microsoft.bot.builder.MiddlewareSet$$Lambda$552/0000000000000000.next(Unknown Source)
at com.microsoft.bot.builder.BotFrameworkAdapter$TenantIdWorkaroundForTeamsMiddleware.onTurn(BotFrameworkAdapter.java:1552)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityInternal(MiddlewareSet.java:109)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityInternal(MiddlewareSet.java:74)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityWithStatus(MiddlewareSet.java:67)
at com.microsoft.bot.builder.BotAdapter.runPipeline(BotAdapter.java:194)
at com.microsoft.bot.builder.BotFrameworkAdapter.lambda$processActivity$2(BotFrameworkAdapter.java:475)
at com.microsoft.bot.builder.BotFrameworkAdapter$$Lambda$551/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1183)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2299)
at com.microsoft.bot.builder.BotFrameworkAdapter.processActivity(BotFrameworkAdapter.java:473)
at com.microsoft.bot.builder.BotFrameworkAdapter.lambda$processActivity$1(BotFrameworkAdapter.java:435)
at com.microsoft.bot.builder.BotFrameworkAdapter$$Lambda$510/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1146)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1769)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1756)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.microsoft.bot.connector.rest.ErrorResponseException: Status code 405, {"message":"The requested resource does not support http method 'POST'."}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at com.microsoft.bot.rest.ServiceResponseBuilder.build(ServiceResponseBuilder.java:122)
at com.microsoft.bot.azure.AzureResponseBuilder.build(AzureResponseBuilder.java:56)
at com.microsoft.bot.connector.rest.RestTeamsOperations.fetchChannelListDelegate(RestTeamsOperations.java:84)
at com.microsoft.bot.connector.rest.RestTeamsOperations.lambda$fetchChannelList$0(RestTeamsOperations.java:65)
at com.microsoft.bot.connector.rest.RestTeamsOperations$$Lambda$643/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2137)
at retrofit2.CompletableFutureCallAdapterFactory$ResponseCallAdapter$2.onResponse(CompletableFutureCallAdapterFactory.java:119)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:129)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:851)
Solution
That happens because the v3/teams/{teamId}/conversations
call is a POST in the code, but it should be a GET according to the Bot API documentation:
https://docs.microsoft.com/en-us/microsoftteams/platform/resources/bot-v3/bots-context
I’ll submit a PR with the fix.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Carousel Card Bot.Connector.ErrorResponseException ...
Channel : MSTeams. we developed a bot which takes some input, according to it displays 9 adaptive cards in carousel format. this was...
Read more >Get Teams specific context for your bot - Microsoft Learn
Get Teams specific context for your bot, fetch user profile, get single member, team's, list of channels in a team details.
Read more >Teams Full Report | PnP Samples
Script to generate Team's full report, gathering all Teams,Channels,Tabs ... Example:pnpcady.onmicrosoft.com" throw $msg } $tenantPrefix = $Tenant.
Read more >Get started with Teams and Channels in Microsoft Teams
In this tutorial video we introduce you to Teams and Channels in Microsoft Teams. A Team is a broad group of people who...
Read more >How To Add and Remove Channels in Microsoft Teams - IT Help
Additional information can be found on the Microsoft articles Create a Channel in Teams and Delete a Channel in Teams. Get Help. Chat:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jpblair This will be included in the next preview release, which should be around Feb. 15-ish.
@stroganovmaxv Ah. Apologies. Since this issue was about getTeamsChannels, we failed to evaluate the other calls. I can push a patch version. 4.6.1-preview8. Give me a bit.