botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Feature Request] Cleaner code to add ISuggestedActions in builder.Message()

Open ronak-itility opened this issue 9 years ago • 2 comments

Pre-flight checklist

  • This request arise from an earlier issue on emulator handles the builder.Message(session).suggestedActions at issue #200 on BotFramework-Emulator

System Information (Required)

  • SDK Platform: Node
  • SDK Version: 3.8.3
  • Development Environment: localhost + BotFramework-Emulator

Issue Description

BotFramework-Emulator had an issue in documentation on how to use builder.Message(session).suggestedActions and that discussion suggested to put a feature request, this is created. builder.Message(session).suggestedActions expects ISuggestedActions object, but rather it should be able to handle the array directly, keeping the code cleaner.

Example Code [DONT USE IT, its buddy code]

Suggested way should be like this, its more intuitive. Source : Add suggested actions to message on Bot Framework documentation

intents.onBegin(
    (session,args) => {
       let msg = new builder.Message(session)
            .text("Thank you. Short message.")
            .suggestedActions([
                builder.CardAction.imBack(session, "productId=1&color=green", "Green"),
                builder.CardAction.imBack(session, "productId=1&color=blue", "Blue"),
                builder.CardAction.imBack(session, "productId=1&color=red", "Red")
            ]);
        session.send(msg);
      }
      );

Expected Behavior

Improve the related suggestedActions implementation for builder.Message() and almost any other utility using ISuggestdActions

ronak-itility avatar May 18 '17 19:05 ronak-itility

For comparison, the current and correct code taken from the feature-suggestedActions example is as follows:

      var msg = new builder.Message(session)
          .text("Hi! What is your favorite color?")
          .suggestedActions(
              builder.SuggestedActions.create(
                  session,[
                      builder.CardAction.imBack(session, "green", "green"),
                      builder.CardAction.imBack(session, "blue", "blue"),
                      builder.CardAction.imBack(session, "red", "red")
                  ]
              )
          );

stevengum avatar May 20 '17 20:05 stevengum

Thank you for opening an issue against the Bot Framework SDK v3. As part of the Bot Framework v4 release, we’ve moved all v3 work to a new repo located at https://github.com/microsoft/botbuilder-v3. We will continue to support and offer maintenance updates to v3 via this new repo.

From now on, https://github.com/microsoft/botbuilder repo will be used as hub, with pointers to all the different SDK languages, tools and samples repos.

As part of this restructuring, we are closing all tickets in this repo.

For defects or feature requests, please create a new issue in the new Bot Framework v3 repo found here: https://github.com/microsoft/botbuilder-v3/issues

For Azure Bot Service Channel specific defects or feature requests (e.g. Facebook, Twilio, Teams, Slack, etc.), please create a new issue in the new Bot Framework Channel repo found here: https://github.com/microsoft/botframework-services/issues

For product behavior, how-to, or general understanding questions, please use Stackoverflow. https://stackoverflow.com/search?q=bot+framework

Thank you.

The Bot Framework Team

JasonSowers avatar Oct 01 '18 22:10 JasonSowers