Git Product home page Git Product logo

Comments (14)

rrc2k4 avatar rrc2k4 commented on July 28, 2024

Appreciate if any update on this.

from botbuilder-v3.

EricDahlvang avatar EricDahlvang commented on July 28, 2024

Hi @rrc2k4

How are you loading and sending this card?

I removed the first level of json from what you've posted above:

{
  "@type": "MessageCard",
  "@context": "http://schema.org/extensions",
  "title": "Incident Updated - INC0010010",
  "summary": "Incident Updated - INC0010010",
  "themeColor": "D1222B",
  "sections": [
    {
      "title": "",
      "text": "",
      "activityTitle": "",
      "activitySubtitle": "",
      "activityText": "",
      "facts": [
        {
          "name": "Category",
          "value": "Software"
        },
        {
          "name": "State",
          "value": "New"
        },
        {
          "name": "Priority",
          "value": "5 - Planning"
        },
        {
          "name": "Assignment group",
          "value": "Software"
        }
      ]
    },
    {
      "text": "Please check the details"
    }
  ],
  "potentialAction": [
    {
      "@type": "OpenUri",
      "name": "View Incident in ServiceNow",
      "targets": [
        {
          "os": "default",
          "uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"
        },
        {
          "os": "iOS",
          "uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"
        },
        {
          "os": "android",
          "uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"
        },
        {
          "os": "windows",
          "uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"
        }
      ]
    }
  ]
}

And load/send the card with this code:

var sPath = System.Web.Hosting.HostingEnvironment.MapPath("/Resources/o365Card.json");
var adaptiveCardJson = File.ReadAllText(sPath);

var cardAttachment = new Attachment()
{
    ContentType = "application/vnd.microsoft.teams.card.o365connector",
    Content = JsonConvert.DeserializeObject(adaptiveCardJson),
};
var reply = activity.CreateReply();
reply.Attachments.Add(cardAttachment);
await context.PostAsync(reply);

image

Using the following packages:

  <package id="Microsoft.Bot.Builder" version="3.30.0" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder.Azure" version="3.16.3.40383" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder.History" version="3.30.0" targetFramework="net46" />
  <package id="Microsoft.Bot.Connector" version="3.30.0" targetFramework="net46" />
  <package id="Microsoft.Bot.Connector.Teams" version="0.10.0" targetFramework="net46" />

from botbuilder-v3.

rrc2k4 avatar rrc2k4 commented on July 28, 2024

Hi Eric,

Apologies for mislead on payload content.

I tried with the above code and mentioned packages but unable to see any button in the card,

<package id="Microsoft.Bot.Builder" version="3.30.0" targetFramework="net46" /> <package id="Microsoft.Bot.Builder.Azure" version="3.16.3.40383" targetFramework="net46" /> <package id="Microsoft.Bot.Builder.History" version="3.30.0" targetFramework="net46" /> <package id="Microsoft.Bot.Connector" version="3.30.0" targetFramework="net46" /> <package id="Microsoft.Bot.Connector.Teams" version="0.10.0" targetFramework="net46" />

image

from botbuilder-v3.

EricDahlvang avatar EricDahlvang commented on July 28, 2024

Which teams client are you using?

Can you share your teams manifest?

from botbuilder-v3.

rrc2k4 avatar rrc2k4 commented on July 28, 2024

Microsoft Teams Version 1.3.00.13565 (64-bit). It was last updated on 5/29/20.

Hope you are referring bot manifest file. We haven't published our bot yet on MSTeams. We are still in development phase and below is the manifest file for that bot(altered company specific & bot identity information).
{ "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json", "manifestVersion": "1.7", "version": "1.0.0", "showLoadingIndicator": true, "id": "XXXXX", "packageName": "XXX.teams.com", "developer": { "name": "XXXX", "websiteUrl": "XXXXXX", "privacyUrl": "XXXXX", "termsOfUseUrl": "XXXXXXXX" }, "icons": { "color": "color.png", "outline": "outline.png" }, "name": { "short": "XXXX Chatbot", "full": " XXXX Chatbot" }, "description": { "short": "sample chat bot ", "full": "test chat bot for msteams integration" }, "accentColor": "#FFFFFF", "staticTabs": [ { "entityId": "XXX", "name": "XXXX", "contentUrl": "https://bing.com", "websiteUrl": "https://bing.com", "scopes": [ "personal" ] } ], "bots": [ { "botId": "XXXXXXXXXXX", "scopes": [ "personal" ], "supportsFiles": true, "isNotificationOnly": false } ], "permissions": [ "identity", "messageTeamMembers" ], "validDomains": [ "bing.com", "token.botframework.com", "*.service-now.com", "technology.genpact.com" ], "devicePermissions": [ "openExternal" ] }

