GoogleCloudPlatform / dialogflow-integrations

Dialogflow integrations with multiple platforms including KIK, Skype, Spark, Twlio, Twitter and Viber
https://cloud.google.com/dialogflow/
Apache License 2.0
247 stars 500 forks source link

Dialogflow integration with teams - Extract user information #97

Open MANASAMKRISHNA opened 3 years ago

MANASAMKRISHNA commented 3 years ago

We are trying to integrate Dialogflow chatbot with Microsoft Teams. We followed this tutorial (https://github.com/GoogleCloudPlatform/dialogflow-integrations/tree/master/skype) We got to a point where we’re able to send text-based basic intent mapped questions, and they’re working flawlessly.

Is there a way to extract user information out of Teams?

For example, in the Welcome Intent, instead of bot saying “Hello user”, is there a way to make it say “Hello John”?

A little bit of research led us to this (https://github.com/GoogleCloudPlatform/dialogflow-integrations/issues/37#issuecomment-647927403) but we find it a little bit confusing. Are we supposed to develop a method to handle incoming requests within dialoglow-integration/server.js? If so, where should we look for the said user information? Any pointers will help.

TIA.

mekpavit commented 3 years ago

Hi @MANASAMKRISHNA. First of all, sorry for my late reply. I didn't see this issue until you mentioned me on the other issue. BTW, here is my answers:

  1. Are we supposed to develop a method to handle incoming requests within dialoglow-integration/server.js?

    • IMO, you should not add more handlers on this HTTP server anymore. But I think it's impossible for standalone Dialogflow to captures some parts of information from the HTTP request and responses based on that information. So, if you want Dialogflow to response based on the user information on HTTP request, I believe you have to
      1. Develop a fulfillment webhook to add more flexibility on how your Dialogflow agent will response to users. Details are here. This fulfillment webhook will extract the user information (In this case, extract "John") from the HTTP request sent from Dialogflow, perform some logics to create a response message (in this case, create a sentence, "Hello John"), and response the message back to Dialogflow.
      2. Deploy you fulfillment webhook anywhere that give you a HTTPS domain
      3. Connect your Dialogflow agent with this fulfillment webhook. You can see how-to here.
      4. Set up your intents to use a webhook fulfillment
  2. Where should we look for the said user information?

    • If you've developed the fulfillment webhook, and start to receive some HTTP requests from Dialogflow. I suggest you to print out the HTTP request body. The user information will be somewhere in originalDetectIntentRequest field.
barissecen commented 2 years ago

We are trying to integrate Dialogflow chatbot with Microsoft Teams. We followed this tutorial (https://github.com/GoogleCloudPlatform/dialogflow-integrations/tree/master/skype) We got to a point where we’re able to send text-based basic intent mapped questions, and they’re working flawlessly.

Is there a way to extract user information out of Teams?

For example, in the Welcome Intent, instead of bot saying “Hello user”, is there a way to make it say “Hello John”?

A little bit of research led us to this (#37 (comment)) but we find it a little bit confusing. Are we supposed to develop a method to handle incoming requests within dialoglow-integration/server.js? If so, where should we look for the said user information? Any pointers will help.

TIA.

Hi Sorry for the late answer. You can get the user name from here; originalDetectIntentRequest.payload.from.name