microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.5k stars 2.44k forks source link

CardAction with Type ImBack is not responding in Telegram #4207

Closed irfanzz closed 6 years ago

irfanzz commented 6 years ago

Bot Info

Issue Description

I am using HeroCard with Button type ImBack. When user click that button in telegram, it doesn't give any response or any message to my bot. In Facebook or emulator the behaviour is ok.

image

After that, i got an error in my channel: image image

Code Example

`

      public async Task TestResponse(ConnectorClient connector, Activity activity, ConversationBot conv)
       {
        Activity replyToConversation = activity.CreateReply();
        replyToConversation.Attachments = new List<Attachment>();

        List<CardAction> cardButtons = new List<CardAction>();
        cardButtons.Add(new CardAction()
        {
            Value = $"https://jsonformatter.org/",
            Type = ActionTypes.OpenUrl,
            Title = "Open Link"
        });
        cardButtons.Add(new CardAction()
        {
            Value = "Im back",
            Type = ActionTypes.ImBack,
            Title = "Im Back"
        });

        HeroCard plCard = new HeroCard()
        {
            Title = "Title",
            Subtitle = "SubTitle",
            Buttons = cardButtons,
        };

        Attachment plAttachment = plCard.ToAttachment();
        replyToConversation.Attachments.Add(plAttachment);
        await connector.Conversations.ReplyToActivityAsync(replyToConversation);
         }

`

Reproduction Steps

  1. Click ImBack Button

Expected Behavior

ImBack message is appear and sent to my bot

Actual Results

nothing happen

JasonSowers commented 6 years ago

I am able to reproduce at least part of this. When clicking an ImBack button the text does not display. However, the message is still being sent to my bot, are you seeing this as well?

Confirming this is a bug, but am not entirely sure if it is on our end or telegram's end yet.

irfanzz commented 6 years ago

Hi Jason, in my case, the message is not sent to me. I am trying to capture the whole activity to see if there any message coming from Telegram, but my controller is not getting any message.

Here my controller code

    [Authorize(Roles = "Bot")]
    [HttpPost]
    public async Task<OkResult> Post([FromBody] Activity activity)
    {
        BotBusiness bot = new BotBusiness();
        ConversationBot conversation = bot.FindConversation(context, activity, MainEngine.UserSystemId);

        SaveActivityLog(activity, conversation);

        if (activity.Type == ActivityTypes.Message)
        {
            //MicrosoftAppCredentials.TrustServiceUrl(activity.ServiceUrl);
            var appCredentials = new MicrosoftAppCredentials(configuration);
            var connector = new ConnectorClient(new Uri(activity.ServiceUrl), appCredentials);

            // return our reply to the user
            await HandleMessage(connector, activity, conversation);
        }
        else
        {
            //HandleSystemMessage(activity);
        }
        return Ok();
    }
irfanzz commented 6 years ago

Hi @JasonSowers , my bad, i still get the message.