简体   繁体   中英

dialogflow (api.ai) intent redirection for translate webhook

I'm trying to use a Translate API webhook to enable multi-language functionality in my DialogFlow agent.

  1. The intents are configured in English
  2. When text is input to the bot in any other language, it goes to the Default Fallback Intent where the webhook is called for translating this text. The translated output and the user language context are returned.
  3. If I knew exactly what intent was to be triggered next in sequence, I could just have a Follow-up Event configured for this. But here the bot's output is translated text which shouldn't print but needs to be matched against all the English intents to see which is a hit. Then the output defined in the matching intent should be translated again to the user's language and produced as output.

Not sure how to have the translated text from the fulfillment go through all the intents and match accordingly. Please help?

For your step 3, you'll want to call Dialogflow's API with the translated text. If you're using Dialgogflow v1, you'll be calling the /query endpoint. If you're using Dialogflow v2, you'll need to have a session setup and then use the detectIntent action.

You'll then take the result you get back from this call and translate it back into the user's language, and send the result to them.

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