Animation when we click on a button created in RASA (actions.py file) - html

Is there any way where we can add animation on a specific button click in RASA. The buttons are created in actions.py file of RASA chatbot.

You'd need to have a custom frontend in order to do that. The code for the actual visual component of the chat doesn't come from Rasa (though it integrates with a few via connectors), so you can connect it to your own chat widget with animations on the buttons.

You can do this in custom actions. I believe you need to fetch that data from your DB. When the user asks give me mobile no. xx, first you need to capture the name of that person in a slot.
Then in your custom actions make your API call to the DB or however you want to fetch the user details. Use:
# Fetch the data and store in the format used by buttons.
buttons = [{"title": "Shakir Sadiq", "payload": "/intent_name"}, {"title": "Shakir Sadiq", "payload": "/intent_name"}]
dispatcher.utter_button_message("There are 2 people with the name Shakir:", buttons)
Once the user selects a button again trigger custom actions and fetch his details.

Related

Foundry Workshop - Prevent duplicate data entry

I am building a Workshop App which will be used for data entry by a large number of operational staff members (> 200).
I would like to implement the following set-up:
The staff will enter the data on existing Ontology Objects. To facilitate this, I embedded a Foundry Form into the Object View, and set-up a corresponding write-back data set.
The Ontology Objects in question will be displayed in an Object Table in Workshop.
The staff member will select an Object from the Object Table.
The selected Object will be opened in an Object View.
The staff member will enter data on the Object View (Foundry Form being displayed here).
I need to make sure that no concurrent data entry can/will happen. How can I achieve this?
I am thinking about removing any Object which is opened in the Object View from the Object Table, but I am not sure if this is the best solution to the problem or how to achieve the removal from the table.
I am assuming that this must be a common problem and there would be a Design Pattern/Standard Functionality to solve this.
You'll have the best behavior here if you replace your Foundry Form with Foundry Actions. These actions are defined in the Ontology Management App and provide a more robust security model for managing object edits and are more tightly integrated into the various object-layer tools in Foundry.
Then in your Object View, rather than using the Foundry Forms widget, choose to create a new "Workshop-backed" Object View tab - this option is under the dropdown next to the New Tab button - and within the Workshop module use the Inline Action Form to embed the action form that you've configured in the Ontology Management App, supplying the variable representing the current object as the default for the object parameter in the Action.
With regards to simultaneous edits, in Actions, when the form is populated (i.e. when that tab is opened), the version of the underlying object(s) are registered. When the edit request is submitted, the current version of the object is checked, and if the version is different (i.e. there have been edits applied since the form was loaded) the user will be presented with message to the effect that the object has been updated and the edits will not be applied.
This protects against the case of a user overwriting a near-simultaneous edit without reviewing the changes first and does so at the writeback layer, rather than with logic in your application front-end.
There is not currently an approach to reflect real-time user interaction between two Workshop sessions. For instance, there is no way for the session of User A to "know" that User B has opened Object X in their session and is making a change.
If you wanted to do something for a bit of convenience or display signaling, you could create a small object type related to your main object - something like "Edit Lock" that looks like:
| id | primary_object_id | user_id | timestamp | timeout
And then in your Workshop app, there's a button above the table that says "Edit Selected Object".
When you click this button, you trigger an Action to create a new "edit lock" object populated with the current user and the current timestamp and say a timeout of 15 minutes from now.
Then in the object view for the primary object in question, on the same tab where you have the edit form embedded, you can create a variable that gets the edit locks associated with that object via a search around and use a Function to create a boolean variable if there is an "active" edit lock. And use this to conditionally show a banner to the user or otherwise give them a visual indication that another user has indicated they're making changes.
This won't push to the other session, and it'd be just for display purposes, the real protection still comes from the underlying object versioning that Actions enforces, but it might be a nice user affordance to layer on top if you really expect to commonly run into this situation.

MS Teams - TaskModule close the window

