BotBuilder-Samples: Cannot read property 'isChannelConversation' of undefined

Hello! I’m trying to use ActionTypes.PostBack on card returned from OnTeamsMessagingExtensionSelectItemAsync of my Teams bot with following code:

var card = new ThumbnailCard
  {
    Title = project.Name,
    Buttons = new List<CardAction>
      {
        new CardAction { Type = ActionTypes.PostBack, Title = "Subscribe", Value = query },
      },
  };
var attachment = new MessagingExtensionAttachment { ContentType = ThumbnailCard.ContentType, Content = card, };
return Task.FromResult(new MessagingExtensionResponse
  {
    ComposeExtension = new MessagingExtensionResult
      {
        Type = "result",
        AttachmentLayout = "list",
        Attachments = new List<MessagingExtensionAttachment> { attachment }
      }
  });

but when I press the button in browser I’m getting following error and nothing happens:

TypeError: Cannot read property 'isChannelConversation' of undefined
    at t.getAppDefinitionFromCard (https://statics.teams.cdn.office.net/hashedjs/3.2-app.min-c7c53b37.js:3:308254)
    at t.logTelementryForCardAction (https://statics.teams.cdn.office.net/hashedjs/3.2-app.min-c7c53b37.js:3:276083)
    at _.debounce.trailing (https://statics.teams.cdn.office.net/hashedjs/3.2-app.min-c7c53b37.js:3:148902)
    at e (https://statics.teams.cdn.office.net/hashedjs/2-vendor.min-68b363d0.js:64:245)
    at f (https://statics.teams.cdn.office.net/hashedjs/2-vendor.min-68b363d0.js:65:49)
    at t.e.buttonClicked (https://statics.teams.cdn.office.net/hashedjs/3.2-app.min-c7c53b37.js:3:148400)

Am I sending the card wrong? Is it supported flow? MessageBack and ImBack cause slightly different errors but anyway none of them work for me. It’s duplicate of https://github.com/microsoft/botframework-sdk/issues/5811 but I’m not sure what is the better place to ask the question.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

Hi @GDreyV, on April 21st (when you posted the issue), you stated

But is it possible to use buttons without sending the card (while it’s in compose message area)?

In subsequent readings, I missed the “in compose message area” of that question. Unfortunately, the answer is no. While the card is in the compose message state, the actions associated with any buttons are outside the context of the bot as the card, itself, hasn’t entered the message thread, yet. This means that any action you would wish the bot to respond to cannot occur because it can’t reach the bot until the card is sent by the user.

As you can see in this doc, all the card actions mention interacting with the bot in some way. It’s not surprising that openUrl is the only action that does work because the context of that action is separate from the bot and Teams.

@GDreyV, thank you for your patience. I am working on this and hope to have some response to you shortly.

Oh, sorry, I missed it. 5. This code doesn’t work, value will be null when user press the button

new CardAction {
  Type = ActionTypes.MessageBack,
  Title = "Subscribe",
  Value = new { project.Id }
}

and this code works

new CardAction {
  Type = ActionTypes.MessageBack,
  Title = "Subscribe",
  Value = JObject.FromObject(new { project.Id })
}