How do I utter a message immediately before custom action? - rasa-nlu

I'm trying to notify a user that a custom action is about to take place. I thought making a story where a simple utterance followed by that action would be enough.
## Story changeModel
* changeModel
- utter_model_changing
- changeModel
I want the previous bot to say goodbye, a wait, then the next bot to say hello. At the moment though, the wait happens immediately after the user message, then the two bot messages come back concatenated.
E.g.
"change the model"
long wait
"
Please wait while I get the new bot online.Hey, New Bot here. What can I help you with?"
I've also tried putting multiple dispatcher.utter_message(msg) statements in my custom action but this has the same result as above.
How can I send a message and have it appear for the user before the long custom action is executed?

Related

Initial survey won't trigger a series of automated surveys. Can someone advice?

I have a survey called 'Set up and kill switch' (image 1) that will trigger a series of weekly surveys to be sent out, but it's not working. I'm not sure if I didn't set it up correctly or if the logic is not right. I attempted to set it up as sending surveys out via email. In step 3 (refer to image 2), I also specified the conditions: when the set up and kill switch survey has been completed and if the predetermined date in the survey matches the date 'today', the system should activate automated surveys for the next 8 weeks so participants should be receiving them on a weekly basis. However, when I tested this out, I did not receive a survey after completing the kill switch survey. Does anyone have experience in making something like this on redcap? I suspect that the logic is fine, but it could be an issue between linking participant IDs so they aren't receiving anything?
Logic code:
datediff([weekly_questionnai_arm_3i][weekly_date],"today","d","mdy",true)>=0 and ([weekly_questionnai_arm_3i][weekly_killswitch(0)])<>"1"
Kill switch screenshot
Automated survey logic
You need to check the box next to 'Ensure logic is still true before sending invitation?'.
As soon the send logic is true the automated emails will be queued/scheduled for sending - changing the form fields so that the send logic is no longer true will not stop the scheduled emails from being sent unless the 'Ensure logic is still true ...' box is checked.
I also recommend clicking and reading the link underneath "How to use 'stop logic' to disable an automated invite".

Can we implement countdown feature for the slack message?

Is there a way to implement the countdown feature for the slack message using Slack API?
The message should only be valid for specified amount of time and then it should disappear or stop user interaction with it.
Yes technically this is possible. To display the countdown you need to use two methods, that is chat.postMessage and chat.update. chat.postMessage is for posting the initial message that contains the full counter say 5 minutes. After the initial message is posted you will need to run a loop in you code that updates the initial message with the depreciating value (4 minutes, 3 minutes and so on) using the chat.update method. After the countdown ends you can now delete or update the blocks to remove the interactions (buttons and so on). I hope that provides some insight.

Bot greeting stops working when adding QnA Maker resource

