Botium not picking up buttons from Botkit 4.0 - botkit

In the Botkit connector sample Botkit40 folder, there isn't a test on buttons.
ButtonsAsserter work in Botkit 0.7.

With the latest Botium Botkit Connector support for quick replies (buttons) and file attachments has been added.
So, if your Botkit bot replies something like this:
await bot.reply(message, {
text: 'Look, quick replies!',
quick_replies: [
{
title: 'Hello',
payload: 'hello'
},
{
title: 'Help',
payload: 'help'
}
]
})
You can use this BotiumScript test case for asserting the presence of the buttons:
buttons
#me
buttons
#bot
Look, quick replies!
BUTTONS Hello|Help

Related

Asking for Confirmation overriding previous responses in Google Actions

The Problem
I have a Google Actions SDK project and I am using the nodejs client library for building fulfillment. I am facing some problem trying to use the Confirmation Helper intent. It is overriding previous responses given before it. Let me give you a simplified example of the problem:
First, Action says, "Hi, hope you are having a great day"
Then, Action asks for a Confirmation, "Do you want today's weather report?"
But in the simulator, all I hear is the second question. I am targeting a Voice Only situation, so I really need all the responses. Interestingly, I can see all the responses in the AUDIO tab of simulator. How can I hear both of these phrases?
I am copy/pasting the response JSON as shown in the RESPONSE tab.
{
"expectUserResponse": true,
"expectedInputs": [
{
"possibleIntents": [
{
"intent": "actions.intent.CONFIRMATION",
"inputValueData": {
"#type": "type.googleapis.com/google.actions.v2.ConfirmationValueSpec",
"dialogSpec": {
"requestConfirmationText": "Do you want today's weather report?"
}
}
}
],
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Hope you are doing well!"
}
}
]
}
}
}
],
"conversationToken": ""
}
How can I fix this situation. Thanks!
This is intentional behavior as using one of the intents like Confirmation will be the only response, and other responses will be ignored.
There are two potential ways to get around this.
Combine all of your responses to be in the Confirmation
Create your own Yes/No intent and use simple responses for everything.

button handler in Toast message Ionic 4 is not fired, why?

I am trying to use Ionic ion-toast.
I found this example in their website: https://ionicframework.com/docs/api/toast
Now my problem is:
"handler" callback for any of the buttons added above is not called and no log appears. I tried this code on Android device and Browser Safari MacOS only both shows same issue.
I tried to use
toast.onDidDismiss().then(()=>{ console.log('Closed'); })
but that does not help since I am planning to add more than one button and I want to distinguish which button is clicked.
I know I can build my own component to do this but I am trying to know if there is something missing in my code or it is a well-known issue with ion-toast.
Code:
async presentToastWithOptions() {
const toast = await this.toastController.create({
header: 'Toast header',
message: 'Click to Close',
position: 'top',
buttons: [
{
side: 'start',
icon: 'star',
text: 'Favorite',
handler: () => {
console.log('this log should appear when this icon is clicked.');
}
}, {
text: 'Done',
role: 'cancel',
handler: () => {
console.log('This log should appear when I click done.');
}
}
]
});
await toast.present();
}
So what I expect:
when I click on the Button 'Done' or the icon 'star' (which are 2 buttons added to the toast) I should see the corresponding console.log in my console but actually I get nothing in the console.
I tried to add break-point also but both of these 2 "handler" callbacks are never called.
No error messages in the console...even no related warnings.
Is this normal? or am I missing something?
You just remove role: 'cancel' from Done button object and they start working as expected.

How to use OneSignal notification buttons in Flutter

I am using OneSignal API for sending and receiving notifications with my Flutter app. And I don't know how to use the buttons that can be added to the notification to open my flutter app to a specific screen.
My use case of the API is to create a notification template that has a button on it and send it to my users. But I don't know how to set a listener on that button that will open my flutter app.
I am using onesignal-node package for my node server.
let firstNotification = new OneSignal.Notification({
template_id: "727f42a8-0b45-470e-ac9e-908f64af44ba",
include_external_user_ids: [_id]
});
myClient.sendNotification(firstNotification, function (err, httpResponse, data) {
if (err) {
return res.status(500).send(err);
} else {
console.log(data, httpResponse.statusCode);
return res.status(200).send("Notification sent to " + user);
}
});
This is the solution
buttons: [
OSActionButton(text: "text button 1", id: "id1"),
OSActionButton(text: "text button 2", id: "id2")
],
but i dont know how i set an event to the button =(

Messenger ChatBot open link in default browser

I have a messenger chatbot that show URL Buttons. When the user tap on the URL Button a webview is opened. I'd like the user to be redirected on the default browser instead of opening the webview, is this achievable in any way? Or is there any [ugly] workaround to achieve that?
Thanks
Please refer to URL button instead of webview inside your response options. You can set type to url and then pass urlbutton params. How I am doing this is as follows.
type: 'url',
urlButton: {
url: 'somewhere.com',
title: 'Title'
},
Did you try this before adding some comment? This is the exact payload I am sending in the body and it opens the URL in new window. Please verify and let me know if you find any difficulty.
{ attachment:
{ type: 'template',
payload:
{ template_type: 'button',
text: 'xyz',
buttons: [ { type: 'web_url',
url: 'http://www.google.com',
title: 'New Button' } ]
}
}
}

BlackBerry WebWorks to invoke popping BB10 Share panel/screen

How can u get my webworks app to pop open the blackberry 10 share panel?
Ex: open a website in the browser, click the overflow button and then click share
Thank you!
You'll want to look at the invokeTargetPicker API.
Essentially, you create a request
var request = {
action: 'bb.action.SHARE',
// for a file
uri: 'file://' + path,
// for text you'd use 'data'
data: 'I am awesome',
target_type: ["APPLICATION", "VIEWER", "CARD"]
};
Then you call the API
blackberry.invoke.card.invokeTargetPicker(request, "Your Title",
// success callback
function() {
console.log('success');
},
// error callback
function(e) {
console.log('error: ' + e);
}
);
API Documentation is available here: https://developer.blackberry.com/html5/apis/blackberry.invoke.card.html#.invokeTargetPicker
I wrote a sample app, which you can test out on our GitHub repo: https://github.com/ctetreault/BB10-WebWorks-Samples/tree/master/ShareTargets
This should be an option that appears on any link, image or Text: "Share". Is the item not present in the Cross Cut menu shown?