from botbuilder-v3.

EricDahlvang avatar EricDahlvang commented on July 28, 2024

Is this a windows os? Does this happen for all users of the bot?

Sorry, but nothing stands out and i cannot repeat this issue. It must be something specific to your environment or bot. Can you share more of the code?

from botbuilder-v3.

rrc2k4 avatar rrc2k4 commented on July 28, 2024

Yes, everything is on Windows OS, clients and server/webservices. And it happens to all the users( we currently have 3 users in development). We checked the same functionality in MSTeams web & windows clients both doesn't display "button".

Suspecting environment issue, we even tried in our lab network where we dont have any company proxy policies but still same issue. Suspecting domain permissions in MSTeams app, we even added our source url (www.dev62584.service-now.com) in valid domains and tested but no luck.

Source Code is same what you had shared, no changes in code and payload. Even degraded/upgraded required packages as per your suggestions but no success.

Let me build a sample echo bot from scratch and with mentioned packages and let you know the results.

from botbuilder-v3.

rrc2k4 avatar rrc2k4 commented on July 28, 2024

Hi Eric,

I had built a sample echo bot with mentioned packages and code but still dont see buttons in the card. Same JSON payload when triggered through MSTeams incoming webhooks works fine. able to see buttons in the card thru webhooks but not from bot messages.

.net framework: 4.6
Bot SDK:V3

EchoDialog.CS code:
`using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using Microsoft.Bot.Connector.Teams;
using System.Threading.Tasks;
using System.Threading;
using System.Net.Http;
using System.Net.Http.Headers;
using AdaptiveCards;
using Microsoft.Bot.Connector.Teams.Models;
using System.IO;
using Newtonsoft.Json;

[Serializable]
public class EchoDialog : IDialog<object>
{
    protected int count = 1;

    public async Task StartAsync(IDialogContext context)
    {
        await context.PostAsync("Hello User, I am bot. Your virtual assistant.");
        context.Wait(MessageReceivedAsync);

    }

    public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
    {
        var message = await argument;


        if (message.Text == "reset")
        {
            PromptOptions<string> objPrompt = new PromptOptions<string>("Are you sure you want to reset the count?",
               "Didn't get that!", "Sorry, you had exceeded max. attempts", null,
               1, promptStyler: new PromptStyler(PromptStyle.Inline));

            PromptDialog.Confirm(context, AfterResetAsync, objPrompt);
            return;

        }
       
        else if (message.Text == "messagecard")
        {
           
            var sPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + @"App_Data\SNOWCard.json";
            var adaptiveCardJson = File.ReadAllText(sPath);

            var cardAttachment = new Attachment()
            {
                ContentType = "application/vnd.microsoft.teams.card.o365connector",
                Content = JsonConvert.DeserializeObject(adaptiveCardJson),
            };
            var reply = context.MakeMessage();
            reply.Attachments.Add(cardAttachment);
            await context.PostAsync(reply);
        }
       
        else
        {

            if (!string.IsNullOrEmpty(message.Text))
                await context.PostAsync($"{this.count++}: **You said** {message.Text}");
            else if (!string.IsNullOrEmpty(ClsGeneric.GetObjectValue(message.Value)))
            {
                await context.PostAsync("Received this JSON:" + ClsGeneric.GetObjectValue(message.Value));

               
            }

            if (message.Attachments != null && message.Attachments.Any())
            {
                var attachment = message.Attachments.First();
                await context.PostAsync($"Attachment of {attachment.ContentType} type and size of  bytes received.");
            }
            

            context.Wait(MessageReceivedAsync);
        }
    }
    

    public async Task AfterResetAsync(IDialogContext context, IAwaitable<bool> argument)
    {
        try
        {
            var confirm = await argument;
            if (confirm)
            {
                this.count = 1;
                await context.PostAsync("Reset count.");
            }
            else
            {
                await context.PostAsync("Did not reset count.");
            }

        }
        catch (TooManyAttemptsException)
        {
            await context.PostAsync("you had exceeded max. attempts, please try again..");
        }

        context.Wait(MessageReceivedAsync);
    }
}

`
JSON Payload is same as the one which you had mentioned above.