Using the awesome resources provided by Microsoft.
Following the documentation at https://learn.microsoft.com/en-us/composer/
Create Folder somewhere
Perform https://learn.microsoft.com/en-us/composer/setup-yarn in that folder
Perform https://learn.microsoft.com/en-us/composer/tutorial/tutorial-create-bot
Test in Emulator: Pressed Restart Conversation - New User ID: Works fine, responds with: Hi! I’m a friendly bot that can help with the weather. Try saying WEATHER or FORECAST.
Perform https://learn.microsoft.com/en-us/composer/tutorial/tutorial-add-dialog
Test in Emulator: Presents ”Let’s check the weather” som response på user input “weather”. Works fine.
Then create new Trigger with Dialog event and Dialog started and continue with: https://learn.microsoft.com/en-us/composer/how-to-add-qna-to-bot, enter the following in the settings
Please note that in order to use the Settings values, an extra “=”
has to proceed the id, e.g. “=settings.qna.knowledgebaseid”.
Please also not that in order to make this work in Europe, with our
“,” instead of “.” as decimal marker, the Threshold has to be set to
“float(‘0.3’)” in order to be evaluated as a float.
Make sure that the settings are accurate according to your QnA Base.
Please note that at this point the LUIS fiels are left mostly empty,
except for the values prefilled as described in
https://learn.microsoft.com/en-us/composer/how-to-add-qna-to-bot
No LUIS added at this point.
Restart bot
Click Test in Emulator
Press Restart Conversation - New User ID
Now there are three problems:
A. There is no longer any greeting phrase.
B. The first response from QnA maker results in a “The given key ‘stepIndex’ was not present in the dictionary.”. Then after this the QnA maker part works, but issue A and C are still present.
C. The weather regex does only trigger once if it is the first entry only, then at the second attempt or after entering something else, it fails to trigger.
Expected behavior:
When Press Restart Conversation - New User ID, the bot should greet
the user.
When the weather regex is the best choice it should trigger
The text “The given key ‘stepIndex’ was not present in the dictionary” should not be presented as the first response, instead the right reply should be presented based on the intent provided.
I`m a bit late to the game on this but I hit the exact same issue in composer and found the same problem. The suggested approach to use unknown intent in MS Docs does not work well. its really just a tutorial to get you up and running as quickly as possible, with no real thought beyond that - and as you point out, it easily gets stuck in an internal loop that prevents other intents from firing.
Assuming you are using Luis.ai, a "QnA intent recognised" should be added & a "duplicate intent recognised". this will make sure that automatic cross-training is implemented such that QNAmaker will know about Luis Questions and vice versa and they will not only understand their own questions but know to exclude the questions in the other approach. This will make for better training. However, depending on how similar questions are in both, they may both return matches of varying confidence anyway - this is what the "duplicate intent recognised" is for. It catches both before they execute their intents and implements checks for confidence against each and re-raises the event that wins out. Thus ensuring only one of the two is recognised and executed.

Trigger not firing on subject line after Outlook gets a new email

I'm trying to post a message to a Slack channel each time we receive a confirmed booking via email through Airbnb.
Tried Zapier, by scanning new emails with the subject "Reservation confirmed" sent to our Microsoft Outlook email. If the email has that subject then the zap should posts its contents (body) in the channel. However, the first step (trigger) doesn't recognize new emails.
This is what the Zap looks like:
Step 1: check if a new email is received in Outlook ==> this is the test never passes, because it can't find sample data.
Step 2: filter emails that contain the subject Reservation confirmed (in Dutch)
Step 3: post a message in a Slack channel
Your filter step has "text contains" option followed by the words. While that is logical from a human standpoint it can cause some problems with zapiers filter. Try filtering for each word separately like so:
Subject Contains(text) yourFirstWord
AND
Subject Contains(text) yourSecondWord
This will clear up your filter problem.
Also, double check that subject is not something you typed in but that it is the actual outlook output variable.
If it passes through the filter and still doesn't get to slack then the issue is elsewhere. You may want to post sample data if that doesn't work because it could be that the subject line has hidden whitespace (rare but has happened to me) or other values that is making it filter out. If that's the case I'll edit and update this answer.

What is the purpose of session.endConversation()

I am developing a bot in node.js using the Microsoft Bot Framework. Once my user has completed their action with my bot; I am calling session.endConversation(). However, I am not sure really what this is doing. My assumption when calling this code would be that it would clear out session data; so if the user interacts with the bot again; they will essentially be starting over.
However, when I call endConversation(), the user data is still there:
session.endConversation("Thank you for your business!");
console.log("User Data:");
console.log(session.userData);
The documentation just says, "ends the conversation" but doesn't describe what in fact that means.
I guess my question is; what is this function doing and when you are finished with a conversation, what should the approach be to handle the users conversation data?
According to this post:
As a result, when a conversation or dialog has come to an end, it’s a best practice to explicitly call endConversation, endDialog, or endDialogWithResult. endConversation both clears the current dialog stack and resets all data stored in the session, except userData. Both endDialog and endDialogWithResult end the dialog, clear out dialogData, and control to previous dialog in the stack. Unlike endDialog, endDialogWithResult allows you to pass arguments into the previous dialog, which will be available in the second parameter of the first method in the waterfall (typically named results).

Resources