Configure a default scenario in MS Health Bot Service - azure

I am using Microsoft's Health Bot Service to create a healthcare bot.
I have created 2 scenarios and I want one of them to be the one that will kick off when starting a new conversation.
I failed to find anywhere in the Health Bot Service portal how to configure this.

If you want the bot to start the scenario before the user has interacted with it, that feature isn't currently available since "before triggering a scenario, the bot waits for initial input from the end user."
As the Health Bot was just made available to the general public in the last week, that feature may be added in the future, but I'm not sure.
Currently, if a user has initiated a conversation with the bot previously, you can send proactive messages.
Otherwise, I'd suggest doing the following to get close to what you're looking for:
In Configuration > Conversation > Interactions, change the Automatic welcome to something like, "Say "start scenario" to get started." Obviously, change "start scenario" to whatever makes the most sense for your use case.
Step:
Result:
Go to Scenarios > Manage and create your "Kick off" scenario
Step:
Go to Language > Models and make a new model. Use LUIS or RegEx, but make sure that the expression it looks for is the one you told the user to use in step 1. Then, for Intent Mapping, point it to the scenario you created in step 2.
Step:
Result:

Related

Why doesn't the Azure Bot Service Slack connector forward Events and Interactive Messages?

Update: June 30, 2020
After more testing, I have details that might help someone recognize my problem.
The issue seems to be that Slack is sending data to Azure Bot Services, but that data isn't being forwarded to my code. Ive been able to use the Bot Emulator without any problems and the Azure Web Chat works fine.
I know that the Slack configuration for the OAuth Redirect URL is correct (I was able to add my bot to Slack) and the Request URL for Events is correct (they sent the 'challenge' and it's verified). I've subscribed to the exact Scopes and Events that are in the Microsoft documentation and I've verified that the Interactivity and Events options are enabled.
When a user types text in my bot's Slack channel, my app receives "message" activity and my code can send a response, so it looks like Microsoft can communicate end-to-end for normal messages. I do not receive any data when users first join my bot (like a ConversationUpdate) or if they click a button in a dialog. I can see Slack sending data when a button is pressed, it just never arrives.
As a test, I copied the Messaging Endpoint from my Azure bot settings and pasted it into Slack's Interactivity "Request URL" and when I click a button in Slack I can see the data that Slack is sending (sadly in a format that my code can't handle).
Original Post
I have a Bot Framework app (v4) that I've written in nodejs. It works well and I have an ActivityHandler that responds to people being added to a conversation and when they send messages. I was able to get pro-active messaging functioning and everything was great until I tried to get interactivity working.
I started off using some sample button code from Microsoft's documentation:
let reply = MessageFactory.suggestedActions(['Red', 'Yellow', 'Blue'], 'What is the best color?');
await turnContext.sendActivity(reply);
This works fine in the emulator, but in Slack it renders as a bulleted list. It looks like that's the way that "suggested actions" are handled in Slack.
I changed my code to use a "hero card":
let card = CardFactory.heroCard(
'What is the best color?',
undefined,
CardFactory.actions([
{
type: 'imBack',
title: 'Color Red',
value: 'Red Value'
}
])
);
let reply = MessageFactory.attachment(card);
await turnContext.sendActivity(reply);
This works okay in the emulator, except my app thinks the user typed "Red Value" and the button stays on-screen and is still clickable. I might be able to work around that, but the button doesn't work at all in Slack. It is rendered fine, but I don't get a notification in my app.
Clicking the button shows an HTTP request to:
https://{MY_SLACK}.slack.com/api/chat.attachmentAction?_x_id=f8d003c3-1592436018.632&_x_csid=NcWi3y50lFU&slack_route={OTHER_SLACK_STUFF}
And I can see that the request POSTs all sorts of data including:
payload: {"actions":[{"id":"1","name":"imBack","text":"Color Red","type":"button","value":"Red Value","style":"default"}],"attachment_id":"2","callback_id":"{MAGIC_NUMBER}:{TEAM_ID}","channel_id":"{CHANNEL_ID}","message_ts":"1592435983.056000","prompt_app_install":false,"team_id":"{TEAM_ID}"}
I'm not sure how to see anything useful in the Azure Portal - the analytics option for my bot doesn't seem to work and the activities option only says "Write a Bot Service". I don't see any sign of the message going from Slack to Azure.
I'm developing locally and configured ngrok so that my messaging endpoint in Azure could be set to https://69fe1382ce17.ngrok.io/api/messages On the Slack side of things, I've configured the Interactivity Request URL to be https://slack.botframework.com/api/Actions The Event Subscription Request URL is https://slack.botframework.com/api/Events/{MY_BOT_NAME}
What I would like is a set of buttons with different options and when the user clicks one, my bot gets some sort of "value" instead of message text. I'd also like for the button to go away so the user can't send repeated commands. It would be nice if the hero card collapsed with just the prompt being displayed.
Are there any interactive options that work for Slack and other channels?
Thanks!
Lee
I know linking to another site with no additional detail is frowned upon, but I don't have enough expertise to answer your question. I suspect the link here might move you in the right direction:
Choice Prompts are not translated over to Slack format #3974
Good luck!
Your question is multifaceted so I'll try to break it down into smaller pieces.
What's the deal with suggested actions in Slack?
Suggested actions are not supported in Slack, but the Bot Builder SDK thinks they are. This is a longstanding bug. I've just reported it again on the docs page you linked: https://github.com/MicrosoftDocs/bot-docs/issues/1742
This means you would encounter problems if you were trying to have the choice factory automatically generate the right kind of choices for your channel. You're not doing that, so you should be fine. Hero cards are supposed to work in Slack.
Why aren't hero cards working in Slack?
First I need to mention that hero cards only work with the Slack connector and not the Slack adapter. You seem to be using the connector so you should be fine.
I suspect your problem is related to how you've configured your bot's settings on the Slack side. There is a step in the Bot Framework doc that seems to be important if you want to get buttons to work. If you've followed the doc exactly and you still can't get buttons to work, it may be worthwhile to dig into the Slack API documentation.
How do I only allow a button to be clicked once?
You can update or delete the activity. There's no easy way to do this, but if you voice your support for my cards library then it can be done for you automatically.
The Slack connector actually puts a lot of relevant information in the incoming activity's channel data, and you can use that to figure out what activity the incoming activity came from. That would take some experimentation on your part.
There's another approach that works on more channels than just Slack. It's real complicated, but if you wanna tackle this then here are the basic steps:
You need to put an ID in the action data to help your bot identify the action.
You need to save the activity ID that gets returned when you send the action to Slack.
You need to associate the returned activity ID with the ID you put in the action data.
You need to retrieve the activity ID using the action data ID when the user clicks the button.
You need to use that activity ID to update or delete the activity.
Unfortunately there's no centralized guide to help you do this, but there are many examples explaining it scattered across Stack Overflow. Here is a good one: https://stackoverflow.com/a/55174866/2122672