I display a third party web page(client page) in the task module
using Deeplink
https://teams.microsoft.com/l/task/botid?url=https:test.com/test.html&height=450&width=510&title=Custom+Form&completionBotId=botid
new AdaptiveOpenUrlAction() { Title = "Enable MS Team access", Url = new Uri(DeeplinkHelper.DeepLink }
Here the web page is opening in Task module, I need to close this task module by clicking the button available on the web page(URL) and send the result to completionBotId.
Any sample pls that need to implement in client-side code.
There are two steps to make this work:
you need to reference the Teams Javascript SDK in your web page
When your user clicks the button, you would call microsoftTeams.tasks.submitTask in your 'click' event handler. There are a few parameter options for this method, depending on whether you want it to send anything back to your bot. To simply close the window, call microsoftTeams.tasks.submitTask(null);, or if you want to send an object back, call microsoftTeams.tasks.submitTask(whateverObjectYouWantToSendBack);

Alfresco 5.0C advanced search Get slingshot search parameters

When you make an advanced search in Alfresco it returns a json response with results executing the script
http://localhost:8080/share/proxy/alfresco/slingshot/search/?facetFields=..
I have add a button in the aikau advanced search results page and I want to execute the same script. How can I call it and get its parameters ?
The aikau button
var button = {
name: "alfresco/buttons/AlfButton",
config: {
label: "Exec Script",
additionalCssClasses: "call-to-action",
onClick:....... **call facets script**...
}
};
Firstly, if possible I would recommend that you move up to using Alfresco 5.0.d as this will enable you to take advantage of the weekly releases of Aikau as described in this blog post.
As for your specific question... you should not be attempting to define an Aikau button like that (with the "onClick" attribute). Aikau works over a publication/subscription mechanism so buttons would be configured with a publishTopic and a publishPayload. The topic published would need to be subscribed to by another widget or a service.
If you're not familiar with working with Aikau then I suggest that you work through the tutorial on GitHub. You can also find an additional list of educational references here.

Implementing UI services with HTML services within a sites page

I am trying to wrap my head around some concepts and trying to extend the help desk exercise in the process. What I am trying to accomplish is the following:
Within the site, create a "re-usable" page and create multiple links in the navigation like:
https://sites.google.com/a/mydomain.org/helpdesk/tickets?status=new
https://sites.google.com/a/mydomain.org/helpdesk/tickets?status=open
This Page, contains an HTML Service which reads the query string parameters and proceeds to query a spreadsheet for all tickets with the specified status and that are assigned to the current user, then displays them in a table format.
Then on the table, on each line, there will be a button that says "add solution or comment", this will open a UI service that allows the user to enter some text and change status if necessary.
So my questions are:
Does this sound feasible? Can I call a UI service from an HTML template service?
Can the HTML Service read the query string parameters?
Any examples of this?
Thanks for your feedback.
You can not mix UI service with HTML service. Once you're using one you have to stick with it.
But what you described can be easily done using either one. i.e. showing a table with some info and a button per row, that will show a textbox. So, yes, this is perfectly feasible.
Reading the url parameters can be easily done on "server-side", that is, it's independent if you're using Html or Ui Services.
Example of reading parameters? Here it is:
function doGet(e) {
var status = e.parameter.status;
if( status == 'new' ) {
//do your thing
} else if( status == 'open' ) {
//just examples
} else
;//bad status
return appOrHtml;
}

How do I [WebMethod(EnableSession=true)] on UpdatePanel postbacks?

Currently we have a set of form controls that do post backs and we decided to get some "free" user experience by wrapping them in an update panel. The controls store data in the session state for that user so that we don't have to constantly request data from our platform.
When doing WebMethods and WebService calls if we want to make use of the session we have to set the EnableSession property to be true if we want to access the session. Since update panels also do the same thing, where is the proper place to put the WebMethod/EnableSession attribute so that requests made from the update panel have access to the session?
Thanks.
Wouldn't you put it on whatever event is associated with your updatepanel's trigger?