2
votes

I am working with Microsoft TEAMS application and I need to add a call to my application. My questions:

-------------- QUESTION 1 --------------

I am trying to use the HelloWorld Web app (HW) from TEAMS application, but 'Unable to reach app' message appears.

I have my HW compiled (Microsoft.Teams.Samples.HelloWorld in Visual Studio 2017) running locally (browser opens in http://localhost:3333/)

And with ngrok I can access remotelly (https://5d4c6462.ngrok.io) ngrok http 3333 -host-header=localhost:3333

This HW client generates a .zip with 2 .png files and the manifest.json file

Then in my TEAMS app (left panel) I go to Apps-'Upload a custom app', browse and get that .zip. My HW is visible for my user

In 'Teams' tab, I select a Team (MyTeam) and in 'Manage Team'-Apps, I install HW app ('More apps' button), but do nothing with 'Bot'/'Tab' and 'Messaging' options (all of them have a 'Set up' button that seems to do nothing)

After that, in MyTeam I can see the HW app when I write @hello, and my commands from composeExtensions (manifest) are available

But when I enter a text, 'Unable to reach app' is displayed

I supponse my problem is in the manifest file, but I don't know where... Anything related with an ID? Really there is no Message Extension URL to access my application...

In my Visual project, 'Assembly Info' I have a GUID value: "f543a88..."

I have used this value in the manifest, for 'id', and for 'botId' in 'bots' and 'composeExtensions' The rest of the values in the manifest file are the ones by default

-------------- QUESTION 2 --------------

I have some concepts not really understood, even after reading the apps-bots docu...

  • If I have an app (previous Hello World, for instance), i can upload it from Teams application (as explained above). And it can send messages to my application (or it will do when web application is found)
  • But how can I do that with a running bot? For instance from .NET framework samples (such as EchoBot project in csharp_dotnetcore solution)? I mean that project has no manifest to upload, where commands are visible for TEAMS to display... Must I create an app from TEAMS and load this bot during creation process?
  • In HW sample app, i have an MessagesController : ApiController to receive mesages, and I can check if it is a Message Extension with

    public async Task<HttpResponseMessage> Post([FromBody] Activity activity)
    {
        using (var connector = new ConnectorClient(new Uri(activity.ServiceUrl)))
        {
            if (activity.IsComposeExtensionQuery())
    

But can I check that in a BOT? AsFarAsIKnow, ActivityHandler are used to process received messages, with its methods (OnMessageActivityAsync, ...)

  • In an app like HW sample, is it possible to return something more complex than a text when a text is received? For instance, a Card

  • In a app manifest file, 'composeExtensions' have 'commands', where parameters are required (different types are available: text, date,...) But is it possible to create a command with no parameter? I mean maybe i just want to send a command to my application

Sorry If i.m saying anything with no sense, I am really new in TEAMS apps/bots...

Any help, please?

Thanks, Diego

4
Did you find what was going wrong? I am trying the same thing and it shows the app is not reachable. @diegoAkshat G

4 Answers

1
votes

Googling a similar issue when trying to get the sample bot to work in the C# Hello World Teams demo (https://github.com/OfficeDev/msteams-samples-hello-world-csharp), this point from one of @Diego's replies above:

c. Where I set the password in the manifest? I see no place for that

Made me realise that although, as above, I had entered the botid in the manifest.json, the bot password has to be entered in the appsettings.json file.

0
votes

@Deigo

Regarding Question1:

Have you created your own bot? I could see that you are using the default values in manifest. Please try creating a bot and set the bot's messaging endpoint to "https://yourngrokurl/api/messages".

Once you have the bot created, please add the Bot Id and password generated, in your manifest file. Add the botid to 'botId' in 'bots' and 'composeExtensions'. Create a zip file and upload it into teams.

Regarding Question 2:

I mean that project has no manifest to upload,

You could create your own manifest file using App Studio.

is it possible to return something more complex than a text when a text is received? For instance, a Card

Yes you could return cards. Please check this sample for Adaptive cards

But is it possible to create a command with no parameter?

Parameters object is optional. You could configure the Message Extensions without parameters.

Please let me know if I have missed out answering something. Also please reach out incase you face any issues.

0
votes

Thanks for your response. I really appreciate your time... I add a response since there is too much text for a comment... :(

QUESTION 1.

I tried to create a bot using https://dev.botframework.com/bots/new:

  1. I enter NameBot, Messaging Endpoint and generate a new app id (Create Ms App Id and pass -> App registration portal): I see a new AppID, but not password...
  2. I set the AppID and Register: 'Bot created' (This id is the Bot Id?)
  3. I can see in https://dev.botframework.com/bots: 'Web Chat' 'running' and I add TEAMS as channel -> I see both 'running' but TEST righe panel does NOT work (send failed. Retry)

Then I must change the manifest in HW application or the WebConfig file? Where must I set the new ID (got in previous step 2)?

a. Must I change the top id (it was my application original id)

b. Must I set this id as botId? (bots & composeExtensions) -> I did that

c. Where I set the password in the manifest? I see no place for that

Then how I build the bot? (step 2 in 'Create bot' link). I thought I had to recompile my Visual project and load the new zip into TEAMS.

I am doing something wrong, I'm sure is related with IDs: I always get 'Unable to reach app' message when trying to use my Message Extension commands

My Ids:

  • In my HW application manifest (Visual Studio sample) I have 2 ids (top & 2xbot)
  • In my HW Web.config file, I have a MicrosoftAppId and a MicrosoftAppPassword

  • In Azure portal (https://portal.azure.com) I have my new (required) application registered with an 1. Application (client) ID, 2. a Directory (tenant) ID, 3. an ObjectID.

  • In Bot Framework (https://dev.botframework.com), I have a new created bot, where I set the Application (client) ID from Azure portal... correct?

Besides, when I use ngrok, I see that POST /api/messages is 401 Unauthorized... why can be that?


I also have tried to use App Studios to create a bot:

  • 'Import an existing app' and load my existing HelloWorld zip
  • In App details, current values from manifest are loaded
  • In Capabilities/Bots, I create a bot (got new id & password), and I add Bot endpoint address
  • In Message extensions, I use this bot (same values are loaded) BUT when I try to install (Test and distribute), i get "Uploading custom apps is not allowed"

QUESTION 2 ****************************

I have DoNetCore samples, and I can see how to send a complex response BUT using an ActivityHandler (OnMessageActivityAsync method)

My doubt is how to send a Card (for instance) from the HelloWorld app, which has NOT the ITurnContext (with SendActivityAsync method). This app manages incoming requests with an ApiController and this method

   public async Task<HttpResponseMessage> Post([FromBody] Activity activity)

I see a ComposeExtensionResponse, but I can not see how to send a complex response here I see activity.CreateReply(), but only with text

In dotNet bot samples, I have a Microsoft.Bot.Schema.Activity, but in Hello World app I have a Microsoft.Bot.Connector.Activity

I'm afraid I have some concepts mixed (1. app-ApiController-POST and 2. Bot-ActivityHandler) and I can not understand reading the docu...

My goal is to have an application with Message Extension (HelloWorld sample app), to get commands from TEAMS (with @MyApp...), but I need to send things like Cards or rich text to TEAMS (dotNet bot samples)


About 'Parameters object', I see as Required when add a new Command in Messaging Extension (App Studio-ManifestEditor-Import an app)

Thank you a lot,

Diego

0
votes

I got the same problem. It looks like the problem occurs if user does not have enough rights to install the bot application. It is possible to install app and use tabs but the bot will not work. I have managed to provide required rights to the user as descibed in the related problem.

The Bot works now on my side.