简体   繁体   中英

Using the Bot Framework to send message on the user's behalf

I'm currently attempting to accept voice input from the user, feed it into the Bing Speech API to get text, and pass that text as a user response. I've gotten as far as receiving the text back from Bing, but I'm not sure how to send that text as a user response. I've been scouring GitHub, so any feedback is appreciated. Relevant code is below:

function(session){
    var bing = new client.BingSpeechClient('mykey');
    var results = '';
    var wave = fs.readFileSync('./new.wav');

    const text = bing.recognize(wave).then(result => {
      console.log('Speech To Text completed');
      console.log(result.header.lexical)
      console.log('\n');
      results.response = result.header.lexical;
    });
    }]

You should use session.send .

I recommend you to take a look to the intelligence-SpeechToText sample, where a similar scenario is being shown.

Update: Figured it out (sorta). In order to take advantage of sending this user input back, I had to use another card. Within the context of the card, I'm able to use the imBack function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM