botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Prompts.confirm is not working after the call session.send.

Open giriganapathy opened this issue 10 years ago • 20 comments

Hello team, I have a scenario like showing some offer about some product and asking confirmation from the user, and hence I tried below code in node.js: var captionText = "We have found a perfect offer for you. Please check this.\n"; var reply = new builder.Message() .setText(session, captionText) .addAttachment({ text: "", title: session.userData.selectedOffer, titleLink: "", contentType: "image/jpeg", contentUrl: ""
});

session.send(reply); builder.Prompts.confirm(session, "Do you like to proceed " + session.userData.name + "?\nPlease confirm." );

Please correct me, if I am wrong.

Thanks and Regards, Giri G.

giriganapathy avatar May 08 '16 18:05 giriganapathy

Is it just not working in the emulator? For multi-send to work with the emulator you need to manually adjust the endpoint replies are sent to. See examples/TestBot/BotConnectorBot.js for an example of doing this. This should all go away in our next update.

Stevenic avatar May 08 '16 18:05 Stevenic

Hello Steve, Thanks for your swift response. And the issue I faced here is: In emulator, I could not see the Prompt after session. send. and In web chat, It comes only once...it is not consistent. Let me go through for the emulator as per your reference.

And with respect to webchat, any direction you suggest. And here is my bot id:VZChatBotApp for you to debug, in case, if you got access.

Regards, Giri G.

giriganapathy avatar May 08 '16 18:05 giriganapathy

I didn't see any issue with your code so not sure why WebChat wouldn't be working.

Stevenic avatar May 08 '16 18:05 Stevenic

ticket I have uploaded with screen shot. when I showed one offer first time, it is asking the confirmation. However, when I showed the another offer, the confirmation is not asked (check the image on the right side).

Regards, Giri G.

giriganapathy avatar May 08 '16 18:05 giriganapathy

another issue is, the titleLink attribute for the attachment is not coming in webchat. Please take a look Steve.

giriganapathy avatar May 08 '16 18:05 giriganapathy

Hello Steve, did you get a chance to debug these issue?

giriganapathy avatar May 09 '16 15:05 giriganapathy

My guess is that userData.selectedOffer is null after the first offer. You might try verifying that you in fact have a link (pass it as part of the text)

Stevenic avatar May 10 '16 00:05 Stevenic

No it is not. Basically the confirmation dialog is not behaving consistently...Please take a look.

giriganapathy avatar May 11 '16 07:05 giriganapathy

Oh I see... the second call to confirm is getting dropped. That's interesting. Is it always the case that only the first one comes through? Could you do me a favor and try adding session.send("test text"); before the call to Prompts.confirm(). This would help me figure out if the issue is in the webchat control as this doesn't reproduce for me using the emulator.

Also to get multiple prompts working in the emulator you'll need to temporarily add bot.configure({ endpoint: 'http://localhost:9000' }); which tells the bot to send the additional prompts to the emulator. There's a fix for this coming that removes the need to do this.

Stevenic avatar May 11 '16 19:05 Stevenic

I just published v0.10.0 which fixes the emulator issues. Please update and give the emulator another try.

Stevenic avatar May 12 '16 05:05 Stevenic

Sure. Thanks, I will take a look for emultator. Currently I am testing it on web chat, where we noticed the above issues. Would appreciate, if you could make it happen (allowing Prompts. confirm() after session.send() call) in webchat context.

Regards, Giri G.

giriganapathy avatar May 12 '16 09:05 giriganapathy

It could be that the WebChat control is acting up. I need to narrow down that this is something specific to the WebChat control as that's a completely different team. That's why I keep asking if it works elsewhere.

Stevenic avatar May 12 '16 10:05 Stevenic

Could you try v0.11.0 and let me know if you're still having issues. I fixed a number of things around prompts.

Stevenic avatar May 20 '16 01:05 Stevenic

Sure...will get back to you.

Regards, Giri G.

giriganapathy avatar May 20 '16 15:05 giriganapathy

Where does this issue stand?

Stevenic avatar Jun 01 '16 08:06 Stevenic

Hello Steve, Sorry for the belated response... I could see only botbuilder 0.9.2, when I try to lookup the module from "install new npm packages" in Visual Studion 2015. Can u please tell be where I could download it?

giriganapathy avatar Jun 15 '16 15:06 giriganapathy

if that is the latest code, then i can say the issue still exists. Could you please respond. Thanks.

giriganapathy avatar Jun 15 '16 16:06 giriganapathy

The latest version is 1.0.1

Stevenic avatar Jun 15 '16 20:06 Stevenic

Hello Steve,

I tried this basic code, but it is failing still. The Prompts are not appearing after the send. This is happening in emulator and web chat.

function (session) {
    // Send a greeting and start the menu.
    session.send("Message 1");
    builder.Prompts.confirm(session, "Do you like to proceed?");
},
function (session, results) {
    if (results.response) {
        // Always say goodbye
        session.send(results.response);
    }
    else {
        // Always say goodbye
        session.send("Ok... See you later!");
    }
}

I am using the [email protected]. version only. Appreciate your response.

Regards, Giri G.

giriganapathy avatar Jun 19 '16 15:06 giriganapathy

Closing this issue due to age. @giriganapathy - please open a new issue if this issue is not fixed and needs further discussion. @Stevenic - reopen if necessary. Thanks!

v-thgratMSGit avatar Jul 12 '16 21:07 v-thgratMSGit