Adaptive Cards - Get PostBack for actions - azure

I have to use adaptive cards in certain situation. When I use these cards, I need to have some buttons that can perform different actions when clicked. Previously, I have been using Hero Cards to return data and create the buttons. I have found that postBack (for hero cards) is the way to accept the button output most effectively for me. Unfortunately, adaptive cards doesn’t seem to have postBack. Instead, I need to use Action.Submit. However, when I do this, I end up with the text from the button showing as part of the conversation. I don’t want that and need it to be consistent with postBack. I tried to use the method from this comment https://github.com/Microsoft/AdaptiveCards/issues/558 (the guy has the exact same ask as me) but, it doesn’t seem to work anymore (from 2017). Any suggestions? I'm using SDK V4 and the basic bot NodeJS build found in the Azure portal.
Thanks for the help in advance
Adding the code for more detail:
var card = {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{"type": "TextBlock",
"text": answer},
table],
"actions" : [{
"type": "Action.Submit",
"title": wrap(promptQuestions[0]),
"data": promptQuestions[0]
},
{
"type": "Action.Submit",
"title": wrap(promptQuestions[1]),
"data": promptQuestions[1]
}]
}
console.log(card)
return CardFactory.adaptiveCard(card);

Submit action data is supposed to be an object and not a string. See my blog post for more information: https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/

Related

Dialogflow buttons in Slack generating separate session from typed entries

My Dialogflow sessions seem to change by whether I manually type in text or click on a button. My backend function generates the buttons in a payload for slack that is displayed in Dialogflow.
The buttons show properly and work as expected except when I need something from the output contexts and existing session. The problem seems to be that when I am manually entering text in Slack, it is one session and when I click on a button, it is another session. I don't know why that would be the case, but I obviously want them to be treated as one session.
I created a simple intent and webhook call which simply returns the current session ID when called. I created a "what session" intent. I created a "what session" button with a value of "what session". When I type "what session" (or "which session"), the session comes back as a certain session with the buttons as expected. When I click on the "what session" button, I get the same result EXCEPT it is a DIFFERENT session. Every time I click on the button, I am in one session and when I manually type in "what session" again, I get the original session.
In the history, you can see two different conversation streams.
So, how do I have the buttons, when clicked, keep the user in the same session?
Here is the format for the buttons (pretty straight forward). The backend function also populates the "text" field with the session value, but doesn't change anything else.
{
"slack": {
"text": "",
"attachments": [
{
"blocks": [
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "test"
},
"value": "test"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "what session"
},
"value": "what session"
}
]
}
]
}
]
}
}
Here is what the interaction looks like on slack (on mobile):
Here is the history in Dialogflow showing the two separate streams:
Google support helped me on this - thank you!
The solution was to add the Request URL into the Interactivity & Shortcuts section.
Now, imagine my embarrassment when I reread the last step in the instructions to do exactly this:
"To use rich messages, copy the ‘Events Request URL' value below and paste it into the 'Request URL' field from the Interactive Messages section of your Slack app settings."
HOWEVER, in my defense, I wondered how I had missed this twice (since I set up everything again for testing to see what I was missing). I know I would have done this. The weird thing was that when I completed the step in Slack, I realized that my changes were not being saved on that page. I clicked on the "Save Changes" and assumed it had saved, but the button had not turned green so the changes had not been saved. So, my advice to anyone experiencing the issue above is to ensure that all their changes were saved in Slack.

Configurable static tab in SharePoint

I have developed a SharePoint WebPart that I want to use in my Teams. In this WebPart I can hot-swapping several properties: width, height... but when I try to use this WebPart in Teams, I can't customize this properties and is a necessary thing.
In the manifest file, I have declared a staticTab because I need to pin the icon in the left menu.
"staticTabs": [
{
"entityId": "example",
"name": "exampleName",
"contentUrl": "https://{teamSiteDomain}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest=/_layouts/15/teamshostedapp.aspx%3FopenPropertyPane=true%26teams%26personal%26componentId=XXXXXXXXXXXXXXXXXXXXXXXXXXXX%26forceLocale={locale}",
"scopes": [
"personal"
]
}
],
Somebody know how I could have a static tab and customize the properties?
On the other hand, If I try, from the the catalog, to click on "sync button between SP & Teams" it doesn't works.
Kind regards!

SAPUI5 - Mobile app paging, alternatives to paginator

I'm investing a survey / questionnaire app in SAPUI5...
As it's mainly to be used on a mobile device, and the questionnaires will consist of many questions, what are the best SAPUI5 components to use for paging through the questions?
Paginator is ugly and will be deprecated soon, so I'm looking for alternative suggestions.
Can anyone help?
how about NavContainer. https://sapui5.hana.ondemand.com/explored.html#/sample/sap.m.sample.NavContainer/preview
It is very good fit for your use case , and it has good user experience in mobile devices. You can define your own Back and Next button in the footer to navigate between different questions.
Thank you.
I know the question is already answered by Allen, so this is an alternavtive suggestion.
Assuming that your model will be something like:
{
"Questions": [{
"QuestionID": "0001",
"QuestionText":"What is a Blah?"
"Options": [{
"OptionA":"Blah",
"OptionB":"BlahBlah",
"OptionC":"BlahBlahBlah",
"OptionD":"None Of the Above Blahs"
}]
},{
"QuestionID": "0002",
"QuestionText":"To Blah or not to Blah?"
"Options": [{
"OptionA":"Yes",
"OptionB":"No",
"OptionC":"Blah",
"OptionD":"Blah ha ha ha"
}]
}]
}
You can also accomplish the same effect without a NavContainer and a Single View. The View will be bound to the above model. The View / Page might have two buttons for the "next" and "previous" functionality. On click of each button you can manipulate the BindingContext that is bound to the view so that the Context changes and not the view. To set a new BindingContext, you can track which question is currently displayed on the screen and use the .bindElement function to set the Path of the next / previous element to be displayed.
Pros: Only one View and Controller
Cons: Need to manage the context and paths, Also means that the binding is little more complex and you might need factory functions based on whether the number of answers can vary between 2 (True / False questions) to 4 (MCP as in the above example)
Helpful link for Element Binding: https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.core.tutorial.databinding.13/preview
Thanks for all you help on this. I'd like to use binding path/context to create a new survey create app, but just need some examples of manipulating the binding to create a new path for example, I've created a new question
here

