0
votes

I'm creating my first Microsoft Teams extension. For now I'm just trying to get the basic plumbing for a messaging extension working. I'm trying to build an extension which will allow a user to search for content in my service and then return a card into their compose window in personal and Teams chats.

I've tried to follow the basic guide ( https://docs.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/how-to/create-messaging-extension ) for creating a messaging extension using App Studio. I've setup a bot as it describes, and I have built a dummy echobot endpoint for the bot (using Ruby). I am able to "chat" with my bot directly in the Teams client and it is able to respond.

My messaging extension defines an action based command with a taskInfo with a web view URL to render and a fetchTask set to false. I've written a basic static HTML page for this and included the teams-js library. The web view loads and the teams-js library initialization callback is called. I have a submit button which calls microsoftTeams.tasks.submitTask which as I understand it, should be calling my bot with a "composeExtension/submitAction" message to which I would respond with the card. (Based on https://docs.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/how-to/action-commands/respond-to-task-module-submit?tabs=json )

I've tried installing my extension in Teams through the "Upload a custom app" option both as a "for me and my teams" and "for " but still have the following issues.

When I open my extension in the Teams client from the compose area and click this submit button in my iframe content, the submit I get a "Unable to reach app. Please try again" error displayed. In the dev console, I can see that the response to the "invoke" http post is {"errorCode":404,"message":"V3 agent not found."}

No traffic is actually sent to my bot during any of this process.

I saw this older post - Compose extension is throwing error : V3 agent not found . The https://dev.botframework.com/bots/ it refers to seems to be outdated, but in the Azure "Bot Channels Registration" console, I have gone to Channels and added "Microsoft Teams" (which I believe is the new equivalent).

Has anyone seen this happen and figured out what was going on? Much thanks!

2
Have you confirmed that you're using the correct id for the submitTask command? It needs to be the AppId as per the Azure App for the BotHilton Giesenow

2 Answers

0
votes

Here is sample code for composeExtension/submitAction for Bot SDK V3. Make sure you pass the bot id and command text in taskInfo object.

 case "composeExtension/submitAction":
                    string commandid = JsonConvert.DeserializeObject<Models.TaskModuleSubmitData<string>>(activityValue).commandId;
                    taskInfo = GetTaskInfo(commandid);
                    taskEnvelope = new Models.TaskEnvelope
                    {
                        Task = new Models.Task()
                        {
                            Type = Models.TaskType.Continue,
                            TaskInfo = taskInfo
                        }
                    };

                    return Request.CreateResponse(HttpStatusCode.OK, taskEnvelope);
0
votes

Hilton had the right answer.

I had grabbed the Subscription ID from the Bot Channels Registration page instead of the App ID from the Azure Active Directory -> Apps Registration page and used that in the messaging extension manifest as the "botId" in the composeExtensions array. After fixing that I'm now getting messages submitted to my bot backend.