MS Bot Framework: Begin Dialog When User Taps on Hero Card - node.js

I'm having a Hero Card, which opens an URL when a users taps on it:
const message = new builder.Message(session);
message.attachmentLayout(builder.AttachmentLayout.carousel);
message.addAttachment(
new builder.HeroCard(session)
.title('Title')
.tap(builder.CardAction.openUrl(session, 'https://www.google.com'))
.images([builder.CardImage.create(session, url)]));
How can I change the tap() action so that instead of opening an URL a certain dialog is started? (Like I would do with session.beginDialog('DialogID');)?

Change the openUrl to either imBack (if you want the user to see the message sent to the bot) or postBack (to hide the message sent to the bot).
So something like
.tap(builder.CardAction.imBack(session, 'I have been tapped'))

Related

Select intent not triggered if selection is not immediately followed by carousel

I am facing a problem with listening to User Selection when we show a carousel. We are using askWithCarousel with dialogFlow and listening to click of a carousel item using actions_intent_option event. When a carousel is displayed to user, assistant starts listening to user input using mic, if mic gets a random input from user (which doesn’t match any of our synonyms for the carousel items) and then the user taps on any carousel item or says any of the synonyms, actions_intent_option event is not getting fired. It works fine if this interaction is immediately followed by showing of carousel. Else, it will take carousel title as user input and resolves to a different intent.
Not able to get the id of the carousel item because of this. Is there a way to disable mic or emit actions_intent_option even when the user clicks on carousel item later. Please help with this flow.
Selection events are only emitted, as you've discovered, right after the carousel or list has been sent to the user.
I'd recommend setting up a fallback intent to check for the titles of the list items or prompting the user with a carousel or list again.

SAPUI5 - Send email via popup dialog box

I'm wondering if it is possible to send an email in SAPUI5 via a dialog component. I have a dialog box that opens on button press and the requirement is to send a query (with optional attachment) to a email address (a possible of 5 different addresses depending on the option you select for the Subject select component).
Is this possible?
As an alternative option, I have seen the URL helper component which when pressed it loads up a mail client (eg, Outlook) but the business wanted it in a contact form style if possible.
https://sapui5.netweaver.ondemand.com/sdk/explored.html#/sample/sap.m.sample.UrlHelper/preview
On the alternative option is this what you need?
sap.m.URLHelper.triggerEmail("Smith, John <john.smith#sap.com>", "Info Request");

Bot Builder Messenger button click not routing correctly when tapped out of dialogue flow

I have a HeroCard carousel with multiple cards and buttons. These buttons correctly route if tapped immediately after the carousel is shown. However, if they are tapped at a later stage in the dialogue, the routing does not work.
How can I get buttons to correctly route the dialogue if they are tapped out of turn (i.e. tapped at some time other than immediately after the carousel is show)?
I figured it out. In version 3.1 of Bot Builder, we have the ability to listen for matches to phrases using Regex - see IntentDialog. Using this, anywhere in your dialog flow a user can type a certain phase out of context (like 'help') and can be redirected to that route.
We can use the same method when a button is tapped. The important thing to note is that the message that is returned when a button is tapped is NOT the string seen by the user. Instead, it is the route that the button is hoping to direct to.
Therefore, you can use Regex to listen for the route, and then redirect to that route. For example:
var intents = new builder.IntentDialog();
bot.dialog('/', intents);
intents.matches(/^theRouteYourButtonIsDirectingTo\//i, [
function (session) {
// Whatever you want to return
},
]);

xpages: compute Confirm Action confirmation text does not work in XPiNC

I'm using Notes/Domino 8.5.3. I've added a button control to an xpage. The button uses a Confirm Action to display a client-side prompt to the user before continuing with the next action defined for the button. When I use static text for the Confirmation Text for the Confirm Action, the confirmation prompt is displayed. However, when I change the Confirmation Text to be computed, and retrieve the text from a profile document, the confirmation prompt it not displayed at all in XPiNC. The confirmation prompt with the computed confirmation text is displayed just fine in a browser. Is there a work-around for this issue with XPiNC?
Following is the code I'm using in the Confirm Action to get the text for the prompt:
var server = database.getServer();
var dbProfile:NotesDocument = database.getProfileDocument("DBProfile", "");
var msg = dbProfile.getItemValueString("ContactsInitUpdatePrompt");
return msg;
To further my comments, this is a work around I use the below code for an app that uses the bootstrap extension library on the web but uses basic functionality with xpinc.
If the values for xPinc are different you could make the confirm action different in the browser and in the client.
if (#ClientType()== "Notes")
{
<action>;
}
else{
<action>;
}
I think that profile documents are a bad idea in xPages though. Having to restart HTTP to get a new value ruins the point I think. Almost better to hard code values at that point. I think you can set application scope to handle the work of profile documents. But then application scope in xpinc is just on the current machine as the server is the client.

FB.ui - Send dialog reappears after submitting

We're seeing some strange behavior with Facebook Send dialogs (Javascript SDK, FB.ui method). After the Send button is clicked, the dialog disappears, then reappears. The dialog does disappear after a while without any user action, but this delay varies (anywhere from a split second to several seconds).
The messages are delivered without problems.
How to reproduce:
https://apps.facebook.com/barclays_pingit/
Click on "Send Message" under the "Tell a friend" title
Add a recipient and message
Click "Send"
Or:
Click on "Make your own video"
Choose a friend, how much they owe you, and for what
Click "Make video"
You can skip to the end of the video, then click "Send video to ..."
Add a message Click "Send"
Does anyone have any ideas?
Sorry I can't give you the answer, but as I have the same problem, here is a quick patch:
var callback = function callback(response) {
var clear_callback = function(){
$('.fb_dialog').remove();
};
var arr = [250,1000,2000,3000,4000,5000,7000];
for (var i in arr)
{
setTimeout(clear_callback,arr[i]);
}
}
FB.ui(obj, callback);

Resources