from botbuilder-v3.

rrc2k4 avatar rrc2k4 commented on July 28, 2024

Packages Info:

<packages>
  <package id="AdaptiveCards" version="1.2.4" targetFramework="net46" />
  <package id="Autofac" version="3.5.2" targetFramework="net46" />
  <package id="Chronic.Signed" version="0.3.2" targetFramework="net46" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net46" />
  <package id="Microsoft.Azure.DocumentDB" version="2.4.1" targetFramework="net46" />
  <package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder" version="3.30.0" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder.Azure" version="3.16.3.40383" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder.History" version="3.16.1.38846" targetFramework="net46" />
  <package id="Microsoft.Bot.Connector" version="3.30.0" targetFramework="net46" />
  <package id="Microsoft.Bot.Connector.Teams" version="0.10.0" targetFramework="net46" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="3.6.0" targetFramework="net46" />
  <package id="Microsoft.CSharp" version="4.5.0" targetFramework="net46" />
  <package id="Microsoft.Data.Edm" version="5.7.0" targetFramework="net46" />
  <package id="Microsoft.Data.OData" version="5.7.0" targetFramework="net46" />
  <package id="Microsoft.Data.Services.Client" version="5.7.0" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="4.4.0" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Logging" version="1.1.4" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Protocol.Extensions" version="1.0.4.403061554" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Protocols" version="2.1.4" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="2.1.4" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Tokens" version="5.1.4" targetFramework="net46" />
  <package id="Microsoft.Rest.ClientRuntime" version="2.3.2" targetFramework="net46" />
  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" />
  <package id="Polly-Signed" version="5.3.1" targetFramework="net46" />
  <package id="System.IdentityModel.Tokens.Jwt" version="5.1.4" targetFramework="net46" />
  <package id="System.Net.Http" version="4.3.4" targetFramework="net46" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net46" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net46" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net46" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net46" />
  <package id="System.Spatial" version="5.7.0" targetFramework="net46" />
  <package id="WindowsAzure.Storage" version="7.2.1" targetFramework="net46" />
</packages>

kindly suggest, as mentioned above same json payload when triggered through incoming webhooks of msteams works fine.

from botbuilder-v3.

cleemullins avatar cleemullins commented on July 28, 2024

Myself, Eric, Sid, and Tatiana looked at this. @tacri is going to try to duplicate.

from botbuilder-v3.

tacri avatar tacri commented on July 28, 2024

@rrc2k4 , we were finally able to repro this issue. It is a bug in the teams scope and doesn't repro in the personal scope. An easy way to unblock you would be to add in the potentialAction section an @id field like so:
"potentialAction": [
{
"@id":"1",
"@type": "OpenUri",

from botbuilder-v3.

rrc2k4 avatar rrc2k4 commented on July 28, 2024

@tacri ,

Sure, will add that id and get back to u. Just wanted to check y the same payload is working fine when sent through incoming web hooks, if it is a teams issue?

from botbuilder-v3.

tacri avatar tacri commented on July 28, 2024

@rrc2k4 , internally we treat slightly different the webhook and bot messages which leads to this behavior. Ideally we would make a fix, but since these type of cards are legacy and there is a work around we would prefer not to if you are unblocked.

from botbuilder-v3.

clearab avatar clearab commented on July 28, 2024

Hi! I'm going to go ahead and close this, please reopen if this issue is persisting.

from botbuilder-v3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.