How to retrieve Adaptive Card's form submission in subsequent waterfall step

前端 未结 2 1854
慢半拍i
慢半拍i 2020-11-30 15:17

I\'m using the Bot Framework (V4) and I\'ve got a WaterfallDialog with two steps; first step is to capture form data and the second step is to process form data.

The

2条回答
  •  一生所求
    2020-11-30 16:01

    Here is nodejs version:

    your bot.ts file:

     this.onTurn(async (context, next) => {
      if (context.activity.type == ActivityTypes.Message) {
        // Ensure that message is a postBack (like a submission from Adaptive Cards)
        if (context.activity.channelData != null) {
          if (context.activity.channelData.postBack === true) {
            const postbackActivity = context.activity;
            // Convert the user's Adaptive Card input into the input of a Text Prompt
            // Must be sent as a string
            postbackActivity.text = JSON.stringify(postbackActivity.value);
            // context.activity.text = postbackActivity.value
            await context.sendActivity(postbackActivity);
          }
        }
      }
      await next();
    });
    

提交回复
热议问题