How do we ensure that the BOT remembers the name provided by the user? - dialogflow-cx

DialogFlow CX
I am trying to ask the user her name, and then respond with "Nice to meet you " and then occasionally say that during the rest of the conversation. Not sure how to accomplish this in the bot. I understand we need to use #sys.person entity somehow, but not clear. Thanks.

You need to store in the variable like say person-name and if the name is detected by the Dialogflow then you can get the value in $session.params.person-name parameter which you can use for a single session.
here session means let's take an example I have started a conversation with the Dialogflow bot and I have said like My name is Dhruv. So through out my session I can get the Dhruv(Detected name) for $session.params.person-name. So where ever I have returned like Nice to meet you $session.params.person-name then it'll be replaced by Dhruv in the conversation.
Ref Video: https://www.loom.com/share/9da2fdbb9ac240df96955721b99c51af
Let me know if you have any more doubts.

Related

Dialogflow CX: capture a parameter from an annoted training phrase

I'm building a chatbot with the Dialogflow-CX V3 console. The bot allows users, among other things, to place an order for a new project. Each project must have a name, so I define a parameter called projectName that the user must provide. I have defined a custom entity type called projectNameText, a regex. I can capture projectName in a form using a typical Q-and-A format:
bot: What is the project name?
user: SalesPitch
But that is rather tedious. I want to allow more freeform user input and capture the projectName using an annotation on an intent training phrase.
bot: What would you like to do?
user: I'd like to make a new project called SalesPitch
When I define a training phrase for an intent like
I'd like to make a new project called Annabel
I can highlight Annabel in the console's intent editor and annotate that as an entity of type #projectNameText as described here. But that instantly creates a parameter with Parameter id projectNameText. And I cannot edit that Parameter id. I can't require that when Dialogflow matches that training phrase and extracts an entity of type projectNameText, it puts it into the parameter projectName. Dialogflow demands that it goes into a parameter called projectNameText. When I run the simulator and type input that matches that training phrase, Dialogflow does indeed correctly extract the entity, but will only create a parameter named projectNameText - I can see the name and value in the simulator.
This answer implies that I can send the matched entity into any parameter I want. That would be sensible. But how do I do it? I can't find any way to edit the parameter name in the Intent editor. All it gives me is this:
and I cannot change the Parameter Id.
I must be missing something really basic. Hints, please?
It is indeed not possible to edit the Parameter Id in the Intent Editor directly.
Instead, in the Intent Editor from the Build tab, accept the default Parameter Id, and Save the modified intent.
Then go to the tabs on the left of the Dialogflow CX console and choose the Manage tab. Choose Intents from the menu and find the intent you have just edited from the menu. Click the intent name to be given a different version of the Intent Editor. Same fields, same data, different functionality. In this different Intent Editor, click the Parameter Id you want to edit. It is now editable. Do not forget to hit Save after editing it.
From start to end, that took thirteen days to find. I posted here and received no answer. I finally subscribed to Google Cloud paid support and raised a support case and was given the answer in a video call with Google India. Perhaps it should be in the Google Documentation.

How do I initiate a dynamic user prompt depending on an API response in Bot Composer?

I have an API response in which a field gives me an array of objects. I want to prompt the user to select which one of these objects in the array they want to see the details of. For example, if the API response has a field like:
"field":[
{"number":"101","name":"abc","value":"final output 1"},
{"number":"102","name":"xyz","value":"final output 2"}
]
I want the prompt/card to ask which number and name the user wants to choose, accordingly I want to show the corresponding value to the user. The number of objects in the array can vary. I would prefer if this prompt is in the form of an adaptive card like the one in the attached image, but any solution would do using bot composer's capabilities.
One viable solution would be to build a card in code. You can parse the response from the API and use it to create a card which can then be sent by the bot. Since this is Composer, you can look into creating a custom action to hold this logic.
As the user AP01 has said, one good solution to this problem is to do it inside the code. You can create a custom component that will execute C#(or nodejs if you use that) code in which you can then easily deserialize/parse/process that json array and create a custom card that will then be display to the user. That is how I did it.

how to implement Multi-Tenant functionality in asp.net-core

I have an Asp.net Core application I want to be able to allow multiple/ different Tenant(Client)to access the same application but using different url's. I have common database for all tenant(client).
So It is the main part I want to host my application in a domain say... www.myapplication.com then allow different Tenant(client) to access the same application using
1.www.TenantOne.myapplication.com
2.www.TenanatTwo.myapplication.com.
3.www.{TENANCY_NAME}.myapplication.com
I can't find any info on how to do this and I'm stuck.
How to do it? Please provide the code. Thanks.
As Saravanan suggested these types of questions don't belong here on SO. To get you started, I suggest you start looking if there are any frameworks such as SaaSKit available to add a multi tenancy layer to the pipeline.
The essential part is to know where each request comes from. Using subdomains is a good way to achieve that and middleware is a good place to 'identify' your tenant. You could have a database to persist the tenants but the implementation is entirely up to you. I also wrote a little article on the subject. Although it isn't ASP.NET Core, the principles still apply.
The approach I believe you are looking for is similar to the article at the url below.
https://dotnetthoughts.net/building-multi-tenant-web-apps-with-aspnet-core/
In it, the author splits the requesting URL into an array of strings delimited by the dot in the address. The variable 'subdomain' is then set to the first element of that array. In your question, it looks like you may want to use the second element in the array, but you get the idea.
var fullAddress = actionExecutingContext.HttpContext?.Request?
.Headers?["Host"].ToString()?.Split('.');
var subdomain = fullAddress[0];
//do something, get something, return something
How you use this data is up to you. The author of the article created a filter attribute, but there are many possibilities such as passing the tenant name as a parameter to a service function.
Sorry,you have to get something to start with and then come back for the people to help you with.
I would say that this is all of a domain based wild card mapping and change in your authentication logic to get the tenant id from the URL. Once you identified the tenant, you just login and then take it forward. Like you might be having a database with the tenant details like
tenant1 | tenant1.company.com | guid-ofthe-tenant | etc...
Once you get the URL, you lookup in the above table and get the tenant code and then you choose the login mode and then proceed.
In case you have tried something yet, we would be happy to point you if it does not work yet.

Google Play Games: different player ids

I use Games scope to login in my game (addScope(Games.SCOPE_GAMES)), and then call Games.getCurrentPlayerId(), which returns a string that contains digits only, and when I try to send a gift to this player from another, using Games.Requests.getSendIntent(), the request.getRecipients() returns an id string which is starting with 'g'. Why are the identifiers different?
According to the getCurrentPlayer reference,
this gets the current signed in player, if available. It is referring to a specific user.
However, getRecipients
retrieves the information about all the players that the request was sent to. So this is more than one user. GPGS has its own reasons why it starts with 'g'. You can also do your own naming convention if ever you come up with your own API.

Identifying Email Messages by IDs

I was wondering if anyone knew whether there is a unique identifier attached to an email that I can use to verify whether emails are the same? I know about the EntryID and PR_SEARCH_KEY, but i need something abit more specific if it exists.
Supposed I forward an email to 3 people. I want to make sure that at most 1 copy of those forwarded emails is added to a database. Is there an identifier that will be shared between those three emails that i can record and use to disallow entry of the other two? Or will I have to add a manual tag somewhere on the email?
thanks
The obvious answer is the Message-ID, which all good emailers use. However, not everyone in the world uses it.

Resources