Book an appointment via a bot - which cards/attachments? - botframework

I'd like my bot to take the user through the process of booking an appointment. I want almost exactly the flow show on the home page of the https://dev.botframework.com/
However I cannot seem to find the right attachment types to represent the list of buttons or the follow up details with the 'Book now' button. Can anyone tell me which types of attachment/card these are?

List of buttons:
It doesn't look like FB Messenger. On Telegram, a HeroCard without an image would look this way (separate messages). Otherwise a SigninCard may do.
Bottom card:
ThumbnailCard card = new ThumbnailCard() {
//...
};
activity.Attachments = new List<Attachment>() {
ThumbnailCard.ToAttachment()
};

Related

How to switch to another Teams tab calling button onclick JS/TypeScript

I am programming app with more MS Teams tabs. In first tab i have button, which should lead to switch to other Teams tab.
In TeamsToolkit I made second tab with onclick on
I'm trying to call pages.tabs.navigateToTab function:
const doClick = (evt: React.MouseEvent) => {
const tabInstance: TabInstance = {
entityId: "index0", tabName: "Personal Tab", url: "index.html#/tab", websiteUrl: "https://localhost:53000/index.html#/tab"
};
pages.tabs.navigateToTab(tabInstance);
}
but only content changes, I miss change in "selected" item in top menu:
Am I doing something wrong? Or is it even possible to manipulate "selected" item in tab list?
Another tab is another application basically (maybe not even yours, like "Files" for example or "Posts" tab). You can tell teams to activate another tab using so-called "deep links". I am not sure, how to do it with teams tookit, but with teams API you just call executeDeepLink (v1) or pages.navigateToApp (v2) with corresponding link.
Read more about deep links here:
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links

suggested actions disappear after click in directline

I have configured directline channel to Microsoft bot framework v4 with node js. I have suggested actions in welcome message. when I clicked any suggested action it disappear in UI but its response receiving to bot.
var msg = MessageFactory.suggestedActions(
CardFactory.actions([
{
type: 'messageBack',
title: 'xyz',
value: 'xyzDialog'
}]),'please select choice');
await context.sendActivity(msg);
could you please guide me how can I make it appear clicked suggested action to end user?
Thanks in advance.
As per the documentation here:
Unlike buttons that appear within rich cards (which remain visible and accessible to the user even after being tapped), buttons that appear within the suggested actions pane will disappear after the user makes a selection. This prevents the user from tapping stale buttons within a conversation and simplifies bot development (since you will not need to account for that scenario).
So in short, you cannot achieve your desired outcome with suggested actions. You have a couple of options:
Handle the suggest action in your bot code and send a reply back to the user thanking them for their input (and potentially repeating their input back to them "thank you for selecting X").
Using a CardAction instead, as per this dated sample.
Use an adaptive card (the new way), there is a sample available here, along with a detailed guide.
The downside of the last two approaches is that users will be able to repeatedly click on these buttons so your bot must handle multiple submissions in the backend.
For information on Suggest action using button.
var msg = MessageFactory.suggestedActions(['x', 'y', 'z'], 'please select choice?');
await turnContext.sendActivity(msg);
also suggestedActions need IEnumerable<CardAction> see MessageFactory.SuggestedActions Method the code will be
var msg = MessageFactory.SuggestedActions(
new CardAction[]
{
new CardAction(title: "x", type: ActionTypes.ImBack, value: "x"),
new CardAction( title: "y", type: ActionTypes.ImBack, value: "y"),
new CardAction(title: "z", type: ActionTypes.ImBack, value: "z")
}, text: "please select choice");
// Send the activity as a reply to the user.
await context.SendActivity(msg);

Microsoft Bot framework v4 change place holder text, status message, auto scroll

Multiple questions about Bot Framework V4.
Change the input field place holder text
Change the status message
Auto scroll on new message
On new message, chat bot is not scrolling down.
This issue is already asked here - 'Auto scroll' not working On Microsoft-bot-Framework (Python SDK based)
https://github.com/Microsoft/BotFramework-WebChat/issues/1031#issuecomment-459397736
Tried the workaround solution for web chat, but with adaptive cards taking some time to load, this solution doesn't scroll down fully.
Added a timeout of 3 sec, it works, but not ideal solution as there is a lag in scroll.
My Adaptive cards json is added to https://www.qnamaker.ai/, is that the reason for delay in loading?
You can change the sendBox default text by accessing the property via store, like so:
const store = window.WebChat.createStore( {}, ( { dispatch } ) => next => async action => {
store.dispatch({
type: 'WEB_CHAT/SET_SEND_BOX',
payload: { text: 'You got this!'}
});
});
The ability to customize the timestamp is, at this time, still a feature request. If this feature would be valuable to you, I would suggest you upvote and/or add your voice to the conversation.
My strong suspicion is, yes, the lag on rendering the adaptive card is due to QnAMaker. Or, more specifically, due to an API call and needing to wait for the returned result.

User validation in Google Sheets

I've been working on a project in Google Sheets for my team! The thing is: I've a sheet inside it and I want only me and 2 other people (they can edit the sheet) to see it, so that anyone entering with a "View-Only" permission would not see it!
EDIT: Let me explain a little better: I have a project which includes the specific sheet (let me call it Sheet_1) that I want to keep secret.
The project consists in a database for financial status of my team, so it is mandatory that ALL team members may see it. But there's the catch: I don't want EVERYONE in the team to see Sheet_1, I want only a specific group (call it Admins) to be able to see it. I cannot simply hide Sheet_1 because every time the Admins edit it in any way, it becomes visible for everyone again.
So let me be clear over who's involved in this
Admins: People (including me) who can see everything and change everything in the project
Non-Admins: People who must view the project in a "View-Only" Mode, and may not see Sheet_1
I've searched for a little bit and this is the code that I have:
function onOpen() {
var adminUsers = ['admin#email.com'];
if (adminUsers.indexOf(Session.getEffectiveUser().getEmail()) >= 0) {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheetname').showSheet()
}
else {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheetname').hideSheet()
}
}
But this code doesn't work! It doesn't hide the sheet when the non-Admins view my project, and it also asks for a Google login each time someone opens the project!
So, the code that I'm looking for is something like this:
function onOpen(){
var admin = [authorized emails that I inputted manually]
var email = getCurrentUserEmail()
if(email is in admin){
show specific sheet
}
else{
don't show specific sheet
}
EDIT: I see now that maybe what I'm asking is too complicated, so I'd be glad if anyone could give me suggestions!
Can anyone help me with this? I'll give more detalis if necessary!
Thanks!

show all options using prompt.choice

I'm using PromptDialog.Choice to show options to user. The problem is :
I've 4 options but only 3 of them are showed. If user wants to see the last option, must use scroll. My bot is configured for messenger channel.
I've this :
var dialog = new PromptDialog.PromptChoice<string>(options, "I can assist you with : ", "Sorry, that wans't a valid option", 2);
context.Call(dialog, UserChose);
How to override PromptStyler to get this done ?
I want to show all the options to user when prompt is created without scroll.
Is that possible ?
EDIT after Ezequiel's comment:
If you use PromptStyle.Keyboard, you will automatically get a correct display as the QuickReply style is now supported by the framework:
Initial answer:
If you are only using Facebook Messenger channel, you may use Ezequiel Jadib's Quick Replies implementation: https://github.com/ejadib/QuickReplies
It uses Facebook's ChannelData to set up real quick replies that Facebook Messenger displays in a good look-and-feel: https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies
Samples:
You can read more info on this blog post: http://southworks.com/blog/2016/09/15/sending-facebooks-quick-replies-using-microsoft-bot-framework/

Resources