Is there any way to use a received sms as a trigger in a logic app if it's not the initial trigger?

I'm trying to use a twilio sms as a trigger for a step in my logic app that isn't at the very start. The app is meant to simulate a conversation between the user and the app so i need the app to wait for the user to respond.
For example, a conversation might go like
User: Hi
App: Please give me an animal
User: Cat
App: Ok, you said cat
All the tutorials I've found on making a sms a trigger for a logic app just show how to use the "when an https request is received" as the very first step of the logic app. I tried adding another "when an https request is received" as an activity after the "send sms" activity where "please give me an animal" is sent but it says "you cannot use this trigger as an action."
Essentially I'm looking for an activity to make the app wait for the user to respond to "please give me an animal" before the app goes into the "ok you said..." part.
This is my first time using logic apps so I'm hoping that makes sense, please let me know if more info is needed.
Sorry you can't. There can be only one trigger. Some actions like something similar to approval flow which could be used but there isn't one for twilio.
Also what you want is really just a chatbot. I think you should look at Azure Bot Service instead. It allows for conversations thought twilio SMS as one of the channels.
https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-twilio?view=azure-bot-service-4.0
You can achieve what you are trying to do with Twilio. Twilio Studio send and wait for reply widget will wait for a reply before moving to the next widget. The example below is outbound but can easily trigger off an incoming message, by attaching the Studio Flow to that Twilio number.
Conduct a Survey with Twilio Studio
Also, Twilio Autopilot could achieve a more flexible response model.
Getting Started with Twilio Autopilot