DocuSign: How to send a radio group selection in recipient tabs?

I have radio groups set up in my template and I want to pre-fill these tags using the REST API.
Please don't ask for code and/or request/response dumps. I don't have any code to show and I am asking for this because it is not documented. I want to know what sort of JSON I need to be producing so this is really not about my code or programming language.
(Anything below this line is half rant and half describes my failed attempts at finding the documentation for this feature. It might still be useful if somebody else has the exact same problem with me.)
Here is the documentation for the API I am trying to use. There is an example for textTabs but radioGroupTabs is not even mentioned here. It is mentioned here but I can't make much out of the "null", obviously I should be sending something other than null.
Moving on, the only useful information I can find on the radio groups is about how to create them in a template, it's here. This page also doesn't mention anything about pre-filling the values for a recipient. But it's linked from here (see tabs) anyway. There is a bit of information here:
value: if an X, this is the selected radio button. Only one radio button in a group can be selected.
And then just before this it says:
selected: Sets if this is radio button is selected. Use true/false to show the value is selected or not. Only one radio button can be true.
So we learn there are only just two ways to specify a radio widget selected. Of course this applies when you are creating the widget.
Nevertheless I tried to make requests assuming this would also work for pre-filling I got this helpful error message:
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Object reference not set to an instance of an object."
}
When I search the support forum I've found this, it's not exactly the same with my problem, I'd be happy to be able to set the wrong radio widget selected (as opposed to getting the UNSPECIFIED_ERROR) but this post is about the XML API.
I started my frantical search for the new topic button, it is so well placed you can usually find it in less than 10 minutes. I remember I used to go to my profile and then click something there... Then I did what every rational developer would do in the first place and went back to the post URL and read the breadcrumbs; Dev Zone section was renamed as Dev Zone (MOVED TO STACK OVERFLOW - Use tag DocuSignAPI). So here I am.
Could anyone please tell where this feature is documented or maybe provide a sample JSON please?
You've found the correct page for how to create radio buttons, not sure why you're having trouble using that resource. You've mentioned that's the code to CREATE the radio button tabs and not send them. That's not correct - the request body to send them is the same exact body only that the status property of the request changes from created to sent.
I just tested sending two radio buttons with the first button selected by default and it worked fine for me. Here is the full request body I used for my document signature request, this should work for you as well:
{
"emailBlurb": "Testing DocuSign radio buttons",
"emailSubject": "Custom PHP script",
"status": "sent",
"documents": [
{
"documentId": "1",
"name": "test.pdf"
}
],
"recipients": {
"signers": [
{
"email": "john.doe#docusign.com",
"name": "John Doe",
"recipientId": "1",
"tabs": {
"signHereTabs": [
{
"xPosition": "100",
"yPosition": "200",
"documentId": "1",
"pageNumber": "1"
}
],
"radioGroupTabs": [
{
"documentId": "1",
"groupName": "RadioGroup1",
"radios": [
{
"pageNumber": "1",
"selected": "true",
"value": "X",
"xPosition": "300",
"yPosition": "75"
},
{
"pageNumber": "1",
"selected": "false",
"xPosition": "350",
"yPosition": "75"
}
]
}
]
}
}
]
}
}
To add to this, the above example uses absolute positioning to position the radio buttons on the document. The other way of specifying tab locations in DocuSign is by using what's called "Anchor Tagging". With anchor tagging, instead of positioning based on coordinate systems, you can you can position your tabs with respect to document content. Please see the following two links to learn how to use anchor tagging, it's quite easy to switch to this method:
Anchor Tagging Introduction - Look at the "Tab Positioning" section
Related Stack Overflow Link

QSelectSection not saving values when scrolling QuickDialog

I've been struggling with this for 3 days. The documentation for the QSelectSection is the class itself, and the QuickDialog docs are minimal at best.
I'm trying to use the QSelectSection using the QuickDialog framework. I have it working for most of the controls (after diving head first into the code to see how the component works) but this one has beaten me. From my understanding, and the way the other controls work, this should dump the selected item values into the alerts array within my controller. I want to put as much in the JSON as I can, and only use the controller to store/submit the details if this is possible.
The JSON below generates the dialog and my multi select form. Awesome, but for some reason when I scroll the select section off screen, my values are gone. When I submit the form, the app does not see my selected items. When I try to use "controllerAction" to store these values, the app just crashes.
{
"grouped": true,
"title": "MyTitle",
"controllerName": "LOrderViewController",
"sections": [
{
"title": "Notifications",
"type": "QSelectSection",
"bind": "selectedItems:alerts",
"multipleAllowed": true,
"items": [
"Email Alerts",
"App Alerts"
],
"footer": "My Footer text."
}
...
]
}
What am I missing? What code is required in my controller, how can I trigger that code?
Am I better off scrapping QuickDialog for something that is better documented, or just stick with native methods?
Love the concept of QuickDialog, but the same isn't holding true for me with this taking so long to learn.

Resources