How to ensure my Google Home Assistant application is not rejected?

During our testing, we were unable to complete at least one of the behaviors or actions advertised by your app. Please make sure that a user can complete all core conversational flows listed in your registration information or recommended by your app.
Thank you for submitting your assistant app for review!
During testing, your app was unable to complete a function detailed in the app’s description. The reviewer interacted with the app by saying: “how many iphones were sold in the UK?” and app replied “I didn't get that. Can you try with other question?" and left conversation.
How can I resolve the above point to approve my Google Assistant action skills?
Without seeing the code in question or the intent you think should be handling this in Dialogflow, it is pretty difficult - but we can generalize.
It sounds like you have two issues:
Your fallback intent that generated the "I didn't get that" message is closing the conversation. This means that either the "close conversation" checkbox is checked in Dialogflow, you're using the app.tell() method when you should be using app.ask() instead, or the JSON you're sending back has close conversation set to true.
You don't have an intent to handle the question about how many iPhones were sold in the UK. This could be because you just don't list anything like that as a sample phrase, or the two parameters (the one for object type and the one for location) aren't using entity types that would match.
It means that somewhere, either in your app description or in a Dialogflow intent(they have full access to see what's in your intents) you hinted that “how many iphones were sold in the UK?” would be a valid question. Try changing the description/intents to properly match the restrictions of your app.

Slackbot triggering actions and other bots

Slackbot can be configured to respond something when you say some selected key words. Can that feature be use to trigger actions.
For example, when I say meeting, can it execute the command /todo #me meeting due today?
You can setup custom triggers for the slackbot, but it won't do what you're looking for because the todo-bot actions don't seem to trigger from another bot.
To setup custom slackbot responses you'd go to Customize Slack, then select the tab option for the Slackbot. From here, if the word in the left column is seen in a channel, slackbot will respond with the text on the right. It can't grab any info like the channel name or user name, just respond with text. This is useful for reminders like the wifi password or some brief custom help message.
Todo-bot now has webhooks. I haven't used it myself, but I've linked to the introduction page below. You can't do this entirely from within slack; An outside piece of software or server would need to be setup to monitor slack for triggers and create custom prefabricated todo's.
https://help.todobot.io/hc/en-us/articles/115010096748-Incoming-Webhooks

custom Conversation dialog new intents

In trying to work with custom dialog I have encountered some issues. While using Virtual Agent as a testing grounds, I have been trying to redirect all input to a Conversation workspace by doing the following:
Disabling all intents other than the 3 mandated ones (Connect to Agent, Agent Settings, None of the Above).
Configure custom dialog to be invoked on the intent "None of the Above".
This should have the effect of sending all input to the "None of the Above" which essentially sends any input straight into the Conversation workspace. When testing this approach without tying in the workspace, the simple canned message does get invoked on any input as expected. However, when adding the workspace ID and Conversation credentials (checked several times for accuracy), I get the error:
Error -- Unable to create custom dialog service
So I am wondering why this might occur.
Your logic is correct but this error means there is a missing or incorrect workspace attribute.
Please use the following values:
Conversation endpoint
"https://gateway.watsonplatform.net/conversation/api"
API Version:
"2016-07-11"
CaesarOG:
The Off_Topic intent is "special" - it invokes your custom workspace without forcing the intent to be Off_Topic (unlike the other intents in Watson Virtual Agent). This design decision was done so that you could do the sort of thing you are trying to accomplish. If in your custom Conversation workspace you have custom intents, and you add your custom dialog to respond to those intents, the Watson Virtual Agent will have Conversation evaluate your utterances against the custom intent detection system and trigger your custom dialog as you would expect.

Resources